example help

hello am new to GAMS ; please could any one give me an example of an optimisation probléme with an objectif fonction and constraints . from the begginning (set…) to the end (solve…) to follow the model pleaaase!! need your help!!!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Here you go!
(just copy/paste in GAMS)

set
c / ble, mais, tomate /
t / int, ext /
p/ hiver, ete/
;
scalar
sau/50/
q_eau/150/
pmo prix horaire de travail salarie /10/
p_terre prix de fermage par hectare par an /800/
p_eau prix eau par millier m3 /60/
;
parameter
dmo(p)/ hiver 1000, ete 1000/;
table bmo(c,t,p)
hiver ete
ble.int 15 10
ble.ext 10 5
tomate.int 10 90
tomate.ext 10 70
mais.int 10 40
mais.ext 10 35
;
table be( c,t)
int ext
ble 2 0
tomate 5 3
mais 6 4
;
table mb(c,t)
ext int
ble 399 426
mais 750 941
tomate 1103 1574
;
variable
z
;
positive variable
x(c,t)
quant_eau
trav(p)
l_terre
;
equations
objectif
terre
travail
eau
;
objectif…sum((c,t),(mb(c,t)x(c,t)))-quant_eaup_eau-l_terre*p_terre-sum(p,trav(p)*pmo)=e=z;
terre…sum((c,t), x(c,t))=l=sau+l_terre;
travail(p) …sum((c,t),bmo(c,t,p)*x(c,t))=l=dmo(p)+ trav(p);
eau…sum((c,t), be(c,t)*x(c,t))=l=q_eau+quant_eau;
model exemple2/all/;
solve exemple2 using lp maximizing z;


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

thank’s a lot, could you give me one more complicated example!!! and could Gams work with excel!!! thank you…


Le vendredi 5 juin 2015 07:26:48 UTC+1, Remili Nour el houda a écrit :

hello am new to GAMS ; please could any one give me an example of an optimisation probléme with an objectif fonction and constraints . from the begginning (set…) to the end (solve…) to follow the model pleaaase!! need your help!!!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi

I have an exercise that could help you

$Set nc 22
Set cities /c1c%nc%/;
Set clients(cities) /c2
c%nc%/ ; //subindices // Sub conjunto
Alias(cities,cities1); // Dos formas diferentes para referirse a los elementos del mismo conjunto.

Parameter DEM[cities];
DEM[‘c1’]=0;
DEM[‘c2’]=1100;
DEM[‘c3’]=700;
DEM[‘c4’]=800;
DEM[‘c5’]=1400;
DEM[‘c6’]=2100;
DEM[‘c7’]=400;
DEM[‘c8’]=800;
DEM[‘c9’]=100;
DEM[‘c10’]=500;
DEM[‘c11’]=600;
DEM[‘c12’]=1200;
DEM[‘c13’]=1300;
DEM[‘c14’]=1300;
DEM[‘c15’]=300;
DEM[‘c16’]=900;
DEM[‘c17’]=2100;
DEM[‘c18’]=1000;
DEM[‘c19’]=900;
DEM[‘c20’]=2500;
DEM[‘c21’]=1800;
DEM[‘c22’]=700;

Parameter px[cities]/
c1 145
c2 151
c3 159
c4 130
c5 128
c6 163
c7 146
c8 161
c9 142
c10 163
c11 148
c12 128
c13 156
c14 129
c15 146
c16 164
c17 141
c18 147
c19 164
c20 129
c21 155
c22 139 /;

Parameter py[cities]/
c1 215
c2 264
c3 261
c4 254
c5 252
c6 247
c7 246
c8 242
c9 239
c10 236
c11 232
c12 231
c13 217
c14 214
c15 208
c16 208
c17 206
c18 193
c19 193
c20 189
c21 185
c22 182/;


parameters DIST[cities,cities1]; // distancia euclidiana
DIST[cities,cities1]= sqrt((px(cities)-px(cities1))(px(cities)-px(cities1))+(py(cities)-py(cities1))(py(cities)-py(cities1))); //llenar valores del parametro

Scalar CAP /6000/ ; // capacidad vehiculo, cste

Binary Variable x[cities,cities1] ;
Variable z,y[cities,cities1],m;

Equations
enterOnce(cities) ,
visits(cities) ,
tours,
flowBalance(cities),
capacityCons1(cities,cities1),
capacityCons2(cities,cities1),
Def_Obj ;

Def_Obj…
z=e= Sum{(cities,cities1)(ord(cities) ne ord(cities1)),DIST[cities,cities1]*x[cities,cities1]} ; EnterOnce(cities)(clients(cities))… Sum{cities1$(ord(cities) ne ord(cities1)),x[cities1,cities]} =e= 1 ;
visits(cities)(clients(cities)).. Sum{cities1(ord(cities) ne ord(cities1)), x[cities,cities1]}-Sum{cities1$(ord(cities) ne ord(cities1)), x[cities1,cities]} =e= 0;
tours… Sum{cities1$(ord(cities1)>1), x[‘c1’,cities1]}=e=m;
flowBalance(cities)(clients(cities)).. Sum{cities1(ord(cities) ne ord(cities1)),y[cities1,cities]}-Sum{cities1$(ord(cities) ne ord(cities1)), y[cities,cities1]} =e= DEM[cities];
capacityCons1(cities,cities1) (ord(cities) ne ord(cities1)).. DEM[cities1]*x[cities,cities1]=l=y[cities,cities1]; capacityCons2(cities,cities1)(ord(cities) ne ord(cities1))… y[cities,cities1]=l=(CAP-DEM[cities])*x[cities,cities1];

