I am working on a special network flow problem, something like a (N∗N)
grid, and I am having difficulties to define some of its sets. The problem is stated as follows:
What I am trying to obtain the corresponding sets is:
set i / i1 * i8 /;
set j / j1 * j8 /;
alias (i,ii),(j,jj);
;
set V(i,j); V(i,j)= yes;
display V;
;
set nb(i,j,ii,jj);
nb(i-1,j,i,j) = yes;
nb(i+1,j,i,j) = yes;
nb(i,j,i,j-1) = yes;
nb(i,j,i,j+1) = yes;
display nb;
However, I am unsure if the result can correspond to what I expected in the following (8*8)
grid: (for summarizing, I omitted the rest of the values)
set N[1,1] = (1,2) (2,1);
set N[1,2] = (1,1) (1,3) (2,2);
set N[1,3] = (1,2) (1,4) (2,3);
set N[1,4] = (1,3) (1,5) (2,4);
set N[1,5] = (1,4) (1,6) (2,5);
set N[1,6] = (1,5) (1,7) (2,6);
set N[1,7] = (1,6) (1,8) (2,7);
set N[1,8] = (1,7) (2,8);
…
Also, I need to define the source and sink nodes as a pair-node like:
Source = (2,1) (2,2) (2,5) (2,6) (6,2) (8,1) (8,5);
sink = (2,3) (2,7) (5,3) (5,5) (6,8) (7,8) (8,8);
where the first element in the source, (2,1)
, is referred to as the start point of the first commodity, and the first element of the sink, (2,3)
, would be the endpoint of the first commodity, And so on. I was wondering if, how can I define the correct corresponding sets?