Search found 112 matches

by dirkse
5 months ago
Forum: Modeling
Topic: Generation time takes too long
Replies: 4
Views: 450

Re: Generation time takes too long

Laurus, I notice the model you sent as opt.gms in your post is customized to work with GDXMRW. This works as long as you stay in a Matlab world, but now when you move to a larger forum, it becomes a problem. Potential avenues of help or discussion are closed off because your model is not a generic G...
by dirkse
5 months ago
Forum: Modeling
Topic: Default output for infeasible problems.
Replies: 1
Views: 262

Re: Default output for infeasible problems.

Laurus, GAMS has a robust data-handling capability for just such a need. Something like this will do it: if {(m.modelStat eq 4), result.L = 9999999; }; But the model status can be many things, even for an infeasible model. There are nice compile-time constants to help keep that straight. https://www...
by dirkse
6 months ago
Forum: Syntax
Topic: Decision variables question
Replies: 1
Views: 586

Re: Decision variables question

Dave, From your description, you are looking at X(s,e,p) as a sort of litmus test - it tells you if a condition is true or not, e.g. if student s is scheduled for event e during period p. I typically (always??) look at things the other way around: X(s,e,p) is my decision to schedule student s is sch...
by dirkse
6 months ago
Forum: Tools
Topic: GDX Table structure
Replies: 2
Views: 794

Re: GDX Table structure

Youngghee, There is no difference in the GDX data. You may want to view the same data in different ways, so the GDX viewer allows you to change the view. It also memorizes your previous choice. If you reset the view (i.e. hit the reset button in the viewer) in case-1, it will look like case-2, i.e. ...
by dirkse
6 months ago
Forum: Modeling
Topic: Calculations post solution
Replies: 1
Views: 291

Re: Calculations post solution

Laurus, In general, it is better to compute post-solution the things that merely depend on or derive from the optimal solution. You can see many examples of this in the model library, including in the qmeanvar model. Also the chapter on data manipulations in the Users Guide is very relevant: https:/...
by dirkse
6 months ago
Forum: Modeling
Topic: how to get any element from a two dimensional set
Replies: 4
Views: 467

Re: how to get any element from a two dimensional set

You can compute your ord value yourself with a loop: Set i /1*3/; set j /1*3/; Set a(i,j) /1.2, 2.3, 1.3/; parameter ordOfA(i,j); scalar cnt / 0 /; loop{a(i,j), cnt = cnt + 1; ordOfA(i,j) = cnt; }; display a, ordOfA; Be careful how you use this, though. If you want to do something for the tuples in ...
by dirkse
6 months ago
Forum: Modeling
Topic: MPSGE on a Mac: model not reading in a loop structure
Replies: 2
Views: 323

Re: MPSGE on a Mac: model not reading in a loop structure

Hi, I'm not aware of any issues on the Mac when it comes to running GAMS or to GAMS code that uses a loop. With MPSGE you use the filesystem more than with other GAMS runs, so it can be a headache to move from the case-insensitive Windows environment to something case-sensitive (i.e., anything but W...
by dirkse
7 months ago
Forum: Solvers
Topic: How to define the empinfo file dynamically
Replies: 1
Views: 596

Re: How to define the empinfo file dynamically

Hello, I encourage you and anyone else using EMP to browse EMPLIB (the library of EMP models that comes with GAMS) to pick up some useful information and techniques. Especially if you are stuck or thinking "There must be a better way to do this!?!", browsing can be a good source of fresh ideas. In t...
by dirkse
7 months ago
Forum: Modeling
Topic: Objective function with Knitro
Replies: 2
Views: 328

Re: Objective function with Knitro

Hello,

Why do you consider this to be a problem?

-Steve
by dirkse
7 months ago
Forum: Modeling
Topic: Extract 1 from variables {-1, 0, 1}
Replies: 2
Views: 516

Re: Extract 1 from variables {-1, 0, 1}

You could do some thing like this:

binary variables
switchOn 'turning machine on'
switchOff 'turning machine off'
;
equation switchCon;
switchCon .. switchOn + switchOff =L= 1;

With this, you have the option to do nothing or to switch on or switch off, but not switch on and off.

-Steve