Use the loop function.
Example in the attached file.
Gideon
Search found 24 matches
- 4 years ago
- Forum: Solvers
- Topic: Can someone help me with GAMS Error 148
- Replies: 4
- Views: 7228
- 5 years ago
- Forum: Syntax
- Topic: Reading from CSV Files
- Replies: 4
- Views: 6486
- 5 years ago
- Forum: Syntax
- Topic: Reading from CSV Files
- Replies: 4
- Views: 6486
Re: Reading from CSV Files
reading csv files Spreadsheets and other programs can read and write CSV (comma separated value) files. Therein commas separate fields and text items can be in quotes. GAMS can also include such files using the $ command $Ondelim and $Offdelim. Table Data(*.* $ondelim $include DC03092018.csv $offdel...
- 6 years ago
- Forum: Syntax
- Topic: uncontrolled set
- Replies: 1
- Views: 2191
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 /
;
sets
diferencias_1(yearr) / 2013, 2014, 2015 /
diferencias_2(yearr) / 2014, 2015, 2016 /
;
- 6 years ago
- Forum: Syntax
- Topic: How can I force GAMS to compile this code in its written order?
- Replies: 4
- Views: 4176
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...
- 6 years ago
- Forum: Syntax
- Topic: Loop over strings
- Replies: 2
- Views: 3445
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; mo...
- 6 years ago
- Forum: Syntax
- Topic: Domain filtering
- Replies: 3
- Views: 3909
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;
set t(time) /t1*t3/;
Variables
A(time)
Equations
Eq1(time)$t(time).. A(time+1)-A(time) =E= 1;
- 6 years ago
- Forum: Solvers
- Topic: Computational time of model extremely increased
- Replies: 9
- Views: 9408
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
modelname.optfile = 1;
The first statement writes the cplex options file
the second statement tells gams to use the cplex options file
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/...
- 6 years ago
- Forum: Solvers
- Topic: Computational time of model extremely increased
- Replies: 9
- Views: 9408
Re: Computational time of model extremely increased
same model and same data?