0

I am modeling a production problem in AMPL with start and end inventories to be zero. Simple 3 products being produced over 4 day span, on a single machine.

however my model keeps having problems with the bigM constraint and no inventory is allocated.Model is infeasible per AMPL presolve. I would really appreciate if someone could point whats wrong or what i should try. Thanks in advance!

HERE IS THE CODE -

param n;
param m;
param M;
param T;
set I := {1..n};
set J := {1..m};

param r {I} integer; #productionrate
param stp {I} integer; #setuptime
param rev {I} integer; #sellingprice
param h {I} integer; #inventorycost
param d {I,J} integer; #demand

var t {I,J} integer >= 0, <=480 default 50;     #production time allocated for product i on day j
var s {I,J} integer >= 0 default 50;        #inventory of product i on day j
var z {I,J} binary default 1;   #setup for product i done on day j or not





#sum of revenue - sum of inventory cost
maximize K: sum {i in I,j in J}(rev[i] * t[i,j] * r[i] * z[i,j]) - sum {i in I,j in J}(h[i] * s[i,j]);





#inventory equation
s.t. c2 {i in I,j in 2..4}: s[i,j] = s[i,j-1] + t[i,j]*r[i] - d[i,j];
s.t. c14 {i in I}: s[i,1] = t[i,1]*r[i] - d[i,1];


#initial and end inventories
s.t. c3 {i in I}: s[i,1] = 0;
s.t. c4 {i in I}: s[i,4] = 0;


#ensuring time allocation only when setup
s.t. c5 {i in I,j in J}: t[i,j] <= M*z[i,j];

#ensuring demand is satisfied
s.t. c6 {i in I,j in 2..4}: s[i,j-1] + t[i,j]*r[i] = d[i,j];
s.t. c11 {i in I}: t[i,1]*r[i] = d[i,1];

#production time constraint
s.t. c7 {j in J}: sum{i in I}(z[i,j]*stp[i]) + sum{i in I}(t[i,j]) <= T;

#other non-negativity constraints
s.t. c12 {i in I,j in J}: s[i,j] >= 0;
#s.t. c13 {i in I,j in J}: t[i,j] >= 0;

end;

HERE IS THE DATA -

param n :=3;
param m :=4;
param T :=480;
param M :=480;
#param o :=2;

param d: 1   2   3   4   :=
      1  400 600 200 800
      2  240 440 100 660
      3  80  120 40  100;

param r:=
      1 5
      2 4 
      3 2;

param stp:=
      1 45
      2 60
      3 100;

param rev:=
      1 50
      2 70
      3 120;

param h:=
      1 2
      2 1
      3 3;

end;

RUN FILE -

#RESET THE AMPL ENVIROMENT
reset;

#LOAD THE MODEL
model 'EDX 15.053 Production problem.mod';

#LOAD THE DATA
data 'EDX 15.053 Production problem.dat';

#DISPLAY THE PROBLEM FORMULATION
expand K;
expand c2;
#expand c3;
expand c4;
expand c5;
expand c6;
expand c7;
expand c11;
#let s[3,3] := 20;

#CHANGE THE SOLVER (optional)
#option solver CBC;
option solver cplex, cplex_options ’presolve 0’;
option show_stats 1;
option send_statuses 0;
#option presolve 0;
#SOLVE
solve;

print {j in 1.._nvars:_var[j].status = "pre"}: _varname[j];

print {i in 1.._ncons:_con[i].status = "pre"}: _conname[i];

display solve_message;

display solve_result_num, solve_result;
#SHOW RESULTS
display t,s,z,K;

end;
  • equation c6 (use better names!) is strange. Together with c2 (use better names!) this means: no inventory allowed. Equation c12 (use better names!) is also strange given that s is a positive variable. What is the purpose of the defaults for the variables? This model needs quite some clean-up. – Erwin Kalvelagen Mar 24 '20 at 15:25
  • You also should look at the capacity constraint. This is named c7. Relax this constraint. Better yet:: make this constraint elastic (your teacher can explain what this is and how to do this) – Erwin Kalvelagen Mar 24 '20 at 16:44

0 Answers0