Path: blob/main/notebooks/03/11-maintenance-planning.ipynb
663 views
Extra material: Maintenance planning
Problem statement
A process unit is operating over a maintenance planning horizon from to days. On day the unit makes a profit which is known in advance. The unit needs to shut down for maintenance periods during the planning period. Once started, a maintenance period takes days to finish.
Find a maintenance schedule that allows the maximum profit to be produced.
Preamble: Install Pyomo and a solver
The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object SOLVER for later use.
Modeling with disjunctive constraints
The model comprises two sets of the binary variables indexed by the day , with . Binary variables correspond to the operating mode of the process unit, with indicating the unit is operating on day and able to earn a profit . Binary variable indicates the first day of a maintenance period during which the unit is not operating and earning profit.
Objective
The planning objective is to maximize profit realized during the days the plant is operational. This is achieved by maximizing the sum of the products of the profit per day and the binary variable indicating the unit is operating on that day.
Constraints
Number of maintenance periods is equal to P.
Completing maintenance periods requires a total of starts.
Maintenance periods do not overlap.
No more than one maintenance period can start in any consecutive set of days.
This last requirement could be modified if some period of time should occur between maintenance periods.
The unit must shut down for M days following a maintenance start.
The final requirement is a disjunctive constraint that says either or the sum , but not both. Mathematically, this forms a set of constraints reading
where denotes an exclusive OR condition.
Pyomo implementation
Pyomo model
The disjunctive constraints can be represented directly in Pyomo using the Generalized Disjunctive Programming extension. The GDP extension transforms the disjunctive constraints to a mixed integer linear optimization (MILO) problem using convex hull and cutting plane methods.
Ramping constraints
Prior to maintenance shutdown, a large processing unit may take some time to safely ramp down from full production. Furthermore, it also requires more time to safely ramp back up to full production after maintenance. To account for ramp-down and ramp-up periods, we modify the problem formation in the following ways.
The variable denoting unit operation, is changed from a binary variable to a continuous variable denoting the fraction of total capacity at which the unit is operating on day .
Two new variable sequences, and , are introduced which denote the fraction increase or decrease in unit capacity to completed on day .
An additional sequence of equality constraints is introduced relating to and :
We begin the Pyomo model by specifying the constraints, then modifying the Big-M formulation to add the features described above.
Specifying the minimum number of operational days between maintenance periods
Up to this point we have imposed no constraints on the frequency of maintenance periods. Without such constraints, particularly when ramping constraints are imposed, is that maintenance periods will be scheduled back-to-back, which is clearly not a useful result for most situations.
The next revision of the model is to incorporate a requirement that operational days be scheduled between any maintenance periods. This does allow for maintenance to be postponed until the very end of the planning period. The disjunctive constraints read
where the upper bound on the summation is needed to handle the terminal condition.
Paradoxically, this is an example where the Big-M method provides a much faster solution.
The following cell implements both sets of constraints.
Exercises
Rather than specify how many maintenance periods must be accommodated, modify the model so that the process unit can operate no more than days without a maintenance shutdown. (Hint. You may to introduce an additional set of binary variables, to denote the start of an operational period.)
Do a systematic comparison of the Big-M, Convex Hull, and Cutting Plane techniques for implementing the disjunctive constraints. Your comparison should include a measure of complexity (such as the number of decision variables and constraints in the resulting transformed problems), computational effort, and the effect of solver (such as HiGHS vs cbc).