Search found 47 matches

by dirkse
2 hours ago
Forum: Modeling
Topic: GAMS modeling of an conditional equation
Replies: 1
Views: 26

Re: GAMS modeling of an conditional equation

Hi, You have two strict inequalities there: one comparing parameters, the other comparing variables. The parameters can be compared this way, but not the variables. So you could do something like: set i / blah /; alias (i,j); parameter a(i); variables x(i); equation f(i,j); f(i,j)$[a(i) > a(j)] .. x...
by dirkse
2 weeks ago
Forum: Modeling
Topic: Running GAMS from MATLAB
Replies: 2
Views: 79

Re: Running GAMS from MATLAB

Masoud, I would advise you not to use the gams Mex-function. It's nice when it works, but if there is any error - and the error state is the normal state when you're developing a model or source code anywhere - it doesn't help you find and fix the error. In your example, where should you start looki...
by dirkse
3 weeks ago
Forum: Modeling
Topic: How to change GDX dimension limit?
Replies: 1
Views: 73

Re: How to change GDX dimension limit?

If you want to pass the number of buses as a string, you should not use GDX for that. Instead, just pass the string to gams as an argument. If you have this GAMS source in, say, power.gms: * check that NBUS is set: if not, terminate with error $if not set NBUS $abort 'NBUS must be set' set bi / bus1...
by dirkse
1 month ago
Forum: Tools
Topic: Select an element randomly from a multidimensional set
Replies: 3
Views: 110

Re: Select an element randomly from a multidimensional set

I like Clemens' Python approach. But if that's not your style, you can construct the function you wanted - what you thought ord() would give you - in a parameter, and use that: sets i / i1, i2 / j / j1 * j3 / ij(i,j) / i1.(j1,j2), i2.(j2,j3) / rnd(i,j) ; scalars n, r; parameter pos(i,j) 'position in...
by dirkse
2 months ago
Forum: Solvers
Topic: *** Failure calling solver: CONOPT4 (rc=1). What does it mean?
Replies: 5
Views: 297

Re: *** Failure calling solver: CONOPT4 (rc=1). What does it means?

Yehuda, Precisely speaking, there is really no such thing as buying an updated version. The GAMS licensing model is based primarily on time. For example, new licenses come with 12 months of Maintenance & Support (M&S). During this 12 months (and perhaps a bit longer) you can be assured that your lic...
by dirkse
2 months ago
Forum: Solvers
Topic: Various Answers
Replies: 4
Views: 246

Re: Various Answers

There are several possible explanations for this behavior, for example: 1. Your model could have multiple optimal solutions. Even when using the same software, you cannot expect always the same answers on different machines, because solvers use automatic CPU dispatch to run code optimized for the ch...
by dirkse
2 months ago
Forum: Modeling
Topic: Emp: 2 shared variables in 1 equation
Replies: 2
Views: 190

Re: Emp: 2 shared variables in 1 equation

Yiwan, I looked at your question for a bit of time but there's not enough detail to give a proper response. You don't show any actual GAMS code, so I have to assume a lot. Too much, actually, to give a good reply. If you created a minimal example of working code that illustrates your difficulty you'...
by dirkse
2 months ago
Forum: Tools
Topic: Issue with GDXRRW file
Replies: 1
Views: 723

Re: Issue with GDXRRW file

Have you checked if the XLSX file is open in Excel when you try to read it with gdxxrw? If so, have you tried running this when the file is closed?
by dirkse
2 months ago
Forum: Syntax
Topic: Appending to a parameter
Replies: 2
Views: 1217

Re: Appending to a parameter

David, To solve your problem it's helpful to get a little bit below the surface and note that gdxxrw does not communicate directly with GAMS - instead, it moves data between Excel and a GDX file. There's plenty to say about GDX, but I can't do it better than in the docs: https://www.gams.com/latest/...
by dirkse
3 months ago
Forum: Archive Google Group
Topic: GDXMRW not working at all
Replies: 5
Views: 865

Re: GDXMRW not working at all

You should not use the gams() Mex-function. It works, but if there is any error in your model, or your data, or your connection, it gives very little help or feedback to fix your error. Instead, you should call GAMS via Matlab's system() call. This will allow you to address any failures outside the ...