Code: Select all
sets
nd node (bus) /n1*n6/
cl(nd,nd) candidate lines /n1.n2,n2.n3/
y /y1/;
alias (nd,nf,ni)
variable
xl(y,nf,ni)
TotalInvCost ;
equations
Objective
InvContLine(y,nd,nd);
Objective .. TotalInvCost =e= sum((y,cl), xl(y,cl));
InvContLine(y,cl(nd,nd)).. xl(y,cl) =g= 1;
model a /all/;
solve a using lp min TotalInvCost;
1. optimal
syntax 1:
Code: Select all
InvContLine(y,cl(nf,ni)).. xl(y,cl) =g= 1;
syntax 2:
Code: Select all
InvContLine(y,cl(nf,ni)).. xl(y,nf,ni) =g= 1;
Code: Select all
InvContLine(y,cl).. xl(y,cl) =g= 1;
2. wrong
syntax 4:
Code: Select all
InvContLine(y,cl).. xl(y,nf,ni) =g= 1;
3. unbounded
syntax 5:
Code: Select all
InvContLine(y,cl(nd,nd)).. xl(y,cl) =g= 1;
1. Compare syntax 2 and syntax 4, what's the difference? Why is the syntax 4 wrong?
1. Comparing syntax 5 and syntax 1, I notice that in the equation list, Constraint "InvContLine" shows none, which is the reason of unbounded result. However, what's the difference of cl(nd,nd) and cl(nf,ni) in the definition over equations. Is there any restriction on the use of Alias?