[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Syntax error in Glpk modelling
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Syntax error in Glpk modelling |
Date: |
Tue, 19 Mar 2013 03:03:53 +0400 |
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];
- Re: [Help-glpk] Syntax error in Glpk modelling,
Andrew Makhorin <=