Search found 21 matches

by Gideon Kruseman
1 month ago
Forum: Syntax
Topic: uncontrolled set
Replies: 1
Views: 85

Re: uncontrolled set

It looks like you are trying to use subsets. You need to define diferencias_1 and diferencias_2 as such

sets
diferencias_1(yearr) / 2013, 2014, 2015 /

diferencias_2(yearr) / 2014, 2015, 2016 /

;
by Gideon Kruseman
1 month ago
Forum: Syntax
Topic: How can I force GAMS to compile this code in its written order?
Replies: 4
Views: 213

Re: How can I force GAMS to compile this code in its written order?

$gdxin is a compile time statement display is an execute time statement trying to link them is bound to give you problems, unless this is the only thing you are doing in the model. The two $gdxin statements basically mean that that the second overrules the first. unless you assign the values of z to...
by Gideon Kruseman
4 months ago
Forum: Syntax
Topic: Loop over strings
Replies: 2
Views: 421

Re: Loop over strings

Won't work like that. The $include is a compile time statement and the loop ( ); is an execute time statement. You can load data before the loop sets i "data sets" j "model set" ; parameter data(i,j); parameter modelparameter(j) include alldata.inc loop(i, modelparameter(j)=0; modelparameter(j)=data...
by Gideon Kruseman
6 months ago
Forum: Syntax
Topic: Domain filtering
Replies: 3
Views: 543

Re: Domain filtering

set time /t1*t4/;
set t(time) /t1*t3/;

Variables
A(time)
Equations
Eq1(time)$t(time).. A(time+1)-A(time) =E= 1;
by Gideon Kruseman
6 months ago
Forum: Solvers
Topic: Computational time of model extremely increased
Replies: 9
Views: 1459

Re: Computational time of model extremely increased

$echo mipemphasis 0 > cplex.opt
modelname.optfile = 1;


The first statement writes the cplex options file
the second statement tells gams to use the cplex options file
by Gideon Kruseman
6 months ago
Forum: Syntax
Topic: LOOP
Replies: 2
Views: 713

Re: LOOP

When you reach 20 the calculation is not executed so a(i+1) is equal to zero. which means it is below 20 and the process starts over again. so you will need to build in a switch that tells you, you have reached your threshold level. Something along these lines will work. Cheers, Gideon Set i /0*100/...
by Gideon Kruseman
8 months ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 20
Views: 2206

Re: how to model abs(variable) linearly

Hi Phallylka,
That's why you use the Steve and I described, so your system remains linear.
Best, Gideon
by Gideon Kruseman
10 months ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 20
Views: 2206

Re: how to model abs(variable) linearly

Yanzhiping, Thet way I initially formulated the response to your question is that you have some sort of variable Q that can be either positive or negative. I assumed you wanted to have the absolute value of Q. If this is not the case I misunderstood your question. If thgis is the case, the code I pr...
by Gideon Kruseman
1 year ago
Forum: Syntax
Topic: how to model abs(variable) linearly
Replies: 20
Views: 2206

Re: how to model abs(variable) linearly

Hi Steve,

May I suggest changing equation f into:
f .. sqr(x-cx) + sqr(-y-cy) =L= 1;

This way you y will be negative and it shows better that the abs tricks work

best,

Gideon