------------------------------------------------------------ To: Figen G?ng?r <[email protected]> Subject: Re: [Help-glpk] Syntax error in Glpk modelling Message-ID: <1363647833.12922.4.camel@corvax> From: Andrew Makhorin <[email protected]> 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]; Hi Figen Thanks for transferring the answer back to the stackoverflow site for other to access. Robbie --- Robbie Morrison PhD student -- policy-oriented energy system simulation Technical University of Berlin (TU-Berlin), Germany University email (redirected) : [email protected] Webmail (preferred) : [email protected] [from Webmail client] _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
