HI,

I am working on a code and have all my constraints in ‘for’ loop.

Can I assign and get the dual variable values associated with an equality constraint? I’m trying the method given in the examples but the code always gives an error (Dual variable “lambda” has already been assigned.)

excerpt from the code:

cvx_begin

variables pG(5) qG(5)

dual variable lambda

minimize c*(pG)

subject to

```
for k=1:5
bus(:,k)'*pG - pD(k) == pf %%% need dual variable value for these set of equations
end
```

…

cvx_end