Search found 464 matches

by bussieck
4 weeks ago
Forum: Modeling
Topic: Defining a SOS1-Variable as binary, where not all Sets must contain a non-Zero Value
Replies: 4
Views: 239

Re: Defining a SOS1-Variable as binary, where not all Sets must contain a non-Zero Value

You could reduce the number of binaries and do SOS1 Variable x(i,l) SOS1-Variable consisting of 10 sets whith 50 elements each; Binary Variable y(i); Equation defx(i), defy; defx(i).. sum(l, x(i,l)) =e= 0 + y(i) ; defy.. sum(i, y(i)) =e= 5; You can even mimic binary variables with SOS1 constraints i...
by bussieck
4 weeks ago
Forum: Modeling
Topic: VAR operands relational or boolean
Replies: 11
Views: 450

Re: VAR operands relational or boolean

I don't think that you logic is correct also you if logic looks flawed, but I guess you mean if(DU(t)-(DIP(t)- DIN(t))-CU(t))>=0, DD(t)=DU(t)-(DIP(t)- DIN(t))-CU(t); else DD(t)=0; ) or easier DD(T) = max(0,DU(t)-(DIP(t)- DIN(t))-CU(t)). I would do it like this: set s /slack1, slack2/; SOS1 variable ...
by bussieck
4 weeks ago
Forum: Syntax
Topic: dollar sign ($) in macro
Replies: 2
Views: 210

Re: dollar sign ($) in macro

Macros are expanded by the GAMS compiler. The expanded text is not scanned for compile time commands (anything that starts with a $, like $call) by the compiler, so you can't have a $ command inside a macro. You will need to use a batinclude for this: $set Filaname xxx $set Path abc/ $set SpecKey $e...
by bussieck
1 month ago
Forum: Announcements
Topic: Webinar: GAMS MIRO Engine - running GAMS in the cloud! Announcement
Replies: 0
Views: 239

Webinar: GAMS MIRO Engine - running GAMS in the cloud! Announcement

I want to let you know about an upcoming webinar next Tuesday (5/5/20).
Please find details at https://www.gams.com/news-events/detail ... the-cloud/

-Michael
by bussieck
1 month ago
Forum: Modeling
Topic: Defining a SOS1-Variable as binary, where not all Sets must contain a non-Zero Value
Replies: 4
Views: 239

Re: Defining a SOS1-Variable as binary, where not all Sets must contain a non-Zero Value

Just turn your x(i,l) into a binary variable and your equality constraint into a less-or-equal: defx(i).. sum(l, x(i,l)) =l= 1 ; That's it. Don't worry about x being binary instead of SOS 1. Most solvers will turn them into binary inside anyway, because nowadays modern MIP solvers prefer to work wit...
by bussieck
1 month ago
Forum: Modeling
Topic: VAR operands relational or boolean
Replies: 11
Views: 450

Re: VAR operands relational or boolean

I did not check your logic, but a few comments: Don't use arbitrary large numbers for bigM. They mess up the numerics of your model. Find out from your understanding of model and data what's the maximum/minimum value a variable can take. If that's not possible, bigM is not possible and you need to g...
by bussieck
1 month ago
Forum: GAMS-FAQ
Topic: How do I export only rounded numbers from GAMS to Excel?
Replies: 1
Views: 152

Re: How do I export only rounded numbers from GAMS to Excel?

There is no explicit option to round numbers when writing to an Excel file, but you can round within GAMS before writing the data to GDX. You could also use cell formatting in Excel to instruct Excel to show you a certain number of digits. The following will round the parameter abc to two decimal pl...
by bussieck
1 month ago
Forum: GAMS-FAQ
Topic: How do I export only rounded numbers from GAMS to Excel?
Replies: 1
Views: 152

How do I export only rounded numbers from GAMS to Excel?

When unloading data from GAMS to Excel with GDX, is it possible to round numbers or choose the number of decimal to be included in the Excel files?
by bussieck
1 month ago
Forum: Modeling
Topic: VAR operands relational or boolean
Replies: 11
Views: 450

Re: VAR operands relational or boolean

You can't model this as an LP. You can model this with some binary variables and make a MIP out of it. You need a binary variable that is 0 if DU(t)-(DIP(t)- DIN(t))-CU(t) <= 0 and 1 otherwise. Search the forum for logical constraint and HP Williams (that is an author of a book that describes such r...
by bussieck
1 month ago
Forum: Modeling
Topic: Error: Endogenous operands for * not allowed in linear models
Replies: 4
Views: 195

Re: Error: Endogenous operands for * not allowed in linear models

Look at r1 and o1. The supply capacity from s1, s2, and s3 is 8+6+0=14. The demand is o1.r1 is 18. No way to make it, so the model is infeasible. How did I get there? Again, I removed the unhelpful and superfluous supplier variables, get an LP and solved with e.g. Cplex, now I get a infeasible solut...