Search found 1043 matches
- 5 days ago
- Forum: Modeling
- Topic: Error on finding max value in MIP
- Replies: 1
- Views: 325
Re: Error on finding max value in MIP
Hi, you need to reformulate this in a linear way. There is plenty of good literature out there that gives this type of reformulation tricks. I personally like the book Model Building in Mathematical Programming by HP Williams . Knowing the literature and understanding the basics helps you write good...
- 1 week ago
- Forum: Modeling
- Topic: How can I random the consecutive number?
- Replies: 5
- Views: 710
Re: How can I random the consecutive number?
You can just check if no 1-sequence starts in r1 or ends in r10. If that's the case you just take first column or last column to be the start/end. -Michael set i /r1*r10/, j /c1*c6/, iter /1*3/; parameter rowstart, cnt, randval(i,j) Random values, randvalloop(iter, i,j) Store the random values; $set...
- 1 week ago
- Forum: Tools
- Topic: GDX MPS2GMS
- Replies: 2
- Views: 513
Re: GDX MPS2GMS
MPS2GMS reads an MPS file and provides you with a pretty generic GMS file and the data (coefficients, bounds, rhs) in the GDX data. Hence, you can solve your MPS file abc.mps by running "mps2gms abc.mps" and afterwards "gams abc.gms".
Good luck,
-Michael
Good luck,
-Michael
- 1 week ago
- Forum: Syntax
- Topic: BESS modeling Error 148 and 258 in obj function.
- Replies: 1
- Views: 401
Re: BESS modeling Error 148 and 258 in obj function.
Hi, First the is a very nice formatting control to copy and paste code. Please use that. On the particular question. You have an objective variable obj(h,z), so for every h and z there is a variable and you ask the solver to optimize it. A solver can only optimize a single variable not h times z man...
- 1 week ago
- Forum: Modeling
- Topic: How can I random the consecutive number?
- Replies: 5
- Views: 710
Re: How can I random the consecutive number?
Here is some GAMS code of what I think you want to accomplish. Not sure what the iter was about, but I create now iter many of such tables with random starting position of 4 consecutive ones in the columns: set i /r1*r10/, j /c1*c6/, iter /1*3/; parameter rowstart, cnt, randval(i,j) Random values, r...
- 2 weeks ago
- Forum: Syntax
- Topic: Connecting ordered sets
- Replies: 2
- Views: 1110
Re: Connecting ordered sets
If you need the previous "period" in your model, you should think in terms single dimension time periods rather than (y,d,t) tuples and model with this. If you need occasionally access to data of a particular year, date, hour of a period you can do this by mapping from the period to the y,...
- 3 weeks ago
- Forum: Modeling
- Topic: Nonlinear Programming/ Steiner Weber Modell with barriers
- Replies: 1
- Views: 973
Re: Nonlinear Programming/ Steiner Weber Modell with barriers
This is a straight forward text book optimization problem. Get the math straight and GAMS will follow. If you have detailed questions on how to to particular formulations or tasks in GAMS you will find answers here. Getting the math right is the whole fun and you should not shortcut this experience....
Re: Erorr 149
What i should GAMS use for the s(i)? The control of i stops with the sum. The equation is controlled over j.
-Michael
-Michael
- 4 weeks ago
- Forum: Syntax
- Topic: A problem with parentheses
- Replies: 3
- Views: 1188
Re: A problem with parentheses
Not sure what editor you used, but GAMS does not like your "≤" nor the "∗". These are unicode characters not part of the GAMS language, hence the compiler gets confused. Just use the regular ASCII characters/character sequence "<=" and "*".
-Michael
-Michael
- 1 month ago
- Forum: Syntax
- Topic: $ifThen set X or Y
- Replies: 2
- Views: 2056
Re: $ifThen set X or Y
No, the "$if set" only works on a single compile time variable name, not an expression. You can work around this by having a parallel set of numerical compile time variables and then use $ifThenE: $set xset 0 $if set x $set xset 1 $set yset 0 $if set y $set yset 1 $log %xset%%yset% $ifThen...