Geheeltallige programmering In een LP probleem zijn alle variabelen reëel. In een geheeltallig probleem blijven doelfunctie en constraints lineair, maar zijn de variabelen geheeltallig. LP: IP: BIP: MIP: continue variabelen (linear programming) discrete (geheeltallige) variabelen (integer progr.) binaire variabelen (binary integer) discrete én continue variabelen (mixed integer) Denk aan aantallen, 0/1 beslissingen. Niet-lineaire voorwaarden kunnen soms lineair worden geformuleerd (bv. als-dan voorwaarden). Geheeltallige problemen zijn veel moeilijker oplosbaar dan continue. Discrete (combinatorische) problemen zijn vaak NP-compleet (geen polynomiaal algoritme). Het aantal oplossingen is vaak eindig, maar eindig kan heel groot zijn! Vb. 64 binaire variabelen: 2 64 = 2x10 19 mogelijkheden!
LP relaxatie: Laat de geheeltalligheideisen weg. Het doelgebied wordt groter, dus de LP relaxatie geeft een bovengrens voor IP. Max Z = x 1 + x 2 Max Z = x 1 + x 2 z.d.d. 3x 1 + x 2 12 z.d.d. 3x 1 + x 2 12 4x 1 + 5x 2 20 4x 1 + 5x 2 20 x 1, x 2 {0,1} Oplossing: Z = 2 Z = 52/11 = 4.7272 x 1 = 1, x 2 = 1 x 1 = 40/11, x 2 = 12/11 Vervang x 1, x 2 {0,1} door 0 x j 1 Max Z = x 1 + x 2 z.d.d. 3x 1 + x 2 12 4x 1 + 5x 2 20 0 x 1 1, 0 x 2 1 Oplossing: Z = 2 x 1 = 1, x 2 = 1 Dit is (toevallig) de optimale oplossing.
Investeringsprobleem 2.2.1 (p. 94) Jaarlijkse investering per project Jaar 1 2 3 4 5 6 7 Beschikbaar 1 40 20 25 80 20 90 50 250 2 10 30 30 40 20 25 10 125 3 25 0 20 30 20 0 0 75 4 25 0 10 0 10 10 30 50 5 10 35 0 15 10 20 0 50 Waarde 250 180 225 300 150 275 200 Variabelen x j = 0/1 als project j niet/wel wordt geselecteerd. Max 250x 1 + 180x 2 + 225x 3 + 300x 4 + 150x 5 + 275 x 6 + 200x 7 z.d.d. 40x 1 + 20x 2 + 25x 3 + 80x 4 + 20x 5 + 90 x 6 + 50x 7 250 10x 1 + 30x 2 + 30x 3 + 40x 4 + 20x 5 + 25 x 6 + 10x 7 125 25x 1 + 20x 3 + 30x 4 + 20x 5 + 75 25x 1 + 10x 3 + + 10x 5 + 10 x 6 + 30x 7 50 10x 1 + 35x 2 + + 15x 4 + 10x 5 + 20 x 6 50 { Investeringsprobleem 2.2.1 } TITLE Investering; MODEL MAX 250x1 + 180x2 + 225x3 +300x4 + 150x5 + 275x6 + 200x7; SUBJECT TO END 40x1 + 20x2 + 25x3 +80x4 + 20x5 + 90x6 + 50x7 <= 250; 10x1 + 30x2 + 30x3 +40x4 + 20x5 + 25x6 + 10x7 <= 125; 25x1 + 20x3 +30x4 + 20x5 <= 75; 25x1 + 10x3 + 10x5 + 10x6 + 30x7 <= 50; 10x1 + 35x2 +15x4 + 10x5 + 20x6 <= 50;
MPL Modeling System - (c) 1988-2000, Maximal Software, Inc. ------------------------------------------------------------ MODEL STATISTICS Problem name: Filename: Parsing time: Investering investering.mpl 0.00 sec Solver: CPLEX Objective value: 1180.85572257 Iterations: 0 Solution time: 0.00 sec Constraints: 5 Variables: 7 Nonzeros: 28 Density: 80 % SOLUTION RESULT Optimal solution found MAX Z = 1180.8557 DECISION VARIABLES PLAIN VARIABLES Variable Name Activity Reduced Cost ------------------------------------------------------ x1 0.7847 0.0000 x2 0.1684 0.0000 x3 1.7399 0.0000 x4 0.6862 0.0000 x5 0.0000-36.8422 x6 1.2984 0.0000 x7 0.0000-52.9495 ------------------------------------------------------
TITLE Investering; MODEL MAX 250x1 + 180x2 + 225x3 +300x4 + 150x5 + 275x6 + 200x7; SUBJECT TO 40x1 + 20x2 + 25x3 +80x4 + 20x5 + 90x6 + 50x7 <= 250; 10x1 + 30x2 + 30x3 +40x4 + 20x5 + 25x6 + 10x7 <= 125; 25x1 + 20x3 +30x4 + 20x5 <= 75; 25x1 + 10x3 + 10x5 + 10x6 + 30x7 <= 50; 10x1 + 35x2 +15x4 + 10x5 + 20x6 <= 50; x1<=1; x2<=1; x3<=1; x4<=1; x5<=1; x6<=1; x7<=1; END
MPL Modeling System -(c) 1988-2000, Maximal Software, Inc. ------------------------------------------------------------- MODEL STATISTICS Problem name: Investering Filename: investering.mpl Solver: CPLEX Objective value: 1115.42857143 Iterations: 5 Solution time: 0.00 sec Constraints: 12 Variables: 7 Nonzeros: 35 Density: 42 % SOLUTION RESULT Optimal solution found MAX Z = 1115.4286 DECISION VARIABLES PLAIN VARIABLES Variable Name Activity Reduced Cost ------------------------------------------------------ x1 0.2000 0.0000 x2 0.0857 0.0000 x3 1.0000 0.0000 x4 1.0000 0.0000 x5 1.0000 0.0000 x6 1.0000 0.0000 x7 0.5000 0.0000 ------------------------------------------------------
TITLE Investering; BINARY VARIABLES x1, x2, x3, x4, x5, x6, x7; MODEL MAX 250x1 + 180x2 + 225x3 +300x4 + 150x5 + 275x6 + 200x7; SUBJECT TO END 40x1 + 20x2 + 25x3 +80x4 + 20x5 + 90x6 + 50x7 <= 250; 10x1 + 30x2 + 30x3 +40x4 + 20x5 + 25x6 + 10x7 <= 125; 25x1 + 20x3 +30x4 + 20x5 <= 75; 25x1 + 10x3 + 10x5 + 10x6 + 30x7 <= 50; 10x1 + 35x2 +15x4 + 10x5 + 20x6 <= 50;
MPL Modeling System - (c) 1988-2000, Maximal Software, Inc. ------------------------------------------------------------- MODEL STATISTICS Problem name: Investering Filename: investering.mpl Solver: CPLEX Objective value: 1050.00000000 Iterations: 10 Integer nodes: 2 Solution time: 0.00 sec Constraints: 5 Variables: 7 Integers: 7 Nonzeros: 28 Density: 80 % SOLUTION RESULT Optimal integer solution found MAX Z = 1050.0000 DECISION VARIABLES PLAIN VARIABLES Variable Name Activity Reduced Cost ------------------------------------------------------ x1 1.0000 0.0000 x2 0.0000 180.0000 x3 1.0000 25.0000 x4 1.0000 0.0000 x5 0.0000-50.0000 x6 1.0000 275.0000 x7 0.0000 200.0000 ------------------------------------------------------
Extra eis: Als project 3 wordt gedaan, dan moet ook 5 worden gedaan: x 5 x 3 Dit is een lineaire voorwaarde! Project 4 óf project 7: x 4 + x 7 1 Ten hoogste twee projecten van 2, 3, 4 en 6: x 1 + x 3 + x 4 + x 6 2 Project 6 mag niet als 2 én 5 geselecteerd worden: x 6 2 x 2 x 5
Locatieprobleem 2.2.2 (p. 96, maar met gespiegelde tabel) Van\naar Dorp 1 Dorp 2 Dorp 3 Dorp 4 Dorp 5 Dorp 1 0 11 9 10 17 Dorp 2 11 0 8 12 12 Dorp 3 12 14 0 15 10 Dorp 4 9 12 15 0 13 Dorp 5 15 10 12 13 0 Plan een minimaal aantal brandweercentrales zodat de reistijd maximaal 10 minuten is. Variabelen x j = 0/1: Centrale niet/wel in dorp j. Min x 1 + x 2 + x 3 + x 4 + x 5 z.d.d. x 1 + x 4 1 (dorp 1 bereikbaar binnen 10 min) x 2 + x 5 1 x 1 + x 2 + x 3 1 x 3 + x 5 1 en x j {0,1}
MPL Modeling System - (c) 1988-2000, Maximal Software, Inc. ------------------------------------------------------------ MODEL STATISTICS Problem name: Brandweercentrales Solver: CPLEX Objective value: 2.00000000000 Iterations: 0 Integer nodes: 0 Solution time: 0.00 sec Constraints: 4 Variables: 5 Integers: 5 Nonzeros: 9 Density: 45 % SOLUTION RESULT Optimal integer solution found MIN Z = 2.0000 DECISION VARIABLES PLAIN VARIABLES Variable Name Activity Reduced Cost ------------------------------------------------------ x1 1.0000 0.0000 x2 0.0000 0.0000 x3 0.0000 0.0000 x4 0.0000 0.5000 x5 1.0000 0.0000 ------------------------------------------------------ Niet in 1 én in 5 een centrale: x 1 + x 5 1 Variable Name Activity Reduced Cost ------------------------------------------------------ x1 0.0000 0.0000 x2 1.0000 1.0000 x3 0.0000 0.0000 x4 1.0000 0.0000 x5 1.0000 0.0000
Set-covering probleem Elementen x i, verzamelingen U j met kosten c j. Kies een selectie van de U j s die alle x i s bevatten zodanig dat de totale kosten minimaal zijn. In het brandweerprobleem: Alle dorpen van waaruit je in maximaal 10 minuten naar dorp j kunt komen.
Truc als alle c j = 1. LP Oplossing van het 2 e brandweerprobleem Optimal solution found MIN Z = 2.3333 Variable Name Activity Reduced Cost ------------------------------------------------------ x1 0.3333 0.0000 x2 0.3333 0.0000 x3 0.3333 0.0000 x4 0.6667 0.0000 x5 0.6667 0.0000 ------------------------------------------------------ Gevolg: doelwaarde moet 3. Voeg toe: x 1 + x 2 + x 3 + x 4 + x 5 3 Optimal solution found MIN Z = 3.0000 Variable Name Activity Reduced Cost ------------------------------------------------------ x1 0.5000 0.0000 x2 0.5000 0.0000 x3 0.5000 0.0000 x4 1.0000 0.0000 x5 0.5000 0.0000 ------------------------------------------------------ Deze truc werkt niet altijd! Neem bijvoorbeeld x 1 = 1 MIN Z = 3.0000 Variable Name Activity Reduced Cost ------------------------------------------------------ x1 1.0000 0.0000 x2 1.0000 0.0000 x3 1.0000 0.0000 x4 0.0000 0.0000 x5 0.0000 0.0000 ------------------------------------------------------
Algemene modelleertrucs (p. 108) Vaste opstartkosten K > 0 plus lineaire kosten cx > 0: P(x) = cx + K als x > 0 0 als x = 0 Dit is niet een lineaire doelfunctie! Vervang P door: P(x, y) = cx + Ky met x My en y {0,1} (M is een zeer groot getal) Als x > 0, dan moet y = 1, dus P(x, y) = cx + K Als x = 0, dan is P(x, y) = Ky. In een minimaliseringsprobleem wordt automatisch y = 0, dus P = 0. Stuksgewijs lineaire functie: P(x) = c 1 x als 0 x a c 1 a 1 + c 2 (x a) als x > a (met 0 < c 2 < c 1 en x Z) Schrijf P = c 1 y 1 + c 2 y 2 x = y 1 + y 2 0 y 1 a y 2 0 aδ y 1 a y 2 Mδ δ {0,1} met
Bewijs: 1. Als 0 x < a, dan is a > x = y 1 + y 2 y 1. Nu volgt uit aδ y 1 a dat δ = 0 (want δ = 1 zou betekenen dat y 1 = a.). Uit y 2 Mδ volgt dan dat y 2 = 0. Gevolg: P = c 1 y 1 + c 2 y 2 = c 1 y 1 = c 1 x. 2. Als x > a, dan is y 2 = x y 1 > a a = 0, dus uit y 2 Mδ volgt dan dat δ = 1. Nu volgt uit aδ y 1 a dat y 1 = a. Gevolg: P = c 1 y 1 + c 2 y 2 = c 1 a + c 2 (x - a). 3. Als x = a, dan kan δ = 0 óf δ = 1. Als δ = 0, dan is y 2 = 0 en y 1 = x = a, dus P = c 1 a. Als δ = 1, dan is y 1 = a en y 2 = x y 1 = a a = 0, dus ook P = c 1 a. Klaar.
Lineaire functie met quantumkorting: P(x) = cx als 0 x a c(1-d)x als x > a (met d 1, c > 0) Schrijf P = cx - cdz met x a + Mδ x (a+1)δ z x z x M(1-δ) z Mδ δ {0,1} z 0 x kan één van de waarden a 1, a 2,, a n aannemen. x = a 1 x 1 + a 2 x 2 + + a n x n en x 1 + x 2 + + x n = 1 x j {0,1} Slechts één van twee x 1, x 2 0 kan positief zijn x i Mδ i, i = 1,2 δ 1 + δ 2 1 δ j {0,1} x voldoet aan x = 0 óf x a. x Mδ, x aδ δ {0,1}
Tenminste k van m nevenvoorwaarden gelden n j= 1 a ij x j b i + M(1-y i ) met y 1 + + y m k y i {0,1} voor i=1,,m Productterm x 1 x 2 voor binaire variabelen x 1 x 2 = y met y x 1 y x 2 y x 1 + x 2 1 y 0
IP probleem schrijven als een BIP probleem Een geheeltallig probleem waarin alle variabelen begrensd zijn kun je altijd als een binair probleem schrijven. Bijvoorbeeld, als x geheel is en 0 x 20, dan kun je x vervangen door (binaire ontwikkeling) x = y 1 + 2y 2 + 4y 3 + 8y 4 + 16y 5 met y j binaire variabelen. Dit gaat op een lineaire manier, dus je model blijft lineair. Zo kun je elke gehele, begrensde variabele vervangen door een aantal binaire variabelen. Als een variabele niet a priori begrensd is, kan dit niet met eindig veel binaire variabelen! Een IP probleem kan een onbegrensd toegelaten gebied hebben. Het toegelaten gebied van een BIP probleem is altijd begrensd (eindig veel mogelijkheden)
Erfenisprobleem Verdeel spullen ter waarde 100, 61, 45, 37, 22, 21, 2 op een eerlijke manier tussen twee personen. x i = 0/1: persoon 1 krijgt object I niet/wel Persoon 1 krijgt 100x 1 + 61x 2 + 45x 3 + 37x 4 + 22x 5 + 21x 6 + 2x 7 Persoon 2 krijgt 100(1-x 1 )+61(1-x 2 )+45(1-x 3 )+37(x 4-1)+22(1-x 5 )+21(1-x 6 )+2(1-x 7 ) Maak het verschil zo klein mogelijk: Min 100x 1 + 61x 2 + 45x 3 + 37x 4 + 22x 5 + 21x 6 + 2x 7-144 z.d.d. x i {0,1} De objectfunctie is niet-lineair. Anders: Max 100x 1 + 61x 2 + 45x 3 + 37x 4 + 22x 5 + 21x 6 + 2x 7 z.d.d. 100x 1 +61x 2 +45x 3 +37x 4 +22x 5 +21x 6 +2x 7 144 x i {0,1} Heuristische oplosmethode: Geef volgend object aan degene die het minst heeft: 1: 100 37 2 139 2: 61 45 22 21 149
LP relaxatie: (1, 0,7213, 0, 0, 0, 0, 0) Z = 144 Afronden? (1, 1, 0, 0, 0, 0, 0) Niet toelaatbaar! (1, 0, 0, 0, 0, 0, 0) Z = 100 IP oplossing(en): (1, 0, 0, 0, 1, 1, 0) Z = 143 (0, 1, 1, 1, 0, 0, 0) Z = 143 (0, 1, 0, 1, 1, 1, 1) Z = 143
Branch-and-Bound methode Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 x 1, x 2, x 3, x 4 {0,1} Gerelaxeerde probleem Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1 Oplossing: (0,8333, 1, 0, 1) Z = 16,5 Deze oplossing is niet geheel, maar 16,5 (en dus 16) is een bovengrens voor de optimale doelwaarde.
Voeg toe: x 1 = 0, of x 1 = 1: Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 0 Oplossing: (0, 1, 0, 1) Z = 9 Deze oplossing is geheel. Z = 9 is ondergrens voor optimale doelwaarde. Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1 Oplossing: (1, 0,8, 0, 0,8) Z = 16,2 Oplossing is niet geheel. Bovengrens is Z = 16. Deze mogelijkheid moet verder uitgewerkt worden:
Kies x 2 = 0 of x 2 = 1: Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1, x 2 = 0 Oplossing: (1, 0, 0,8, 0) Z = 13,8 Deze tak levert maximaal Z = 13. Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1, x 2 = 1 Oplossing: (1, 1, 0, 0,5) Z = 16 Deze tak verder onderzoeken:
Kies x 3 = 0 of x 3 = 1: Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1, x 2 = 1, x 3 = 0 Oplossing: (1, 1, 0, 0,5) Z = 16 Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1, x 2 = 1, x 3 = 1 Probleem is niet feasible! (zie eerste constraint) Deze tak valt dus af Onderzoek de vorige tak verder:
Kies x 4 = 0 of x 4 = 1: Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1, x 2 = 1, x 3 = 0, x 4 = 0 Oplossing: (1, 1, 0, 0) Z = 14 Max Z = 9x 1 + 5x 2 + 6x 3 + 4x 4 z.d.d. 6x 1 + 3x 2 + 5x 3 + 2x 4 10 x 3 + x 4 1 -x 1 + x 3 0 -x 2 + x 4 0 0 x 1, x 2, x 3, x 4 1, x 1 = 1, x 2 = 1, x 3 = 0, x 4 = 1 Niet feasible! De takken onder (1, 0, *, *) hoeven niet verder onderzocht te worden, want daar is Z 13. Optimale oplossing: (1, 1, 0, 0) Z = 14.
Branch-and-bound voor MIP Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4 x 1, x 2, x 3 Z LP-relaxatie: Laat x j Z weg: Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4 Oplossing: (1,25, 1,5, 1,75, 0) Z = 14,25 Branch in twee gevallen: x 1 1 en x 1 2: Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4, x 1 1 Oplossing: (1, 1,2, 1,8, 0) Z = 14,2
Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4, x 1 2 Niet feasible! Branch x 2 1, x 2 2: Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4, x 1 1, x 2 1 Oplossing: (0,8333, 1, 1,8333, 0) Z = 14,1666 Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4, x 1 1, x 2 2 Oplossing: (0,8333, 2, 1,8333, 0) Z = 12,1666 Branch x 1 = 0 en x 1 = 1:
Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4, x 1 = 0, x 2 1 Oplossing: (0, 0, 2, 0,5) Z = 13,5 (de eerste drie coördinaten zijn geheel, dus dit is een oplossing) Max Z = 4x 1-2x 2 + 7x 3 - x 4 z.d.d. x 1 + 5x 3 10 x 1 + x 2 x 3 1 6x 1-5x 2 0 -x 2 + 2x 3-2x 4 3 0 x 1, x 2, x 3, x 4, x 1 = 1, x 2 1 Niet feasible!
Roosterprobleem (2.2.4, pag. 100) Een busbedrijf heeft wekelijks de volgende aantallen buschauffeurs nodig: maandag dinsdag woensdag donderdag vrijdag zaterdag Zondag 25 27 23 21 25 20 15 Elke chauffeur werkt 5 dagen achtereen, dan twee dagen niet. Salaris: 100 per werkdag, zaterdag 115, zondag 125. Vind een werkrooster dat de loonkosten minimaliseert. Model: Nummer de dagen (maandag = 1, etc.) x i is het aantal chauffeurs dat op dag i begint. Min 500x 1 + 515x 2 + 540x 3 + 540x 4 +540x 5 + 540x 6 + 525x 7 z.d.d. x 1 + x 7 + x 6 + x 5 + x 4 25 x 2 + x 1 + x 7 + x 6 + x 5 27 x 3 + x 2 + x 1 + x 7 + x 6 23 x 4 + x 3 + x 2 + x 1 + x 7 21 x 5 + x 4 + x 3 + x 2 + x 1 25 x 6 + x 5 + x 4 + x 3 + x 2 20 x 7 + x 6 + x 5 + x 4 + x 3 15 x j Z. x 1, x 2,, x 7 0 IP optimale oplossing: (10, 7, 0, 4, 4, 5, 2) Z = 16675 LP relaxatie: (10,6, 5,6, 0,6, 3,6, 4,6, 5,6, 0,6) Z = 16275 LP oplossing naar boven afronden: (11, 6, 1, 4, 5, 6, 1) Z = 17775
Truc (Bartholdi, 1980): Los LP relaxatie op: x 1 + x 2 + + x 7 = 31,2. Rond naar boven en naar beneden op en voeg toe als constraint in LP toe: Met x 1 + x 2 + + x 7 = 31: Niet feasible Met x 1 + x 2 + + x 7 = 32: (12, 5, 2, 2, 4, 7, 0) Z = 16675 Dit specifieke IP probleem is altijd op te lossen door 3 LP problemen op te lossen. Als het gerelaxeerde probleem geheel antwoord levert ben je klaar. Anders levert één van de andere twee problemen een geheel antwoord (oplossen met simplexmethode)
Verbeteren van lineaire constraints voor binaire variabelen: 5x 1 3 x 1 = 0 (x 1 = 1 kan niet) 5x 1 +2x 2 4 x 1 = 0, geen voorwaarde voor x 2 5x 1 x 2 3 x 1 = 0, geen voorwaarde voor x 2 5x 1 + 3x 2 x 3 1 x 1 = 0, (kies x 2 minimaal, x 3 maximaal) dus blijft over: 3x 2 x 3 1 x 2 = 0, geen voorwaarde voor x 3. Totaal: x 1 = x 2 = 0, geen voorwaarde voor x 3. Uit de twee ongelijkheden 8x 1 4x 2 5x 3 + 3x 4 2 3x 2 + 2x 3 4 volgt dat x 1 = 0 (want x 2 en x 3 kunnen niet tegelijk 1 zijn). Het verscherpen van ongelijkheden als preprocessing kan Branch-and-bound helpen, omdat het gerelaxeerde proces betere bovengrenzen geeft en eerder gehele oplossingen.
Algoritme voor het verscherpen van binaire constraints: a 1 x 1 + a 2 x 2 + + a n x n b Algoritme: Bereken S = max(a 1 x 1 + a 2 x 2 + + a n x n ) = som van de positieve coëfficiënten Zoek a j 0 zodat a j > S b Bereken nieuwe coëfficiënt en rechterlid: Als a j > 0 noem a j = S b b = S - a j Als a j < 0 noem a j = b S Dit algoritme verkleint de coëfficiënten in de ongelijkheid
Voorbeeld: 2x 1 + 3x 2 4 S = 2 + 3 = 5 Kan a 1? 2 > 1 = 5 4, dus je kunt a 1 aanpassen a 1 > 0 dus a 1 = S b = 5 4 = 1 b = S a 1 = 5 2 = 3 Gevolg: 2x 1 + 3x 2 4 x 1 + 3x 2 3 Nog een keer? S = 1 + 3 = 4 Kan a 1? a 1 = 1 = 4 3, dus je kunt a 1 niet aanpassen Kan a 2? 2 > 1 = 4 3, dus je kunt a 2 aanpassen: a 1 > 0 dus a 1 = S b = 4 3 = 1 b = S a 1 = 4 3 = 1 Gevolg: 2x 1 + 3x 2 4 x 1 + 3x 2 3 x 1 + x 2 1
Cutting planes: Extra constraint die wel het toegelaten gebied van de LPrelaxatie verkleint, maar niet het toegelaten gebied van het originele BIP. Voorbeeld: 6x 1 + 3x 2 + 5x 3 + 2x 4 10, x j [0,1] Hieruit volgt: x 1 + x 2 + x 4 2. Kun je toevoegen (maar vervangt de originele niet!) Algemener: Neem een -ongelijkheid met positieve coëfficiënten. Zoek N variabelen zodat: Deze N variabelen = 1 en de rest = 0 voldoet niet. Als N-1 van deze = 1 en rest 0 voldoet wel. Neem als cutting plane: som van deze N variabelen N-1 Andere mogelijkheid: x 1 + x 3 1 Het verscherpen en toevoegen van ongelijkheden kan de performance van branch-and-bound drastisch verbeteren (branch-and-cut).