# Aggregate Planning

Aggregate planning the long-range planning function that determines the resource levels, e.g. workforce levels, inventory levels, etc., and the production levels required over the planning horizon to meet forecasted demand.

## Contents

This section contains a optimization analysis module, AggregatePlanning(), that optimizes the resource and production levels for a production system and a system simulation module, ProductionSystem, that simulates the expected performance of the aggregate plan output by the optimization model.

## Aggregate Planning Optimization Model

AggregatePlanning formulates and solves a Linear Programming Optimization model using the CPLEX solver to solve an Aggregate Planning problem, specifically (at this time) the workforce planning aspect. The system parameters are set within the AggregatePlanning file.

[Production, Workforce, Overtime] = AggregatePlanning;

Tried aggregator 2 times. MIP Presolve eliminated 0 rows and 1 columns. Aggregator did 2 substitutions. Reduced MIP has 34 rows, 69 columns, and 113 nonzeros. Reduced MIP has 0 binaries, 0 generals, 0 SOSs, and 0 indicators. Presolve time = 0.00 sec. (0.06 ticks) Tried aggregator 1 time. Reduced MIP has 34 rows, 69 columns, and 113 nonzeros. Reduced MIP has 0 binaries, 0 generals, 0 SOSs, and 0 indicators. Presolve time = 0.00 sec. (0.06 ticks) MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: deterministic, using up to 2 threads. Root relaxation solution time = 0.00 sec. (0.08 ticks) Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap * 0 0 integral 0 1292662.8571 1292662.8571 28 0.00% Elapsed time = 0.00 sec. (0.25 ticks, tree = 0.00 MB, solutions = 1) Root node processing (before b&c): Real time = 0.00 sec. (0.25 ticks) Parallel b&c, 2 threads: Real time = 0.00 sec. (0.00 ticks) Sync time (average) = 0.00 sec. Wait time (average) = 0.00 sec. ------------ Total (root+branch&cut) = 0.00 sec. (0.25 ticks) - Solution: ans = Columns 1 through 5 'Period' 'Demand' 'Inventory' 'Workforce' 'Overtime' Columns 6 through 8 'Hiring' 'Firing' 'Production' ans = Columns 1 through 6 'Period1:' [200] '102.8571' '3634.2857' '0' '1114.2857' Columns 7 through 8 '0' '302.8571' ans = Columns 1 through 7 'Period2:' [220] '185.7143' '3634.2857' '0' '0' '0' Column 8 '302.8571' ans = Columns 1 through 7 'Period3:' [230] '258.5714' '3634.2857' '0' '0' '0' Column 8 '302.8571' ans = Columns 1 through 7 'Period4:' [300] '261.4286' '3634.2857' '0' '0' '0' Column 8 '302.8571' ans = Columns 1 through 7 'Period5:' [400] '164.2857' '3634.2857' '0' '0' '0' Column 8 '302.8571' ans = Columns 1 through 7 'Period6:' [450] '17.1429' '3634.2857' '0' '0' '0' Column 8 '302.8571' ans = Columns 1 through 7 'Period7:' [320] '0' '3634.2857' '0' '0' '0' Column 8 '302.8571' ans = 'Period8:' [180] '0' '2160' '0' '0' '1474.2857' '180' ans = 'Period9:' [170] '0' '2040' '0' '0' '120' '170' ans = 'Period10:' [170] '0' '2040' '0' '0' '0' '170' ans = 'Period11:' [160] '10' '2040' '0' '0' '0' '170' ans = 'Period12:' [180] '0' '2040' '0' '0' '0' '170' Cost = 1292662.857143 Profit = 1687337.142857

TO DO: Description of the output

The AggregatePlanning model is a deterministic optimization model, so the next step is to examine the performance of this aggregated and deterministic solution in a simulation system model.

## Deterministic Production System Simulation Model

The ProductionSystem model simulates the performance of the output of the aggregate planning model. Initially, we'll validate the simulation model by running a deterministic version. Then we'll add variable to the production process and examine the performance and robustness of the deterministic solution.

[meanTotalProfit, varTotalProfit, meanServiceLevel, varServiceLevel ] = ProductionSystem(Production, Workforce, Overtime)

meanTotalProfit = 1.6873e+06 varTotalProfit = 1.1413e-20 meanServiceLevel = 1 varServiceLevel = 0

In this example, the profit output from the optimization model matches the meanTotalProfit from the simulation and the meanServiceLevel is 1. This is because the system simulation is deterministic, so the ProductionSystem simulates exactly what the AggregatePlanning optimized.

## Stochastic Production System Simulation Model

The next step is to examine the quality of the aggregate planning solution in a system model with uncertainty. The sources of uncertainty are:

- Proces uncertainty: If b is the total number of labor hours required to produce one unit, then varB is the variance in labor hours required to produce one unit (for a normal distribution). {'varB', '0.1'}
- Resource uncertainty: Availability defines the productivity of the labor, e.g. they may not always be available. Given as a range of availabililty in each period (for a uniform distribution) {'availability', '[0.9,1]'}
- Demand uncertainty: Defines the variability expected for demand in each period, given as a vector of standard deviations of demand in each period. For example, if we assume the standard deviation is 10% of the demand in the period: {'stdevDemand', '0.1*meanDemand'}

