An Eample (based on the Phllps artcle) Suppose ou re the hapless MBA, and ou haven t been fred You decde to use IP to fnd the best N-product soluton, for N = to 56 Let be 0 f ou don t produce product, f ou do Let M be the mamum of product ou could produce M = N for all Suppose there s a mnmum producton quantt L for each product ou opt to produce. What constrants mplement that? OR 54 Fall 009 Lesson 0-, p.
Prce Breaks/Quantt Dscounts A tpcal stuaton: The frst N tems cost $D apece The net N tems cost, sa $0.8D apece The net N tems cost, sa, $0.6D apece Wth no constrants, an optmzaton wll tr to bu the cheapest ones frst So, how do we mplement these condtons? Let,, be the number bought at each prce Let, be bnar N N, * N, N N * OR 54 Fall 009 Lesson 0-, p.
A Slghtl Dfferent Scheme Suppose nstead the prce break s as follows: Bu up to N tems: cost $D apece Bu up to N tems: cost, sa $0.8D apece Bu up to N tems: cost, sa, $0.6D apece Ths defnes a cost curve for the tems Let,, be the number bought OR 54 Fall 009 Lesson 0-, p. Let,, be the number bought Let,, be bnar; the constrants are: *, * *, * * N N N N N
Modelng Pecewse Lnear Functons Suppose ou have some varable that has a pecewse lnear cost functon: f() V V V U U U Ths appears to be a forbddng thng to model OR 54 Fall 009 Lesson 0-, p. 4
But, We Can Handle It Replace ever occurrence of the varable n the model wth: U U U K U n n Replace ever occurrence of f() wthn the model wth: V V V K V n n Add the constrants K n = 0 for all OR 54 Fall 009 Lesson 0-, p. 5
Handlng the Adjacenc Condton Note that for ths to work: The s gve the weght on the th and st pont (the are NOT bnar!) At most two s can be nonzero, and the must be adjacent Wnston shows how to do ths wth a bunch more constrants (p. 48) That s NOT what we re gong to do Instead, tell our solver that these varables are tpe SOS The solver wll automatcall enforce the adjacenc condton OR 54 Fall 009 Lesson 0-, p. 6
OK, So What s an SOS Varable? SOS stands for specal ordered set There are two general tpes SOS tpe : a set of varables for whch at most ma be nonzero SOS tpe : a set of varables for whch at most ma be nonzero; the two must be adjacent SOS varable processng s a specal procedure nsde the smple algorthm Generall much more effcent to use SOS Warnng: not all solvers mplement SOS varables, nor are the defntons standard! OR 54 Fall 009 Lesson 0-, p. 7
If You re Stuck Wthout SOS Varables The followng set of constrants wll enforce the adjacenc condton: w w w w w OR 54 Fall 009 Lesson 0-, p. 8 { } w w w w w w w n n n n n for all 0, = M
Eample: A Mnng Problem (Wllams, 985) A compan has 4 mnes t can operate for the net 5 ears The can operate at most mnes a ear The pa a earl roalt ever ear a mne s open Once the mne s closed, t s closed permanentl Each mne, f operatng, has a ma producton each ear, and a known ore qualt There are earl targets for overall ore qualt, whch s a weghted average of the qualt of the outputs from the mnes The sellng prce/ton of ore s known What mnes should the compan operate, and when? OR 54 Fall 009 Lesson 0-, p. 9
Eample: A Mnng Problem (Wllams, 985) A compan has 4 mnes t can operate for the net 5 ears The can operate at most mnes a ear The pa a earl roalt ever ear a mne s open Once the mne s closed, t s closed permanentl Each mne, f operatng, has a ma producton each ear, and a known ore qualt There are earl targets for overall ore qualt, whch s a weghted average of the qualt of the outputs from the mnes The sellng prce/ton of ore s known What mnes should the compan operate, and when? OR 54 Fall 009 Lesson 0- p.
Mnng Problem (cont d) Indces = mne {-4} t = ear {-5} Data ROYALTY = earl roalt pad f mne s open PROD = lmt on earl producton n mne QUAL = qualt of mne ore PRICE = sellng prce of blended ore D t = dscount rate n ear t (, 0.9, 0.8, ) RQUAL t = requred qualt of blended ore n ear t Varables? OR 54 Fall 009 Lesson 0- p.
Mne Decsons Each ear, we have to decde whether to keep a mne open, and f so, whether to produce So: o t = f mne s open n ear t, 0 otherwse p t = f mne produces n ear t, 0 otherwse t = amount of ore produced b mne n ear t Objectve ma z = D t * PRICE * t t t D t * ROYALTY * o t OR 54 Fall 009 Lesson 0- p.
Enforcng Openng, Closng, and Producton If a mne s closed, t can t produce: pt ot for all, t Once a mne s closed, t stas closed: o t o for all, t <, t < 5 Lmt producton of open mnes: p t PROD for all t * p t t for all, t OR 54 Fall 009 Lesson 0- p. 4
Fnall, the Qualt Requrements Blendng constrants: Lnearze: QUAL t * t = RQUAL t for all t QUAL * t = RQUALt * t for all t Nonnegatvt and bnar varable constrants: o t t, 0 for all, t p t {0,} for all, t OR 54 Fall 009 Lesson 0- p. 5
Covers, Parttons, Packs These are ver common tpes of IP s General descrpton of a cover: Have some set of objects S = {,,, N} Also have a collecton of subsets of S, e.g., s = {,} s = {,,5} s = {,6} Each subset has a cost assocated wth t (C ) Objectve s to cover S wth some collecton of the subsets at mnmum cost Each element of S must be n one or more of the chosen subsets Want to choose the mnmum-cost collecton of subsets OR 54 Fall 009 Lesson 0- p. 6
Wnston E. 5, p. 486-487 c c c c c c z mn 4 6 6 6 5 5 4 4 = OR 54 Fall 009 Lesson 0- p. 7 {0,} for all 6 5 6 5 4 5 4 = subset; each constrant s an object
General Form The standard cover problem s: mn z = subject to Data: A j * C * for all j { 0,} for all A j = f subset covers object j, 0 otherwse OR 54 Fall 009 Lesson 0- p. 8
Parttons, Packs Partton: each object can onl be covered b subset mn z = subject to A * C * {0,}for all j = for all j Pack: each subset has value V, and we want to mamze the value of the subsets packed n: ma z = subject to A * V * {0,}for all j for all j OR 54 Fall 009 Lesson 0- p. 9
Pack Eample (Wnston p. 555, # Indces d = dstrcts { -8} Data POP d = populaton of dstrct d n 000 s A d,d = f ambulance n d can respond to d n tme Varables, Objectve and Constrants d = f ambulance assgned to d, 0 otherwse ma z = subject to A * d d d d, d ' d = d, d ' d A d, d ' * POP d for all d' {0,} for all d * d OR 54 Fall 009 Lesson 0- p. 0
Another Pack Eample (from Schrage) A fnancal frm wants to package a set of mortgages The want to mamze the number of packages Each package must be worth at least $M Mortgage values: A B C D E F G H I Value (000's) 90 870 80 640 550 50 0 95 55 There are 70 packages that are worth more than $M that contan 4 or less mortgages So: Let = package #, j = mortgage A j = f mortgage j s n package, 0 otherwse OR 54 Fall 009 Lesson 0- p.
Mortgage Packng (cont d) The problem s then: ma z = subject to A j * for all {0,}for all j Note that n these tpes of problems, ou usuall have to generate the subsets OR 54 Fall 009 Lesson 0- p.
MPL Code for Mortgage Packng The followng MPL code does the mortgage packng problem, ncludng generatng the subsets INDEX dummes m := (A,B,C,D,E,F,G,H,I,D,D); m := m; m := m; m := m; Alases of m m4 := m; DATA V[m] := (90,870,80,640,550,50,0,95,55,0,0); V[m] := (90,870,80,640,550,50,0,95,55,0,0); V[m] := (90,870,80,640,550,50,0,95,55,0,0); V4[m4] := (90,870,80,640,550,50,0,95,55,0,0); BINARY VARIABLES [m,m,m,m4] WHERE ( (m<m) and (m<m) and (m<m4) and (V[m]V[m]V[m]V4[m4] >= 000) ); OR 54 Fall 009 Lesson 0- p.
MPL Code (cont d) MODEL ma npack = sum(m,m,m,m4: [m,m,m,m4]); SUBJECT TO packcon[m] WHERE ( (m <> "D") and (m <> "D") ): sum( m=m,m,m,m4: [m,m,m,m4]) sum( m,m=m,m,m4: [m,m,m,m4]) sum( m,m,m=m,m4: [m,m,m,m4]) sum( m,m,m,m4=m: [m,m,m,m4]) <= ; END OR 54 Fall 009 Lesson 0- p. 4
Natural Integer Solutons When solvng nteger or med-nteger problems, frst look at the LP relaaton Allow nteger varables to be fractonal Allow bnar varables to be fractonal, wth bounds of 0 to If ou solve the LP and get ntegral answers: Qut! Answer s optmal Wh can t t get an better? We know some LP s wll have ntegral solutons If the LP s a network model If the A matr (all constrant coeffcents) s totall unmodular, and the constrant RHS s are nteger But what f the LP relaaton has fractons? OR 54 Fall 009 Lesson 0-, p.
Solvng MIPs va Branch-and-Bound Introduced b Land and Dog (960) Ideas Solve LP relaaton of problem Choose a fractonal varable, sa, wth value * Create two new LP s: ma z = c subject to A b * 0 ma z = c subject to A b * 0 OR 54 Fall 009 Lesson 0-, p.
Branch-and-Bound (cont d) Addng these restrctons and resolvng (va dual smple) s ver quck Leads to a tree of solutons: * Each branch tghtens upper bound Each branch adds a constrant Each branch (hopefull) elmnates a fractonal varable Some ssues: What do ou branch on? How do eplore the tree? How do ou know when ou re done? * * * * * OR 54 Fall 009 Lesson 0-, p.
Node Selecton Commercal codes have lots of clever trcks Look at the objectve functon coeffcents/reduced costs of the fractonal varables Look at degree of fractonaton (where.5 s the most fractonal) Branch prortes Suppled b users Tells code whch varables to branch on frst Eample: = buld a factor, n produce products at that factor Whch varable should ou branch on frst? NOTE: MPL doesn t appear to support ths, although CPLEX does OR 54 Fall 009 Lesson 0-, p. 4
Branch-and-Bound: Probng Commercal codes look at the mplcatons of a branch Suppose we have the followng constrants: 4 OR 54 Fall 009 Lesson 0-, p. 5 Suppose we solve the relaaton, and = 0.5 What happens f we set = 0? What happens f we set =? {0,} for all 5 4
Branch-and-Bound: Tree Traversal Tradeoff here s feasblt versus optmalt Wnston s last-n-frst-out Actuall s depth-frst-search Technque s to dve as deep nto the tree as necessar to get an nteger feasble soluton Idea s to get nteger feasble frst, then search for mprovement Gettng an nteger feasble soluton provdes a lower bound, ma cut off large parts of the tree later See Wnston, fgures 0-7, pp. 5-57 OR 54 Fall 009 Lesson 0-, p. 6
More Traversal If ou alread have a feasble soluton, ou ma want to traverse the tree dfferentl Wnston calls ths jumptrackng Actuall s breadth-frst search Instead of dvng nto the tree, ou solve each node resultng from each branch Regardless of the traversal, note what happens at each node: Problem s ether nfeasble, nteger feasble, or tghtened Frst two cases: node s fathomed and no more search s necessar OR 54 Fall 009 Lesson 0-, p. 7
Branch-and-Bound: Stoppng Crtera Wnston gves the mpresson ou stop when everthng s fathomed Not so - would be deadl for man bg problems To prove nteger optmalt, ou need to fathom ever node Untenable for a bg MIP Need to set an ntegralt gap (usuall 0.0-0.05) For a ma problem, we have an upper bound at an stage of branch and bound An nteger feasble soluton gves a lower bound The ntegralt gap s usuall defned as: gap = upper bound lower lower bound bound OR 54 Fall 009 Lesson 0-, p. 8
Prudence n Solvng a Bg MIP Set an teraton lmt Most solvers let ou lmt the number of teratons Allows ou to avod long, useless runs Set a solve tme lmt (for same reasons as above) Set a loose ntegralt gap to start (sa, 0.0) If ou have an estng soluton: Compare t to the LP relaaton; use t to gve advce on an ntegralt gap Use the objectve functon value as a cutoff parameter; solver won t eplore branches worse than the cutoff Use branch prortes OR 54 Fall 009 Lesson 0-, p. 9