I need help with this problem. It is not returning with the answers I need.

Question:
You run a small company providing napkins for hotels. For
each of the next 5 days you know how many napkins you’ll
need: 80, 70, 120, 150, 100, respectively. Each morning
when delivering your napkins, you can pick up the used
ones (what you delivered previous day). If you send those
(or some of those) for a cleaning (for \$a/napkin) than they
can be used as new ones at the next morning delivery. You
can also buy new napkins at \$b/napkin any given day,
before you make the deliveries for that day. You can also
keep clean (new) napkins in your stock for \$c/day/napkin
for following days. Initially you have 100 napkins in stock.
Create a model to find a cost minimal plan (of
next 5 days).
Note that what you buy can be used for delivery
the same day!
Note that you cannot send more to the cleaner
than what you delivered the previous day!
You need to pick it up in the morning from the
hotel (when you deliver the clean ones for the day)
… take it to the cleaner in the afternoon … use it
following morning …

DAT File:

# HW4 data file

#SETS
set days := 1 2 3 4 5;

#PARAMETERS
param Demand := #Demand of napkins per day for 5 days
1 80
2 70
3 120
4 150
5 100;

param a := 5; #param a, cleaning cost
param b := 10; #param b, new napkin cost
param c := 1; #param c, stock cost per day per napkin
param r := 100; #param r, initial napkin stock

MOD File:

# HW4 model file

reset ;

#SETS

set days;

#PARAMETERS

param Demand{days} >=0;

param a;

param b;

param c;

param r;

variables

var X{days} >=0; #Napkins to send for cleaning on day t

var Y{days} >=0; #Number of new napkins to buy on day t

var Z{days} >=0; #Number of napkins to keep in stock on day t

#OBJECTIVE FUNCTION- MINIMIZE TOTAL COST

minimize TotalCost:

sum{d in days}

(a * X[d] + b * Y[d] + c * Z[d]);

#CONSTRAINTS

subject to InitialStock:

Z[1] = r;

subject to CleaningConstraint{d in days}:

if d >=2 then X[d] <= X[d-1];

subject to NapkinBalance{d in days}:

Z[d] = Z[d-1] + Y[d] - Demand[d];

#EXECUTION

data HW4.dat;
option solver cplex;
solve ;

#OUTPUT

display {d in days} X[d];
display {d in days} Y[d];
display {d in days} Z[d];

AMPL’s if-then is an expression, not a constraint. To restrict your CleaningConstraint to d >= 2, put the restriction in the indexing:

``````subject to CleaningConstraint {d in days: d >= 2}:
X[d] <= X[d-1];
``````

Also it looks like NapkinBalance will only work for d >= 2.

Thank you so much, that worked. I really appreciate it!!!