## can't model scheduling problem

Problems with modeling
andcoo
User
Posts: 3
Joined: 8 months ago

### can't model scheduling problem

Hi, I'm trying to create a model that schedules the activities based on the setup time between the activities and that saturates the production capacity (otherwise the solution would not produce)

this is what I would like (but donìt work because i can't do single dimension table)

Code: Select all

``````SET
order/i1*i5/;
PARAMETERS timeproduction(order)/i1 3,i2 4,i3 5,i4 4,i5 6/ ;
SCALAR capacity/10/;
TABLE
costset(order ,order)
i1      i2      i3      i4      i5
i1       1000       2       3       4       5
i2       1       1000       3       4       5
i3       1       3       1000       4       5
i4       1       2       3       1000       4
i5       1       2       3       4       1000;

VARIABLES x(order,order),costset,ccap,costot; INTEGER VARIABLE x;
x.up(ordini,cic) = 1;
equations ob,ob2,ob3;
ob.. costset=e=sum((order,order), costset(order ,order)*x(order,order));
ob2.. ccap=e= (capacity - sum((order), timeproduction(order)*x(order,order))*100; '100 is a cost factor for capacity inutilization
ob3.. costot =e= costset + ccap;
MODEL trasp/all/;OPTIONS mip=cplex,optcr=0.0;
SOLVE trasp USING mip MINIMIZING ttot;

``````
obviously the code don't work, but I hope you can understand what I would like to do

sorry for the great amount of concettual errors, but I know little gams and coding in general

andcoo
User
Posts: 3
Joined: 8 months ago

### Re: can't model scheduling problem

Code: Select all

``````Set i "plant locations" / palmasola, pto-suarez, potosi, baranquill, cartagena /;
Alias(i,ip);

Table tran(i,i) "transport cost for interplant shipments (us\$ per ton)"
palmasola    pto-suarez     potosi  baranquill
pto-suarez       87.22
potosi           31.25         55.97
baranquill       89.80        114.56      70.68
cartagena        89.80        114.56      70.68        5.00
;
Parameter mui(i,ip) "transport cost: interplant shipments (us\$ per ton)";
mui(i,ip) = (tran(i,ip) + tran(ip,i));``````
this example can be a solution for the table problem

Renger
Posts: 273
Joined: 2 years ago

### Re: can't model scheduling problem

Hi
You have lots of errors in your code, so I would suggest that you have a closer look at the introductory chapter of the GAMS documentation.
Gams always usually gives you a clear message on what went wrong. Debugging in Gams starts with correcting the first error that appears and rerun the code again (further errors might be caused by the first one).

Here is your code that runs without errors. If it solves the problem you would like to solve is something you have to see yourself.

Code: Select all

``````SET
order/i1*i5/;
PARAMETERS timeproduction(order)/i1 3,i2 4,i3 5,i4 4,i5 6/ ;
SCALAR capacity/10/;
TABLE
costset(order ,order)
i1      i2      i3      i4      i5
i1          1000       2       3       4       5
i2             1    1000       3       4       5
i3             1       3    1000       4       5
i4             1       2       3    1000       4
i5             1       2       3       4    1000;

alias(order, aorder);
VARIABLES x(order,order),costset1,ccap,costot; INTEGER VARIABLE x;
x.up(order,aorder) = 1;
equations ob,ob2,ob3;
ob.. costset1=e=sum((order,aorder), costset(order ,aorder)*x(order,aorder));
ob2.. ccap=e= (capacity - sum((order), timeproduction(order)*x(order,order)))*100;
* 100 is a cost factor for capacity inutilization
ob3.. costot =e= costset1 + ccap;
MODEL trasp/all/;OPTIONS mip=cplex,optcr=0.0;
SOLVE trasp USING mip MINIMIZING costot;
``````

Cheers
Renger

andcoo
User
Posts: 3
Joined: 8 months ago

### Re: can't model scheduling problem

Renger wrote:
8 months ago
Hi
You have lots of errors in your code, so I would suggest that you have a closer look at the introductory chapter of the GAMS documentation.
Gams always usually gives you a clear message on what went wrong. Debugging in Gams starts with correcting the first error that appears and rerun the code again (further errors might be caused by the first one).

Here is your code that runs without errors. If it solves the problem you would like to solve is something you have to see yourself.

Code: Select all

``````SET
order/i1*i5/;
PARAMETERS timeproduction(order)/i1 3,i2 4,i3 5,i4 4,i5 6/ ;
SCALAR capacity/10/;
TABLE
costset(order ,order)
i1      i2      i3      i4      i5
i1          1000       2       3       4       5
i2             1    1000       3       4       5
i3             1       3    1000       4       5
i4             1       2       3    1000       4
i5             1       2       3       4    1000;

alias(order, aorder);
VARIABLES x(order,order),costset1,ccap,costot; INTEGER VARIABLE x;
x.up(order,aorder) = 1;
equations ob,ob2,ob3;
ob.. costset1=e=sum((order,aorder), costset(order ,aorder)*x(order,aorder));
ob2.. ccap=e= (capacity - sum((order), timeproduction(order)*x(order,order)))*100;
* 100 is a cost factor for capacity inutilization
ob3.. costot =e= costset1 + ccap;
MODEL trasp/all/;OPTIONS mip=cplex,optcr=0.0;
SOLVE trasp USING mip MINIMIZING costot;
``````

Cheers
Renger
Thanks a lot!!!