*y.up[cities,cities1] = CAP ;
*y.lo[cities,cities1] = DEM[cities1] ;

Model vrp / all / ;
option x:0:0:1;
option y:0:0:1;
Option Optcr=0.000001;
Solve vrp using MIP minimazing z;
Display z.l;
Display x.l;
Display y.l;
Display m.l;

Bye


El viernes, 5 de junio de 2015, 11:11:05 (UTC-5), Remili Nour el houda escribió:

thank’s a lot, could you give me one more complicated example!!! and could Gams work with excel!!! thank you…


Le vendredi 5 juin 2015 07:26:48 UTC+1, Remili Nour el houda a écrit :

hello am new to GAMS ; please could any one give me an example of an optimisation probléme with an objectif fonction and constraints . from the begginning (set…) to the end (solve…) to follow the model pleaaase!! need your help!!!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

thank you so much, it’s really helpfull…

2015-06-11 2:11 GMT+01:00 Joha Sandoval :

Hi

I have an exercise that could help you

$Set nc 22
Set cities /c1c%nc%/;
Set clients(cities) /c2
c%nc%/ ; //subindices // Sub conjunto
Alias(cities,cities1); // Dos formas diferentes para referirse a los elementos del mismo conjunto.

Parameter DEM[cities];
DEM[‘c1’]=0;
DEM[‘c2’]=1100;
DEM[‘c3’]=700;
DEM[‘c4’]=800;
DEM[‘c5’]=1400;
DEM[‘c6’]=2100;
DEM[‘c7’]=400;
DEM[‘c8’]=800;
DEM[‘c9’]=100;
DEM[‘c10’]=500;
DEM[‘c11’]=600;
DEM[‘c12’]=1200;
DEM[‘c13’]=1300;
DEM[‘c14’]=1300;
DEM[‘c15’]=300;
DEM[‘c16’]=900;
DEM[‘c17’]=2100;
DEM[‘c18’]=1000;
DEM[‘c19’]=900;
DEM[‘c20’]=2500;
DEM[‘c21’]=1800;
DEM[‘c22’]=700;

Parameter px[cities]/
c1 145
c2 151
c3 159
c4 130
c5 128
c6 163
c7 146
c8 161
c9 142
c10 163
c11 148
c12 128
c13 156
c14 129
c15 146
c16 164
c17 141
c18 147
c19 164
c20 129
c21 155
c22 139 /;

Parameter py[cities]/
c1 215
c2 264
c3 261
c4 254
c5 252
c6 247
c7 246
c8 242
c9 239
c10 236
c11 232
c12 231
c13 217
c14 214
c15 208
c16 208
c17 206
c18 193
c19 193
c20 189
c21 185
c22 182/;


parameters DIST[cities,cities1]; // distancia euclidiana
DIST[cities,cities1]= sqrt((px(cities)-px(cities1))(px(cities)-px(cities1))+(py(cities)-py(cities1))(py(cities)-py(cities1))); //llenar valores del parametro

Scalar CAP /6000/ ; // capacidad vehiculo, cste

Binary Variable x[cities,cities1] ;
Variable z,y[cities,cities1],m;

Equations
enterOnce(cities) ,
visits(cities) ,
tours,
flowBalance(cities),
capacityCons1(cities,cities1),
capacityCons2(cities,cities1),
Def_Obj ;

Def_Obj…
z=e= Sum{(cities,cities1)(ord(cities) ne ord(cities1)),DIST[cities,cities1]*x[cities,cities1]} ; EnterOnce(cities)(clients(cities))… Sum{cities1$(ord(cities) ne ord(cities1)),x[cities1,cities]} =e= 1 ;
visits(cities)(clients(cities)).. Sum{cities1(ord(cities) ne ord(cities1)), x[cities,cities1]}-Sum{cities1$(ord(cities) ne ord(cities1)), x[cities1,cities]} =e= 0;
tours… Sum{cities1$(ord(cities1)>1), x[‘c1’,cities1]}=e=m;
flowBalance(cities)(clients(cities)).. Sum{cities1(ord(cities) ne ord(cities1)),y[cities1,cities]}-Sum{cities1$(ord(cities) ne ord(cities1)), y[cities,cities1]} =e= DEM[cities];
capacityCons1(cities,cities1) (ord(cities) ne ord(cities1)).. DEM[cities1]*x[cities,cities1]=l=y[cities,cities1]; capacityCons2(cities,cities1)(ord(cities) ne ord(cities1))… y[cities,cities1]=l=(CAP-DEM[cities])*x[cities,cities1];

*y.up[cities,cities1] = CAP ;
*y.lo[cities,cities1] = DEM[cities1] ;

Model vrp / all / ;
option x:0:0:1;
option y:0:0:1;
Option Optcr=0.000001;
Solve vrp using MIP minimazing z;
Display z.l;
Display x.l;
Display y.l;
Display m.l;

Bye


El viernes, 5 de junio de 2015, 11:11:05 (UTC-5), Remili Nour el houda escribió:

thank’s a lot, could you give me one more complicated example!!! and could Gams work with excel!!! thank you…


Le vendredi 5 juin 2015 07:26:48 UTC+1, Remili Nour el houda a écrit :

hello am new to GAMS ; please could any one give me an example of an optimisation probléme with an objectif fonction and constraints . from the begginning (set…) to the end (solve…) to follow the model pleaaase!! need your help!!!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.