GAMS Error 170 and Erro 148

Hello everyone, I am trying to solve these two errors but I can’t. Can you please help me? thanks.
Btw, here’s the code.

Sets
i ‘materials purchased from outside (raw material, shaft, chest, motor’ /1,2,3,4/
j ‘components produced by the company itself (assembly time)’ /1,2,3/ ;

Parameters
c(i) delivery time /c1 10, c2 7, c3 5, c4 15/
d(j) assembly time /d1 3, d2 4, d3 6/
S(i) stock capacity /S1 100, S2 80, S3 50, S4 30/
M(j) minimum assembly time /M1 2, M2 3, M3 5/
Tmax maximum supply time /Tmax 30/;

Variables
x(i) Quantities to be kept in stock
y(j) Assembly time of the company’s own manufactured components
T Total supply time

Positive Variable x,y;
Free Variable T;

Equations

objective_ objective function value to be minimized
stock_constraints(i) limiting stocks to maximum capacity
assembly_time_constraints(j) assembly time constraints
supply_time_constraint supply time constraints;

objective_… T =e= sum(i, c(i)*x(i)) + sum(j, d(j)*y(j));
stock_constraints(i)… x(i) =l= S(i);
assembly_time_constraints(j)… y(j) =g= M(j);
supply_time_constraint… T =l= Tmax;

Model supply_model /all/;
Solve supply_model using lp minimizing T;

You are defining your set elements of i as / 1, 2, 3, 4 / but when you define parameter c, you don’t use the same elements. My guess is that what you are trying to do is:

Sets
i / c1,c2,c3,c4 /;

Parameters
c(i) / c1 10, c2 7, c3 5, c4 15 /;

You should fix other set and parameter definitions in the same way.

There were a few more syntax errors. You should study the tutorial material of GAMS. You should also use a code section when you provide code. Here is the model that compiles:

Sets
i 'materials purchased from outside (raw material, shaft, chest, motor' /1,2,3,4/
j 'components produced by the company itself (assembly time)' /1,2,3/ ;

Parameters
c(i) delivery time /1 10, 2 7, 3 5, 4 15/
d(j) assembly time /1 3, 2 4, 3 6/
S(i) stock capacity /1 100, 2 80, 3 50, 4 30/
M(j) minimum assembly time /1 2, 2 3, 3 5/
Tmax maximum supply time /30/;

Variables
x(i) Quantities to be kept in stock
y(j) Assembly time of the company’s own manufactured components
T Total supply time

Positive Variable x,y;
Free Variable T;

Equations

objective_ objective function value to be minimized
stock_constraints(i) limiting stocks to maximum capacity
assembly_time_constraints(j) assembly time constraints
supply_time_constraint supply time constraints;

objective_.. T =e= sum(i, c(i)*x(i)) + sum(j, d(j)*y(j));
stock_constraints(i).. x(i) =l= S(i);
assembly_time_constraints(j).. y(j) =g= M(j);
supply_time_constraint.. T =l= Tmax;

Model supply_model /all/;
Solve supply_model using lp minimizing T;

The constraint supply_time_constraint.. T =l= Tmax; makes little sense. You are minimizing T, so you will be below TMax if possible anyway. If it is not (as in your case) the model will be just infeasible.

-Michael