my name is Leonardo from Italy. I'm a gams beginner. Reading the online doucmentation I have came up with this model I would like to employ to optimize the production planning process of my company. I'm attaching here a sample of the model (

**data has been taken randomly**):

Code: Select all

```
Sets
art "Continuative production" / a1, a2, a3 /
pp "New production" / p1, p2, p3 /
forn "Suppliers" / f1, f2, f3 / ;
Parameters
t1(art) "Cycle times of continuative products" /a1 35,a2 18,a3 63/
q1(art) "Demand of continuative products" /a1 12,a2 17,a3 25/
cap(forn) "Production capacity in hours" /f1 3000, f2 4000,f3 3000/
t2(pp) "Cycle times of new producs " /p1 35,p2 18,p3 63/
q2(pp) "Demand of new products" /p1 28,p2 14,p3 32/
numeropp(forn) "Max new products" /f1 2, f2 3, f3 1/;
Table percorsi(art,forn) "Who can produce continuative products"
f1 f2 f3
a1 1 1 1
a2 1 0 1
a3 1 1 0 ;
Table dati(art,forn) "Already assigned production in pieces"
f1 f2 f3
a1 35 0 0
a2 0 0 0
a3 0 18 0 ;
Scalar M /50000000/;
Variables
x(art,forn) "Quantity of continuative products assigned"
y(pp,forn) "Quantity of new products"
k(pp, forn) "Dummy variable"
z "Output";
Integer Variables x,y;
Binary Variable k;
Equations
macroplan 'Maximize the production batch (expressed in hours) assigned to each supplier'
venduto1(art) 'Assign always all the pieces sold for a continuative product'
venduto2(pp) 'Assign always all the pieces sold for a new product'
capprod(forn) 'Do not exceed production capacity'
attivazione(pp,forn) 'If statement'
vincolo(forn) 'Assign a maximum number of new products';
macroplan .. sum((art,forn), t1(art)*percorsi(art,forn)*x(art,forn)) + sum((pp,forn), t2(pp)*y(pp,forn)) =e= z ;
venduto1(art) .. sum(forn, x(art,forn)) =e= q1(art);
venduto2(pp) .. sum(forn ,y(pp,forn)) =e= q2(pp);
capprod(forn) .. sum(art, t1(art)*[x(art,forn)+dati(art,forn)]) + sum(pp, t2(pp)*y(pp,forn)) =l= cap(forn);
attivazione(pp,forn).. M*k(pp,forn) =g= y(pp,forn);
vincolo(forn) .. sum(pp, k(pp,forn)) =l= numeropp(forn);
Model transport /all/ ;
Solve transport using MIP maximizing z;
display x.l, y.l;
```

1) Sometimes the program reports "Integer Infeasible". Is that because the model is wrongly written or just because a solution really doesn't exist?

2)Is there any way to add a constraint for the minum dimension of batch assigned to each supplier? For example, in the case of new products I would like to set k(pp,forn)*y(pp,forn) =g= 5, but I guess the program doesn't accept that because I can't maximize a variable in function of another dependent variable.

I hope you guys could really help me.

Thank you so much in advance.

All the best