1 Chapter 4: Integer and Mixed-Integer Linear Programming Problems 4.1 Introduction to Integer and Mixed-Integer Linear Programming 4.2 Solving Integer and Mixed-Integer Linear Programming Problems Using the OPTMODEL Procedure 4.3 Modeling Using Binary Variables 4.4 Modeling Sudoku as an ILP (Self-Study) 4.5 Mixed-Integer Linear Programming Solver Options (Self-Study)
2 Chapter 4: Integer and Mixed-Integer Linear Programming Problems 4.1 Introduction to Integer and Mixed-Integer Linear Programming 4.2 Solving Integer and Mixed-Integer Linear Programming Problems Using the OPTMODEL Procedure 4.3 Modeling Using Binary Variables 4.4 Modeling Sudoku as an ILP (Self-Study) 4.5 Mixed-Integer Linear Programming Solver Options (Self-Study)
3 Objectives Understand how, conceptually and geometrically, the branch-and-bound method solves integer and mixed-integer linear programming problems. Understand how, geometrically, cutting planes can strengthen the formulation of an integer or mixed- integer linear programming problem. Understand the role and importance of the presolver and cutting planes in solving integer and mixed-integer linear programming problems using the OPTMODEL procedure.
4 Mixed-Integer Linear Programming Problems Each of the linear constraints can be either an inequality or an equation. The bounds can be ±∞, so that x j can be restricted to be non-negative (l j =0 and u j =+∞) or free (l j =-∞ and u j =+∞). S is a non-empty subset of {1,2,…,n}
5 Integer Linear Programming Problems Each of the linear constraints can be either an inequality or an equation. The bounds can be ±∞, so that x j can be restricted to be non-negative (l j =0 and u j =+∞) or free (l j =-∞ and u j =+∞).
6 Two-Dimensional Example The following integer linear programming (ILP) problem has decision variables x and y: maximize6x +5y subject to2x + 3y ≤ 7 2x - y ≤ 2 x ≥ 0, y ≥ 0 x integer, y integer
7 Two-Dimensional Example The following integer linear programming (ILP) problem has decision variables x and y: maximize6x +5y subject to2x + 3y ≤ 7 2x - y ≤ 2 x ≥ 0, y ≥ 0 x integer, y integer The linear constraints and bounds of the ILP determine a feasible region in two dimensions: the feasible region of the linear programming (LP) relaxation. linear constraints and bounds
8 Feasible Region y axis x axis feasible solutions
9 The Branch-and-Bound Method y axis x axis feasible solutions optimal solution to LP relaxation
10 Feasible Region y axis x axis feasible solutions
11 Feasible Region y axis x axis feasible solutions optimal solution to LP relaxation
12 Feasible Region y axis x axis feasible solutions
13 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions
14 Feasible Region: Branch y ≤ 1 y axis x axis feasible solutions
15 Feasible Region: Branch y ≤ 1 y axis x axis feasible solutions optimal solution to LP relaxation
16 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions optimal solution to LP relaxation
17 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions
18 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions optimal solution to LP relaxation
19 Feasible Region y axis x axis feasible solutions
20 The Branch-and-Bound Method y axis x axis feasible solutions optimal solution to LP relaxation
21 Feasible Region y axis x axis feasible solutions
22 Feasible Region y axis x axis feasible solutions optimal solution to LP relaxation
23 Feasible Region y axis x axis feasible solutions
24 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions
25 Feasible Region: Branch y ≤ 1 y axis x axis feasible solutions
26 Feasible Region: Branch y ≤ 1 y axis x axis feasible solutions optimal solution to LP relaxation
27 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions optimal solution to LP relaxation
28 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions
29 Feasible Region: Branch y ≥ 2 y axis x axis feasible solutions optimal solution to LP relaxation
30 The Branch-and-Bound Tree (LP 0): z* = 16 x*=1⅝, y*=1¼ (LP 2): z* = 14⅓ x*=1, y*=1⅔ (LP 3): z* = 11 x*=1, y*=1 (LP 4): z* = 13 x*=½, y*=2 (LP 5): infeasible (LP 6): z* = 11⅔ x*=0, y*=2⅓ (LP 1): infeasible x ≤ 1 x ≥ 2 y ≤ 1 y ≥ 2 x ≥ 1 x ≤ 0
31 How Branch-and-Bound Works If the LP relaxation of a subproblem has an optimal solution that is feasible to the MILP, no branching is required. The branching variable can be any integral variable that has a fractional value in the optimal solution to the LP relaxation. An infeasible subproblem can be pruned. A subproblem whose bound is no better than BestInteger (the objective value of a known feasible solution to the MILP) can be pruned (or fathomed). The MILP is solved as soon as all active subproblems (or active nodes of the branch-and-bound tree) have been solved.
32 Branch-and-Bound Flow Chart Choose a branching variable Update BestInteger Choose an active node Solve LP Infeasible? Integral? Fathom? Create new active nodes yes no yes
33 The OPTMILP Presolver Before solving a mixed-integer linear programming problem, the MILP presolver does the following: identifies and removes redundant constraints and variables substitutes some variables that are defined by equations modifies constraint coefficients to strengthen the formulation of the problem
34 Cutting Planes for ILPs and MILPs Suppose that you solve the LP relaxation of an MILP and find a fractional optimal solution. Cutting planes are inequalities that cut off (are not satisfied by) the optimal solution to the LP relaxation are satisfied by all feasible solutions to the MILP. Cutting planes strengthen the LP relaxation of an MILP and make it easier to solve by the branch-and-bound method.
35 Cutting Planes: Example (ILP) y axis x axis feasible solutions optimal solution to LP relaxation x+2y ≤ 4
36 How Cutting Planes Are Generated Cutting planes can be generated from the following: individual inequalities together with the variable bounds from the MILP the inequalities satisfied by the optimal solution to the LP relaxation of the MILP stronger relaxations involving all of the inequalities from the MILP logical relations between 0–1 variables in the MILP
37 These exercises reinforce the concepts discussed previously. Exercises 1–4
38 Chapter 4: Integer and Mixed-Integer Linear Programming Problems 4.1 Introduction to Integer and Mixed-Integer Linear Programming 4.2 Solving Integer and Mixed-Integer Linear Programming Problems Using the OPTMODEL Procedure 4.3 Modeling Using Binary Variables 4.4 Modeling Sudoku as an ILP (Self-Study) 4.5 Mixed-Integer Linear Programming Solver Options (Self-Study)
39 Objectives Be able to solve integer and mixed-integer linear programming problems using the OPTMODEL procedure. Learn which information is written to the SAS log file during the solution of an integer or mixed-integer programming problem.
40 Declaring Integer Variables in PROC OPTMODEL Variables can be declared to be either integer variables or binary (0–1) variables: var x >= 0 <= 2 integer; var y{Arcs} >= 0 integer; var z{Nodes} binary;
41 Declaring Integer Variables in PROC OPTMODEL Variables can be declared to be either integer variables or binary (0–1) variables: The integrality of a variable can be relaxed using a nonzero, nonmissing value of the.relax suffix: x.relax = 1; y['New York','Paris'].relax = 1; for {k in Nodes} z[k].relax = 1; var x >= 0 <= 2 integer; var y{Arcs} >= 0 integer; var z{Nodes} binary;
42 Termination Criteria for MILPs The MILP solver will usually terminate when the relative objective gap falls below a certain value: BestInteger = BestBound = Active Nodes objective value of the best feasible solution found “best” bound at an active node of the branching tree
43 Termination Criteria for MILPs The MILP solver has other termination criteria that can be set using OPTMILP solver options: Solver OptionDescription ABSOBJGAP=Absolute difference between BestBound and BestInteger values (default 1E-6) CUTOFF=Cut off all nodes with a worse bound MAXNODES=Maximum number of nodes in the tree MAXSOLS=Maximum number of solutions found MAXTIME=Maximum real time (seconds) allowed RELOBJGAP=Relative difference (default 1E-4) TARGET=Target value for BestInteger
44 This demonstration illustrates the solution of an integer linear programming problem using PROC OPTMODEL. Solving the Integer Linear McDonald’s Diet Problem Using PROC OPTMODEL mcdonalds_int.sas
45 MILP Solver Options The MILP solver has a number of options in addition to termination criteria: Solver OptionDescription PRINTFREQ=Frequency of printing node log (default 100 = print to log every 100 nodes) PRIMALINCurrent values input a feasible solution PRESOLVER=Similar to other presolver options HEURISTICS=This level controls both the frequency and number of iterations allowed in searching for feasible solutions
46 Global Cutting Plane Option Cutting planes are added automatically at the root node and subsequent nodes of the tree. The ALLCUTS= option sets the level for all classes of cutting planes, but it can be overwritten by setting cut options for individual families. ALLCUTS=#Description AUTOMATICStrategy determined by solver (default) NONE0Disable cutting plane generation MODERATE1Moderate cut strategy AGGRESSIVE2Aggressive cut strategy
47 These exercises reinforce the concepts discussed previously. Exercises 5–9
48 Chapter 4: Integer and Mixed-Integer Linear Programming Problems 4.1 Introduction to Integer and Mixed-Integer Linear Programming 4.2 Solving Integer and Mixed-Integer Linear Programming Problems Using the OPTMODEL Procedure 4.3 Modeling Using Binary Variables 4.4 Modeling Sudoku as an ILP (Self-Study) 4.5 Mixed-Integer Linear Programming Solver Options (Self-Study)
49 Objectives Learn how to model logical constraints using binary (0-1) variables. Learn how to use binary variables with continuous variables to model fixed costs.
50 Modeling Fixed Costs For a continuous variable x with 0 ≤ x ≤ u, you can use a binary variable z to model a fixed cost. cost = m * x + b if x>0 0 if x=0 x axis cost = m * x+b * z 0 ≤ x ≤ u x ≤ u * z z binary
51 This demonstration illustrates the solution of an mixed-integer linear programming problem with set-up costs in PROC OPTMODEL. Solving the Furniture-Making Problem with Set-Up Costs in PROC OPTMODEL furniture_setup.sas
52 Modeling Logical Constraints In the furniture-making problem with set-up costs, suppose that either bedframes or bookcases can be made, but not both. How can you model this?
53 Modeling Logical Constraints In the furniture-making problem with set-up costs, suppose that either bedframes or bookcases can be made, but not both. How can you model this? z['bedframes'] + z['bookcases'] <= 1;
54 Modeling Logical Constraints In the furniture-making problem with set-up costs, suppose that either bedframes or bookcases can be made, but not both. How can you model this? Other logical constraints can also be modeled using binary variables. z['bedframes'] + z['bookcases'] <= 1;
55 Modeling Logical Constraints In the furniture-making problem with set-up costs, suppose that either bedframes or bookcases can be made, but not both. How can you model this? Other logical constraints can also be modeled using binary variables. For example, what restriction does the following constraint model? z['bedframes'] + z['bookcases'] <= 1; z['chairs'] <= z['desks'];
56 Modeling Logical Constraints Suppose that chairs cannot be made if two (or more) of the other products are made. How can you model this?
57 Modeling Logical Constraints Suppose that chairs cannot be made if two (or more) of the other products are made. How can you model this? 2*z['chairs'] + z['bedframes'] + z['bookcases'] + z['desks'] <= 3;
58 Modeling Logical Constraints Suppose that chairs cannot be made if two (or more) of the other products are made. How can you model this? This can also be modeled using three inequalities: 2*z['chairs'] + z['bedframes'] + z['bookcases'] + z['desks'] <= 3; z['chairs'] + z['bedframes'] + z['bookcases'] <= 2; z['chairs'] + z['bedframes'] + z['desks'] <= 2; z['chairs'] + z['bookcases'] + z['desks'] <= 2;
59 Example: Discount Pricing a Product Mix Recall the organic potting soil product mix: Discount Pricing Strategy: [1] x classic_ new mex packs planting prick-out rec 0-50 cubic yards: full price cubic yards: 10% discount cubic yards: 20% discount
60 Example: Discount Pricing a Product Mix Recall the organic potting soil product mix: Discount Pricing Strategy: [1] x classic_ new mex packs planting prick-out rec 0-50 cubic yards: full price cubic yards: 10% discount cubic yards: 20% discount
61 Example: Discount Pricing a Product Mix Discount Pricing Strategy: 0-50 cubic yards: full price (k=0) cubic yards: 10% discount (k=1) cubic yards: 20% discount (k=2) x[p]= total sold y[p,k]= total sold at 10 * k% discount z[p,k]= indicator for 10 * k% discount How can we link these variables?
62 Example: Discount Pricing a Product Mix Discount Pricing Strategy: 0-50 cubic yards: full price (k=0) cubic yards: 10% discount (k=1) cubic yards: 20% discount (k=2) x[p]= total sold y[p,k]= total sold at 10 * k% discount z[p,k]= indicator for 10 * k% discount z[p,0]+z[p,1]+z[p,2] = 1; y[p,0]+y[p,1]+y[p,2] = x[p]; 0 <= y[p,0] <= 50*z[p,0]; 50*z[p,1] <= y[p,1] <= 100*z[p,1]; 100*z[p,2] <= y[p,2] <= 200*z[p,2];
63 This demonstration illustrates the solution of an mixed-integer linear programming problem with piecewise-linear pricing in PROC OPTMODEL. Solving the Organic Potting Soils Problem with Discount Pricing in PROC OPTMODEL discount.sas
64 Example: Bank Credit Card Offers A bank has three different credit card offers it can make to customers. For each customer, the bank estimates the expected profit and credit loss for each offer. Each credit card will be offered to at least 50 customers, but at most one credit card can be offered to a customer.
65 Example: Bank Credit Card Offers A bank has three different credit card offers it can make to customers. For each customer, the bank estimates the expected profit and credit loss for each offer. Each credit card will be offered to at least 50 customers, but at most one credit card can be offered to a customer. Memo To: Optimization Department From: Credit Department Maximum credit loss: $10,000. No exceptions. No excuses.
66 This class participation exercise formulates and solves an ILP with binary variables. Solving the Bank Credit Card Offer Problem in PROC OPTMODEL credit_offers.sas
67 These exercises reinforce the concepts discussed previously. Exercises 10–14