Hi, I’ve been working on this optimization problem and I had some problems compiling it. It has a lot of errors including domain violation, dimension different, “at least one embedded value required”, “illegal data”…
So I was wondering if anyone could help me in this program, as I am just starting studying the language… here it is
Sets
i products /16/
t periods /15/;
Parameters
C(i,t) costprod
S(i,t) costprep
H(i,t) coststock
b(i,t) timeprod
s(i,t) timeprep
CAP(t) limcap
d(i,t) demand
Scalar
M /5000/;
Variables
X(i,t) quantitydeproduced
E(i,t) quatitystocked
Y(i,t) binary
Z;
Positive variables X, E;
Binary variable Y;
Equations
objective
balancoestoque (i,t)
capacidade (t)
garantiaproducao (i,t);
objective… Z =e= sum((i,t), (H(i,t)*E(i,t)+ C(i,t)*X(i,t)+ S(i,t)*Y(i,t)));
balancoestoque(i,t)… E(i,t-1) + X(i,t) - E(i,t) =e= d(i,t);
capacidade(t)… sum(i, (b(i,t)*X(i,t)+s(i,t)Y(i,t))) =l= CAP(t);
garantiaproducao(i,t)… X(i,t) =l= MY(i,t);
Parameters
C(i,t)
/ C(1,1) 1.5
C(1,2) 1.85
C(1,3) 1.6
C(1,4) 1.43
C(1,5) 1.5
C(2,1) 2.2
C(2,2) 1.35
C(2,3) 1.87
C(2,4) 2.2
C(2,5) 1,67
C(3,1) 1.5
C(3,2) 1.69
C(3,3) 1.76
C(3,4) 3,2
C(3,5) 2.5
C(4,1) 3
C(4,2) 4.3
C(4,3) 1.45
C(4,4) 1.5
C(4,5) 1.7
C(5,1) 1.2
C(5,2) 2.1
C(5,3) 2.15
C(5,4) 1.34
C(5,5) 2.45
C(6,1) 2
C(6,2) 2.8
C(6,3) 1.56
C(6,4) 2.5
C(6,5) 1.9 /
S(i,t)
/ S(1,1) 4
S(1,2) 4
S(1,3) 4
S(1,4) 4
S(1,5) 4
S(2,1) 3.5
S(2,2) 3.5
S(2,3) 3.5
S(2,4) 3.5
S(2,5) 3.5
S(3,1) 4.2
S(3,2) 4.2
S(3,3) 4.2
S(3,4) 4.2
S(3,5) 4.2
S(4,1) 3.8
S(4,2) 3.8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2.4
s(6,2) 2.4
s(6,3) 2.4
s(6,4) 2.4
s(6,5) 2.4 /
CAP(t)
/ CAP(1) 1200
CAP(2) 1150
CAP(3) 1250
CAP(4) 1300
CAP(5) 1050 /
d(i,t)
/ d(1,1) 420
d(1,2) 410
d(1,3) 390
d(1,4) 388
d(1,5) 523
d(2,1) 435
d(2,2) 531
d(2,3) 370
d(2,4) 345
d(2,5) 364
d(3,1) 234
d(3,2) 432
d(3,3) 243
d(3,4) 267
d(3,5) 289
d(4,1) 356
d(4,2) 312
d(4,3) 311
d(4,4) 305
d(4,5) 308
d(5,1) 299
d(5,2) 199
d(5,3) 180
d(5,4) 300
d(5,5) 100
d(6,1) 200
d(6,2) 210
d(6,3) 220
d(6,4) 222
d(6,5) 232 /;
Model projetoana /all/;
Solve projetoana using lp minimizing Z;