Hi Poncho

Here is the corrected code. Have a good look at the changes and compare them to your code, so you can see what went wrong.

For the equations, my corrections might not what you intend to do, but it gives you at least an idea how to proceed.

Renger

set

i product /1,2,3,4/

j oven /1,2/;

Parameter

mp (i) raw material

/1 2, 2 3, 3 3, 4 2/,

nop (i) labor

/1 2, 2 4, 3 3, 4 2/

utilidad (i) utility

/1 400, 2 600, 3 500, 4 550/,

pr (i) min production needed

/1 10, 2 15, 3 12, 4 10/,

CR(j) rental cost of the ovens

/1 2000, 2 2500/;

Table tiempo (i,j) time required in the oven

1 2

1 10 8

2 20 25

3 15 12

4 15 12;

Positive Variable x(i,j);

Binary Variable y(j);

Free Variable z;

Equations

fo

manodeobra labor work

materiaprima raw material

horno(j) max time in each oven

produccion(i,j) production needed

decision(i,j);

*decision of which oven I am going to use

alias(j,jj);

fo… z=e=sum((i,j),utilidad(i)*x(i,j))-sum(j,y(j)*CR(j));

manodeobra… sum((i,j),nop(i)*x(i,j))=l=160;

materiaprima… sum((i,j),mp(i)*x(i,j))=l=400;

horno(j)…sum(i,tiempo(i,j)*x(i,j))=l=3600;

produccion(i,j)… x(i,j)=g=pr(i);

decision(i,j)… sum(jj,x(i,jj))=l=10000*y(j);

Model prob2 /all/

Solve prob2 max z using MIP;

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Poncho Faure

Sent: Dienstag, 21. April 2015 18:38

To: gamsworld@googlegroups.com

Subject: Help with my code “Set is under control already”

Hi, I am a new user of GAMS and for my homework they asked me to solve this problem. I type my code, as I think it was correct, but when I run it, it marks me couple of errors, so if you can help me that will be great. Thank you

Here is my code:

set

i product /1,2,3,4/

j oven /1,2/

Parameter

mp (i) raw material

/1 2, 2 3, 3 3, 4 2/

no (i) labor

/1 2, 2 4, 3 3, 4 2/

utilidad (i) utility

/1 400, 2 600, 3 500, 4 550/

pr (i) min production needed

/1 10, 2 15, 3 12, 4 10/

CR(j) rental cost of the ovens

/1 2000, 2 2500/;

Table tiempo (i,j) time required in the oven

1 2

1 10 8

2 20 25

3 15 12

4 15 12;

Positive Variable x(i,j);

Binary Variable y(j);

Free Variable z;

Equations

fo

manodeobra labor work

materiaprima raw material

horno(j) max time in each oven

produccion(i) production needed

decision(i); decision of which oven I am going to use

fo… z=e=sum((i,j),utilidad(i)*x(i,j)-sum(j,y(j)*CR(j));

manodeobra… sum((i,j),mo(i)*x(i,j))=l=160;

materiaprima… sum((i,j),mp(i)*x(i,j))=l=400;

horno(j)…sum(i,tiempo(i,j)*x(i,j))=l=3600;

produccion(i)… x(i,j)=g=pr(i);

decision(i)… sum(j,x(i,j))=l=10000*y(j);

Model prob2 /all/

## Solve prob2 max z using MIP;

\

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.