Path: blob/main/Lessons/Lesson 09 - Integer Programming/Lesson_09.ipynb
871 views
Lesson 09: Integer Programming
General Integer Programming
Watch the following video for a general introduction to integer programming.
Key Concepts
Decision variables constrained to integer values
Can produce 5 or 6 cars, but not 5.72 cars
For pure integer programming (IP) problems, solutions can be obtained simply by changing the domain for the LP from NonNegativeReals to PositiveIntegers in the Pyomo coding (as seen in textbook problem 3.4-10 as a Self-Assessment back in Lesson 01)
Computationally, integer programming can be much more difficult than linear programming (this post can help you visualize why this is so)
Binary Integer Programming
Watch the following video for an introduction to binary integer programming.
11/5/2021 - I've just learned that the video gives backward instructions .... it should be that you can only invest in 3 after investing in 4, and can only invest in 1 after investing in 2. With those changes the equations will make sense.
Key Concepts
contain binary (boolean) variables
i.e. 0 for no, 1 for yes
effectively turns off or on each decision variable
Binary variables are considerably easier to deal with than general integer variables, so they generally can be used to solve substantially larger problems
Prototype Problem
Maximize
subject to
and each has to be 0 or 1
Self Assessment: Solving the California Manufacturing BIP
The textbook presents a prototype Binary Integer Programming Problem - the California Manufacturing Problem. (Chapter 12.1, page 476)
The mathematical formulation for this problem is:
Maximize
subject to
and each has to be 0 or 1
Use Pyomo in Python to find the solution to the BIP model for the California Manufacturing Company problem.
Mixed Integer Programming
Watch the following video for an introduction to mixed integer programming.
Key Concepts
some variables are constrained to be integers while other are not
very common approach to many problems
mixed integer programming often uses one of two BigM approaches to enforce constraints
Either-Or Constraints
Fixed Cost
Good Products Example Problem
This is the Good Products example (textbook page 489), similar to the Wyndor problem, in which we have to choose which products to produce and which factories to use. The problem description is reproduced here for convenience. This is an example of a problem that implements the either-or constraint.
Problem Description
The Research and Development Division of the GOOD PRODUCTS COMPANY has developed three possible new products. However, to avoid undue diversification of the company’s product line, management has imposed the following restriction:
Restriction 1: From the three possible new products, at most two should be chosen to be produced.
Each of these products can be produced in either of two plants. For administrative reasons, management has imposed a second restriction in this regard.
Restriction 2: Just one of the two plants should be chosen to be the sole producer of the new products.
The production cost per unit of each product would be essentially the same in the two plants. However, because of differences in their production facilities, the number of hours of production time needed per unit of each product might differ between the two plants. These data are given in the table below, along with other relevant information, including marketing estimates of the number of units of each product that could be sold per week if it is produced. The objective is to choose the products, the plant, and the production rates of the chosen products so as to maximize total profit.
Mathematical Formulation
Maximize
Subject to:
Note that if we are using Plant 1 and if we are using Plant 2.
The complete formulation of this problem is discussed on pages 490-491 of the textbook.
Pyomo Concrete Formulation Solution
Here we'll just use individual variables etc. for maximum transparency. In the homework you'll need to include abstract formulations, but we include a concrete formulation here to help you understand how binary variables work in Pyomo. The next section has the abstract formulation.
Pyomo Abstract Formulation Solution
To make the abstract formulation we add an extra binary variable, , so that we have one for each plant to make the plant constraints have the same format. The math formulation then replaces:
with:
so if we are using Plant 1 and if we are using Plant 2.
Self-Assessment: Integer Programming
True or False: Integer programs are generally more computationally difficult than linear programs with continuous variables.
Self-Assessment: Type of Programming
The problem
Maximize
Subject to:
, , integer
is an example of a(n)
a. nonlinear program.
b. integer program.
c. mixed integer program.
d. none of the above.
Self-Assessment: Rounding Solutions to Integers
Solving an integer programming problem by rounding off answers obtained by solving it as a linear programming problem, we find that
a. The values of the decision variables obtained by rounding are always very close to the optimal values.
b. The true value of the objective function for a maximization problem will likely be less than that found by solving the linear programming problem.
c. The true value of the objective function for a minimization problem will likely be more than that found by solving the linear programming problem.
d. The lower bound reaches zero.
e. None of the above.
Self-Assessment: Either/Or Constraints
True or False: To implement an either/or constraint where one or both of two constraints must be satisfied it is necessary add two binary variables.
Self-Assessment: Number of Solutions in BIP
True or False: There are solutions to consider when there are binary decision variables to be considered in an integer programming problem.