HW2 Ashutosh Gangrade 1 of 6
Problem# 1:
Minimize Tradeo : 1000*wt * Total_Cost + (1-wt) * Total_Cals;
A) let wt := 0.0;
In case when wt=0.0 , Tradeo = Total_Cals which means , when
wt=0 ,Solver will minimize Total_Cals.
B) let wt := 1.0;
In case when wt=1.0 , Tradeo = 1000 * Total_Cost which means , when wt = 1 , Solver will
minimize Total_Cost.
C)
wt cost Calories
0.0 $17.16 2500
0.3 $15.76 3060
0.5 $15.76 3060
0.7 $15.31 3635
1.0 $15.20 3950
D)
Cost vs Calories plot
4000
3000
Calories
2000
1000
0
15.20 15.31 15.76 15.76 17.16
Cost
ff
ff
ff
HW2 Ashutosh Gangrade 2 of 6
E) In current problem , I think this is the most e cient solution because of the way tradeo is
de ned, Either we can minimize Total Cost or Calories but we can’t minimize both.
In other words, Increasing Total cost , It trades o to lowering calories or vice versa.
Problem# 2:
A)
From Problem verbiage:
SaSu, SuMo, MoTu, TuWe, WeTh, ThFr, FrSa are employee schedule Plans
And Since restaurant opens 7 days a week, which means everyday employees are needed
based on the need for each speci c day.
From Problem :sched[d,p] =1 , which means employee who follows plan ‘p’ should be counted
as part of total head count of restaurant on a speci c day ‘d’.
sched is the table which relates employee schedule plan and day of work.
From table , sched[SaSu , Mon] =1, which means an employee who follows workplace SaSu
will be present in restaurant on Monday.
Also, sched[SaSu , Sat] = 0 , mean same employee mentioned above will not be available to
work on Saturday.
Suppose XSaSu, XSuMo, XMoTu, XTuWe, XWeTh, XThFr, XFrSa are number of employees
following each plan.
For Monday, Employees Needed is : 1* XSaSu + 0* XSuMo + 0 * XMoTu + 1* XTuWe + 1*
XWeTh + 1 * XThFr + 1* XFrSa
To make it more generic for each day ,
LHS (Left Hand Side) of the equation be , Index through each day then
Sum of employees follow Plan on that speci c day schedule should be counts as available
head count for that day and
that day’s minimum need in RHS (Right Hand Side) of the linear equation.
B)
ampl: reset;
ampl: model "sched1.mod";
ampl: data "sched1.dat";
ampl: solve
ampl? ;
MINOS 5.51: optimal solution found.
2 iterations, objective 22.33333333
ampl: display Work;
Work [*] :=
SaSu 3.33333
SuMo 5
MoTu 1.33333
fi
fi
fi
ffi
ff
fi
ff
HW2 Ashutosh Gangrade 3 of 6
TuWe 5.33333
WeTh 0
ThFr 7.33333
FrSa 0
;
After running above code in AMPL, Found the output in fractions as follows :
Number of employees whose schedule is from:
Monday to Friday (SaSu) : 3.3333
Tuesday to Saturday (SuMo) : 5
Wednesday to Sunday (MoTu) : 1.33333
Thursday to Monday (TuWe) : 5.33333
Friday to Tuesday (WeTh) : 0
Saturday to Wednesday (ThFr) : 7.33333
Sunday to Thursday (FrSa) : 0
An observation: There is no employee who follows schedule Friday to Tuesday and Sunday to
Thursday.
C)
ampl: model "/Users/rupalitandel/Desktop/UoM/AMPL/sched1.mod";
ampl: data "/Users/rupalitandel/Desktop/UoM/AMPL/sched1.dat";
ampl: solve;
CPLEX 20.1.0.0: optimal solution; objective 22.33333333
5 dual simplex iterations (0 in phase I)
ampl: let {i in PLANS} Work[i] := ceil (Work[i]);
ampl: display Work;
Work [*] :=
SaSu 4
SuMo 5
MoTu 2
TuWe 6
WeTh 0
ThFr 8
FrSa 0
;
ampl: display sum {i in PLANS} Work[i];
sum{i in PLANS} Work[i] = 25
Observation:
Without roundoff , total manpower counts coming up as : 22.3333
After applying “ceil” , total manpower counts coming up as : 25
HW2 Ashutosh Gangrade 4 of 6
D)
ampl: model "sched2.mod";
ampl: data "sched1.dat";
ampl: solve;
MINOS 5.51: ignoring integrality of 7 variables
MINOS 5.51: optimal solution found.
2 iterations, objective 22.33333333
ampl: option solver cplex;
ampl: solve;
CPLEX 20.1.0.0: optimal integer solution; objective 23
5 MIP simplex iterations
0 branch-and-bound nodes
ampl: display Work;
Work [*] :=
SaSu 3
SuMo 4
MoTu 2
TuWe 6
WeTh 0
ThFr 8
FrSa 0
;
ampl: display sum {i in PLANS} Work[i];
sum{i in PLANS} Work[i] = 23
Observation:
While comparing section C and section D, total number of
employees are coming up 21 and 23 respectively.
In rounding solution , it is rounding to nearest integer.
While using culex solver, solver did best judgement and came up
with optimal solution, It didn’t come out same as rounding
solution.
E)
ampl: display need, MeetNeed.body;
: need MeetNeed.body :=
Mon 16 17
Tue 11 15
Wed 17 17
Thu 13 15
Fri 15 15
HW2 Ashutosh Gangrade 5 of 6
Sat 19 20
Sun 14 16;
Observation:
On Monday , Tuesday , Thursday , Saturday and Sunday number of
employees working more than needed by 1 , 4 , 2 , 1 and 2
respectively.
F)
“MeetNeed constraint to be =“
ampl: model "sched2.mod";
ampl: data "sched1.dat";
ampl: option solver cplex;
ampl: solve;
CPLEX 20.1.0.0: integer infeasible.
0 MIP simplex iterations
0 branch-and-bound nodes
No basis.
ampl: display need, MeetNeed.body;
: need MeetNeed.body :=
Mon 16 0
Tue 11 0
Wed 17 0
Thu 13 0
Fri 15 0
Sat 19 0
Sun 14 0
;
Observation:
By Applying below condition:
subj to MeetNeed {d in DAYS}:
sum {p in PLANS} sched[d,p] * Work[p] = need[d];
Actual working employee came to 0 for each day of the week.
With exact need or equality, solution is bringing 0 as employee
need for all days.
G)
Considering the PLANS , For Ex:According to PLAN “SaSu” , A
employee who follows this plan will work on Monday , Tuesday ,
Wednesday , Thursday & Friday.
Which means 1 employee is counted 5 times while considering all
the schedules.
HW2 Ashutosh Gangrade 6 of 6
If we divide total number of employees needed each day by 5, it
will give you minimum number of employee needed overall.
****************
ampl: display ceil(sum {d in DAYS} need[d] / 5);
ceil(sum{d in DAYS} need[d]/5) = 21
****************
Total number of employees need in Solution (d) = 23
Lower bound of employee needed = 21.
Difference = 23-21 = 2.
H)
ampl: model "sched2.mod";
ampl: data "sched2.dat";
ampl: solve;
CPLEX 20.1.0.0: optimal integer solution; objective 21
9 MIP simplex iterations
0 branch-and-bound nodes
ampl: display sum {i in PLANS} Work[i];
sum{i in PLANS} Work[i] = 21
Minimum Employees needed in Solution (D) is 23 and Need in
Solution (H) is 21.
Resulting solution in (H) differs (D) by 2.