1 Chapter 4: Integer and Mixed-Integer Linear Programming Problems 4.1 Introduction to Integer and...

Post on 03-Jan-2016

283 views 19 download

Tags:

transcript

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 4.1 Introduction to Integer and Mixed-Integer Linear ProgrammingLinear 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 xj can be restricted to be non-negative (lj=0 and uj=+∞) or free (lj=-∞ and uj=+∞).

S is a non-empty subset of {1,2,…,n}

{ , , }

( )

( )

1 1 n n

j j j

j

min | max c x +...+c x

subject to

l x u j =1,2,...,n

x integer j S

Ax b

5

Integer Linear Programming Problems

Each of the linear constraints can be either an inequality or an equation.

The bounds can be ±∞, so that xj can be restricted to be non-negative (lj=0 and uj=+∞) or free (lj=-∞ and uj=+∞).

{ , , }

( )

( )

1 1 n n

j j j

j

min | max c x +...+c x

subject to

l x u j =1,2,...,n

x integer j =1,2,...,n

Ax b

6

Two-Dimensional ExampleThe following integer linear programming (ILP) problem has decision variables x and y:

maximize 6x +5y

subject to 2x + 3y ≤ 7

2x - y ≤ 2

x ≥ 0, y ≥ 0

x integer, y integer

7

Two-Dimensional ExampleThe following integer linear programming (ILP) problem has decision variables x and y:

maximize 6x +5y

subject to 2x + 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

19

Feasible Region

y ax

is

x axis

feasible solutions

20

The Branch-and-Bound Method

y ax

is

x axis

feasible solutions

optimal solution to LP relaxation

21

Feasible Region

y ax

is

x axis

feasible solutions

22

Feasible Region

y ax

is

x axis

feasible solutions

optimal solution to LP relaxation

23

Feasible Region

y ax

is

x axis

feasible solutions

24

Feasible Region: Branch y ≥ 2

y ax

is

x axis

feasible solutions

25

Feasible Region: Branch y ≤ 1

y ax

is

x axis

feasible solutions

26

Feasible Region: Branch y ≤ 1

y ax

is

x axis

feasible solutions

optimal solution to LP relaxation

27

Feasible Region: Branch y ≥ 2

y ax

is

x axis

feasible solutions

optimal solution to LP relaxation

28

Feasible Region: Branch y ≥ 2

y ax

is

x axis

feasible solutions

29

Feasible Region: Branch y ≥ 2

y ax

is

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 ≥ 1x ≤ 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 newactive nodes

yes

nono

no

yes

yes

33

The OPTMILP PresolverBefore 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 MILPsSuppose 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 ax

is

x axis

feasible solutions

optimal solution to LP relaxation

x+2y ≤ 4

36

How Cutting Planes Are GeneratedCutting 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 4.2 Solving Integer and Mixed-Integer Linear Programming Problems Using the OPTMODEL Programming Problems Using the OPTMODEL ProcedureProcedure

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 OPTMODELVariables 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 OPTMODELVariables 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 MILPsThe MILP solver will usually terminate when the relative objective gap falls below a certain value:

BestInteger =

BestBound =

-4-10

| | 10

| | 10

BestInteger BestBound

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 MILPsThe MILP solver has other termination criteria that can be set using OPTMILP solver options:

Solver Option Description

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 OptionsThe MILP solver has a number of options in addition to termination criteria:

Solver Option Description

PRINTFREQ= Frequency of printing node log (default 100 = print to log every 100 nodes)

PRIMALIN Current 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 OptionCutting 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

AUTOMATIC -1 Strategy determined by solver (default)

NONE 0 Disable cutting plane generation

MODERATE 1 Moderate cut strategy

AGGRESSIVE 2 Aggressive 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 Variables4.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 CostsFor 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 ConstraintsIn 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 ConstraintsIn 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 ConstraintsIn 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 ConstraintsIn 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 ConstraintsSuppose that chairs cannot be made if two (or more) of the other products are made. How can you model this?

57

Modeling Logical ConstraintsSuppose 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 ConstraintsSuppose 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 MixRecall the organic potting soil product mix:

Discount Pricing Strategy:

[1] x

classic_1 84.066 new mex 189.970 packs 17.310

planting 45.045 prick-out 116.564 rec5

92.500 0-50 cubic yards: full price 50-100 cubic yards: 10% discount 100-200 cubic yards: 20% discount

60

Example: Discount Pricing a Product MixRecall the organic potting soil product mix:

Discount Pricing Strategy:

[1] x

classic_1 84.066 new mex 189.970 packs 17.310

planting 45.045 prick-out 116.564 rec5

92.500 0-50 cubic yards: full price 50-100 cubic yards: 10% discount 100-200 cubic yards: 20% discount

61

Example: Discount Pricing a Product MixDiscount Pricing Strategy:

0-50 cubic yards: full price (k=0) 50-100 cubic yards: 10% discount (k=1) 100-200 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 MixDiscount Pricing Strategy:

0-50 cubic yards: full price (k=0) 50-100 cubic yards: 10% discount (k=1) 100-200 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 OffersA 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 OffersA 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