
From:  Raar, Dale 
Subject:  Re: [Helpglpk] Error: expression following = has invalid type 
Date:  Wed, 27 Jul 2011 18:25:34 0400 
> Hello Diego, > >> var sp{s in S, p in P} = sum{c in C} (sc[s,c] * sum{r in R} x[c,p,r]); > > variables cannot be set in the declaration. Instead you can create > a constraint, e.g. > > var sp{s in S, p in P}; > > maximize my_objective : > sum{s in S, p in P} sp[s,p]; > > s.t. my_constraint{s in S, p in P} : > sp[s,p] = sum{c in C} (sc[s,c] * sum{r in R} x[c,p,r]); > > If sp, sc, x are parameters, you can write: > param sp{s in S, p in P} := sum{c in C} (sc[s,c] * sum{r in R} x[c,p,r]); Xypron – I am having a similar issue, but my original setup was using parameters. I can not get the solver to use my primary variable with a numeric function (mod and abs in my case). Here is a subset of my model: param Def_SPk integer default 1; set R; set I; set T; param S{i in I} > 0 default Def_SPk; var p{i in I, r in R, t in T} integer >=0; s.t. StdPack{i in I} : s[i] = sum{r in R, t in T}(p[i,r,t] mod S[i]) ; I do not see an issue with using variable p this way – what am I missing? Thanks, Dale J. Raar • Manufacturing & Supply Chain • Gentex Corporation – Zeeland, MI • 616.772.1800 x5279 • Cell: 616.402.1071 
[Prev in Thread]  Current Thread  [Next in Thread] 