Mixed Integer Programming Basics (Gurobi)
Mixed integer programming (MIP) is the optimization method used by the Gurobi solver. MIP is used to solve decision making problems across a variety of industries, such a agriculture, transportation, and manufacturing. Here I will use examples from the energy sector, where a common problem involves knowing when to dispatch different types of energy generators (such as combustion turbines, PV arrays, wind turbines, etc.).
To solve MIP problems, we need to consider: (1) the linear objective function (2) constraints
Objective function
Let’s say that we have two generators: G1 and G2. G1 has a capacity of 200 MW and costs $15/MWh to run. G2 has a capacity of 150 MW and costs $25/MWh to run. How much do we run each unit so that we both (1) meet a load of 250 MW and (2) minimize the cost it takes to meet this load?
MIP problems have an objective function that depends on two variables (for example, x1 and x2). Commonly, MIP problems will have an objective function and constraints that are linear. This allows this type of problem to be solved by linear programming.
With these two pieces of information, we can construct a linear objective function as follows:
min (15 * x1 + 25 * x2)
Our objective function helps us solve for values of x1 and x2 that help us optimize for meeting the load while also minimize the cost of running both units.
Constraints
Constraints can be applied to our objective function to model real world situations. Say for example G1 has a capacity of 200 MW, so it can’t be expected to produce no more than 200 MW of output. A constraint that models this can be expressed as:
0 <= x1 <= 200
The Gurobi solver will use a large variety of information about our generators in order to construct objective functions and constraints that create an optimized dispatch solution.
References: Edgar, T. F., Himmelblau, D. M., & Lasdon, L. S. (2001). Chapter 9: Mixed-Integer Programming (2nd ed.). Optimization of Chemical Processes. McGraw-Hill.