correcting syntax of the constraint

Problems with syntax of GAMS
Post Reply
shaparak
User
User
Posts: 11
Joined: 4 months ago

correcting syntax of the constraint

Post by shaparak » 1 month ago

Hello friends,
I have defined a constraint, in which related SolEQUE is not correct. here is the constraint:

Code: Select all

Con35(busp,nodep) $ (conex(busp,nodep)) .. sum( (bus,node)$ (conex(bus,node) and bus.val<node.val ) , Inci(busp,nodep,bus,node)* (Pl(bus,node)) ) =l= 1;
In which Inci is a parameter, Pl and Plattack are variable, bus and busp and node and nodep and conex are set and Con35 is equation. The problem is solved with solved variables and solved equations, but the value for this equation does not show the correct value.
in another gms file, I have defined a parameter equal to Pl variable whose value is equaled to the solved value from previously solved problem; and I have defined the above equation with loop and if, to get the answer. the answer was completely different, and it was exact and correct! here is the loop:

Code: Select all

loop(busp,
loop (nodep,
if(conex(busp,nodep),
III(busp,nodep) = sum((bus,node)$ (conex(bus,node) and (bus.val<node.val)) ,Inci(busp,nodep,bus,node)* (Pl(bus,node) ));
);
);
);
bus, node, busp and nodep are defined repetitively, III is a parameter whose value is solved with above loops and is the correct answer for Con35 equation. can anyone help me to find why the first code does not answer like the second one?

Post Reply