The Solution
Below is our staffing model in its entirety:
MODEL:
SETS:
DAYS: REQUIRED, START;
ENDSETS
DATA:
DAYS = MON TUE WED THU FRI SAT SUN;
REQUIRED = 20 16 13 16 19 14 12;
ENDDATA
MIN = @SUM( DAYS( I): START( I));
@FOR( DAYS( J):
@SUM( DAYS( I) | I #LE# 5:
START( @WRAP( J - I + 1, 7)))
>= REQUIRED( J)
);
END
Model: STAFFDEM
Solving the model, we get the solution report:
Global optimal solution found.
Objective value: 22.00000
Infeasibilities: 0.000000
Total solver iterations: 5
Variable Value Reduced Cost
START( MON) 8.000000 0.000000
START( TUE) 2.000000 0.000000
START( WED) 0.000000 0.000000
START( THU) 6.000000 0.000000
START( FRI) 3.000000 0.000000
START( SAT) 3.000000 0.000000
START( SUN) 0.000000 0.3333333
Row Slack or Surplus Dual Price
1 22.00000 -1.000000
2 0.000000 -0.3333333
3 0.000000 0.000000
4 0.000000 -0.3333333
5 0.000000 0.000000
6 0.000000 -0.3333333
7 0.000000 -0.3333333
8 0.000000 0.000000
Solution to STAFFDEM
The objective value of 22 means we need to hire 22 workers.
We start our workers according to the schedule:
|
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
Sun |
Start |
8 |
2 |
0 |
6 |
3 |
3 |
0 |
If we look at the surpluses on our staffing requirement rows (rows 2 - 7), we see that the slack values are 0 on all of the days. This means there are no more workers than required and we just meet staffing requirements on every day. Even though this is a small model, trying to come up with a solution this efficient "by hand" would be a difficult task.