## Search found 602 matches

2 days ago
Forum: Modeling
Topic: Lower bounds for objective variable (mimization problem)
Replies: 2
Views: 78

### Re: Lower bounds for objective variable (mimization problem)

By adding bounds on the objective variable y (with y =e= f(x)) you turn your objective function f(x) into a true constraint and your objective consists of just min or max y instead of min or max f(x). This is mathematically the same, but in practice makes a big difference. The presolver (especially ...
1 week ago
Forum: Syntax
Topic: Trigonometric functions
Replies: 3
Views: 132

### Re: Trigonometric functions

The trigx model has been added when GAMS added LGO. This is a highly non-convex model and hence a local solver like Conopt will produce local minima and will report "locally" infeasible when started from not so good starting points. So this is all expected behavior.

-Michael
1 week ago
Forum: Modeling
Topic: Create an shifting index gap
Replies: 2
Views: 177

### Re: Create an shifting index gap

My colleague Alex Meeraus had an even better suggestion: set h / 1*8760 /, hh(h) / 1*4 /; variable g(h); equation e(h); e(h)\$mod(ord(h),2).. sum(hh, g(h+hh.off)) =e= 0; He also pointed out that one as a modeler always has to think about the boundaries of the set. So what should happen for the last e...
1 week ago
Forum: Syntax
Topic: Trigonometric functions
Replies: 3
Views: 132

### Re: Trigonometric functions

Javier, you are looking at the equation listing (https://www.gams.com/latest/docs/UG_GAM ... ionListing) section of the listing file. This indeed evaluates and displays the gradient of a variable in the equation at the input point.

-Michael
1 week ago
Forum: Syntax
Topic: Concatenate in GAMS
Replies: 2
Views: 187

### Re: Concatenate in GAMS

Rather than looking at spreadsheet logic (vlookup) relational algebra like SQL from databases will give you a better understanding of how GAMS looks at data: * Declaration with artificial data set SiteIndexS /s1*s10/,SiteIndexP /p1*p10/, SiteINdexB /b1*b10/, Rot_Perc /r1*r10/, Ages /a1*a10/, Items /...
1 week ago
Forum: Modeling
Topic: Create an shifting index gap
Replies: 2
Views: 177

### Re: Create an shifting index gap

Code: Select all

``````set h / 1*8760 /, gh(h,h);
scalar i;
for (i=0 to 3,
gh(h,h+i)\$mod(ord(h),2)= yes;
)

alias (h,hh);
variable g(h);
equation e(h);
e(h)\$mod(ord(h),2).. sum(gh(h,hh), g(hh)) =e= 0;
``````
-Michael
2 weeks ago
Forum: Syntax
Topic: Refer to Special element of a set
Replies: 2
Views: 166

### Re: Refer to Special element of a set

First make sure you get the order of i you expect by "display i"; Then you can get the first and last element like this

Code: Select all

``````set iFirst(i), iLast(i);
iFirst(i) = i.first;
iLast(i) = i.last;
display i,iFirst,iLast;
``````
-Michael
2 weeks ago
Forum: API
Topic: Exporting data from MATLAB to GAMS
Replies: 5
Views: 195

### Re: Exporting data from MATLAB to GAMS

Since you unload ps first the label order is fixed to 1,2,3,4... and hence the order in i (1;9;6;15) has no consequence to the order in the GDX file not in GAMS. So my second "solution" won't work (and you seem to work with an old GAMS system that does not have this capability anyway). You would hav...
2 weeks ago
Forum: API
Topic: Exporting data from MATLAB to GAMS
Replies: 5
Views: 195

### Re: Exporting data from MATLAB to GAMS

There are different ways to deal with this ordering issue: 1) Have a two dimensional set instead of a one dimensional set to preserve the order: set i / 1*100/; alias (i,j); set order(i,j) / 1.10,2.5,3.2,4.9/; * iterate through i in user order: loop(order(i,j), put_utility 'log' / j.tl); 2) Rely on ...
3 weeks ago
Forum: Announcements
Topic: GAMS Distribution 35.2.0 (Minor Release)
Replies: 0
Views: 73

### GAMS Distribution 35.2.0 (Minor Release)

Hi GAMS Users,

We started distributing GAMS Minor Release 35.2.0 on June 2, 2021.