[meanTotalProfit, varTotalProfit, meanServiceLevel, varServiceLevel ] = ProductionSystem(Production, Workforce, Overtime, ... {'varB', '0.1'}, {'availability', '[0.9,1]'}, {'stdevDemand','0.1*meanDemand'})

meanTotalProfit = 1.4156e+06 varTotalProfit = 4.5598e+07 meanServiceLevel = 0.9120 varServiceLevel = 7.8305e-05

Compared to the deterministic simulation of the production system, the result is that the mean total profit is lower and the service level is lower as well. This is the result of assuming perfect knowledge and system execution when determining resource levels in the optimization model.

## Incorporating Uncertainty into the Optimization Process

While more complex and detailed methods for stochastic optimization exist and should be covered at a later point, in this section, we'll discuss a practical approach to incorporating uncertainty into the aggregate planning process. This approach inflates the expected demand and reduces the expected productivity of the resources, which buffers out uncertainty in the long run.

[Production, Workforce, Overtime] = AggregatePlanning({'meanDemand', '1.25*meanDemand'}, {'b', '1.25*b'});

Tried aggregator 2 times. MIP Presolve eliminated 0 rows and 1 columns. Aggregator did 2 substitutions. Reduced MIP has 34 rows, 69 columns, and 113 nonzeros. Reduced MIP has 0 binaries, 0 generals, 0 SOSs, and 0 indicators. Presolve time = 0.00 sec. (0.06 ticks) Tried aggregator 1 time. Reduced MIP has 34 rows, 69 columns, and 113 nonzeros. Reduced MIP has 0 binaries, 0 generals, 0 SOSs, and 0 indicators. Presolve time = 0.00 sec. (0.06 ticks) MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: deterministic, using up to 2 threads. Root relaxation solution time = 0.00 sec. (0.08 ticks) Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap * 0 0 integral 0 2037923.2143 2037923.2143 28 0.00% Elapsed time = 0.00 sec. (0.25 ticks, tree = 0.00 MB, solutions = 1) Root node processing (before b&c): Real time = 0.00 sec. (0.25 ticks) Parallel b&c, 2 threads: Real time = 0.00 sec. (0.00 ticks) Sync time (average) = 0.00 sec. Wait time (average) = 0.00 sec. ------------ Total (root+branch&cut) = 0.00 sec. (0.25 ticks) - Solution: ans = Columns 1 through 5 'Period' 'Demand' 'Inventory' 'Workforce' 'Overtime' Columns 6 through 8 'Hiring' 'Firing' 'Production' ans = Columns 1 through 6 'Period1:' [250] '128.5714' '5678.5714' '0' '3158.5714' Columns 7 through 8 '0' '378.5714' ans = Columns 1 through 7 'Period2:' [275] '232.1429' '5678.5714' '0' '0' '0' Column 8 '378.5714' ans = Columns 1 through 7 'Period3:' [287.5000] '323.2143' '5678.5714' '0' '0' '0' Column 8 '378.5714' ans = Columns 1 through 7 'Period4:' [375] '326.7857' '5678.5714' '0' '0' '0' Column 8 '378.5714' ans = Columns 1 through 7 'Period5:' [500] '205.3571' '5678.5714' '0' '0' '0' Column 8 '378.5714' ans = Columns 1 through 7 'Period6:' [562.5000] '21.4286' '5678.5714' '0' '0' '0' Column 8 '378.5714' ans = Columns 1 through 7 'Period7:' [400] '0' '5678.5714' '0' '0' '0' Column 8 '378.5714' ans = 'Period8:' [225] '0' '3375' '0' '0' '2303.5714' '225' ans = Columns 1 through 7 'Period9:' [212.5000] '0' '3187.5' '0' '0' '187.5' Column 8 '212.5' ans = Columns 1 through 7 'Period10:' [212.5000] '0' '3187.5' '0' '0' '0' Column 8 '212.5' ans = 'Period11:' [200] '12.5' '3187.5' '0' '0' '0' '212.5' ans = 'Period12:' [225] '0' '3187.5' '0' '0' '0' '212.5' Cost = 2037923.214286 Profit = 1687076.785714

Then we'll run the recommendations of the aggregate planning process through the system model to see if expected performance is improved.

[meanTotalProfit, varTotalProfit, meanServiceLevel, varServiceLevel ] = ProductionSystem(Production, Workforce, Overtime, ... {'varB', '0.1'}, {'availability', '[0.9,1]'}, {'stdevDemand','0.1*meanDemand'})

meanTotalProfit = 8.8009e+05 varTotalProfit = 8.6652e+08 meanServiceLevel = 1 varServiceLevel = 0

Obviously in this case, we added too much buffer to the aggregate planning process and while the service level is 100%, the total profit is signficantly lower. The process of selecting the optimal amount of buffer is an optimization process itself and left as an exercise or future work

## Conclusions and Future Work

While the aggregate planning process optimizes the resource levels to maximize profit, the resulting solution is not robust in a stochastic system. The lesson here is that this is actually true of most deterministic optimization models. In practice, rules of thumb such as inflated demand or deflated productivity estimates are applied to correct for this lack of robustness and arrive at an implementable recommendation. Future work in this section includes:

- Extending the workforce planning model to incorporate complete Agregate and Production Planning
- Incorporating multi-resource models (multiple resources and inventory)
- Proposing a stochastic optimization approach to replace the inflation factors