### correcting syntax of the constraint

Posted:

**Sat Sep 04, 2021 5:48 pm**Hello friends,

I have defined a constraint, in which related SolEQUE is not correct. here is the constraint:
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:

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?

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 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) ));
);
);
);
```