On Tue, 2013-03-19 at 00:45 +0200, Figen Güngör wrote:
> Can you please look at my question at Stackoverflow?
> http://stackoverflow.com/questions/15488041/syntax-error-in-linear-programming-modelling-with-glpk?noredirect=1#comment21925482_15488041


> var po := sum{i in I} c[i]*x[i];
> 
>  var cost := sum{i in I} a[i]*y[i] + b[i]*x[i];

> I am getting this syntax error:
> 
> problem.mod:21: syntax error in variable statement 
>       Context: ...I } ; param d { i in I } ; var x { i in I } >= 0 ; var po :=
>       MathProg model processing error
> 
> Can you please help me out?
> 

In MathProg you cannot assign a value to a variable.

If you need to fix a variable at some value, you need to use appropriate
equality constraint, e.g.

var po;

s.t. foo: po = sum{i in I} c[i]*x[i];

var cost;
 
s.t. bar: cost = sum{i in I} a[i]*y[i] + b[i]*x[i];



_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to