Search found 215 matches

by dirkse
2 years ago
Forum: Solvers
Topic: MOSEK: Problem becomes infeasible when I change the objective function
Replies: 4
Views: 4408

Re: MOSEK: Problem becomes infeasible when I change the objective function

Hello,

If you suspect that there is a bug in GAMS you should contact GAMS support with a minimal reproducible example. Be clear about what you consider wrong, and what you expect instead, and how to reproduce the wrong behavior. Send .log and .lst files illustrating the wrong behavior.

-Steve
by dirkse
2 years ago
Forum: Solvers
Topic: MOSEK: Problem becomes infeasible when I change the objective function
Replies: 4
Views: 4408

Re: MOSEK: Problem becomes infeasible when I change the objective function

Hello, When I solve your models - using MOSEK with GAMS 36.1.0 on my Linux machine - I get an optimal solution for each one. I notice you set bounds on the variable obj_sigma. This is almost surely going to be counterproductive. It is common - and justifiable - to conflate the objective variable spe...
by dirkse
2 years ago
Forum: Syntax
Topic: Equating two sets of variables
Replies: 3
Views: 3702

Re: Equating two sets of variables

Hello, Atharv is spot on when he suggests that a mapping set (and an equation defined via this mapping set) is the way to go here. But his code for computing this mapping set could be more general. Here's an example that works no matter what the set contents are. It uses the .pos attribute of a set ...
by dirkse
2 years ago
Forum: Modeling
Topic: Map set elements to another set
Replies: 2
Views: 2029

Re: Map set elements to another set

Hi, Your subject talks about set elements, but your example mentions parameters, so I'm not sure what you're asking. But perhaps this is what you want: sets aa / blah blahblah /, a(aa) / blah /; parameter pa(a), paa(aa); paa('blah') = 1215; pa(a) = paa(a); Since a is a subset of aa, you can index pa...
by dirkse
2 years ago
Forum: Syntax
Topic: parameter with dynamic dependencies
Replies: 3
Views: 3452

Re: parameter with dynamic dependencies

Pitters, Here's another way you could do this. The use of implicit set definition for my allm set isn't strictly necessary but it's a useful feature - it's a solid way to create a superset of the materials that also include 'ALL'. * use implicit set definition so I only enter materials once sets cty...
by dirkse
2 years ago
Forum: Modeling
Topic: Parameter projection
Replies: 4
Views: 2770

Re: Parameter projection

Indeed, the code

Code: Select all

ve(k) = sum((i, j)$( g(k,i,j) ) , a(i,j)) ; 
and

Code: Select all

ve(k) = sum(g(k,i,j), a(i,j)) ; 
give the identical results and have the same space and time requirements in a running GAMS job. AFAIK they both produce identical internal representations of this statement.

-Steve
by dirkse
2 years ago
Forum: Modeling
Topic: Parameter projection
Replies: 4
Views: 2770

Re: Parameter projection

Hello, I believe night_dog was on the right track. Here's my version of her code, with the crucial change being the one to the definition of the set g. Set i /i1*i3 /; Set j /j1*j3 /; Set k /k1*k9/; Set g(k,i,j) /#k:(#i.#j)/; Table a(i,j) 'original matrix' j1 j2 j3 i1 1 2 3 i2 11 12 13 i3 21 22 23; ...
by dirkse
2 years ago
Forum: Syntax
Topic: How to make GDX files save data "0"
Replies: 1
Views: 2434

Re: How to make GDX files save data "0"

Hello, One of the central ideas in data storage in GAMS and GDX is that data is sparse , i.e. mostly zero, so sparse storage schemes are used to store only the nonzero values. So like most or all of the GDX tools I am aware of, gdxxrw will not store zeros in a GDX file. If you have just a few zeros ...
by dirkse
2 years ago
Forum: Modeling
Topic: Help in writing linear equations based on conditionality in GAMS (9 variables)
Replies: 6
Views: 4308

Re: Help in writing linear equations based on conditionality in GAMS (9 variables)

How about this? * find binary variables y_i, x, such that * x=0 if sum_y <= 1 * x=1 if sum_y > 1 set i / i1 * i8 /; scalar M 'big-M of card(i) is enough' / [card(i)] /; binary variable y(i); binary variable x; equation smallsum '(1-x) should be 1 if ysum is small-ish'; smallsum.. (1-x) * 2 + sum{i, ...