Scenariobased Stochastic Constraint Programming Suresh Manandhar Armagan Tarim
Scenario-based Stochastic Constraint Programming Suresh Manandhar, Armagan Tarim, University of York Toby Walsh, 4 C, University College Cork 9/30/2020
Motivation n Constraint programming (CP) tool of choice for many domains ¨ scheduling, routing, assignment, . . but perhaps not for cliff diving ¨ n But CP poor at dealing with uncertainty present in real world ¨ ¨ ¨ 9/30/2020 past data contain errors present data hard to collect future data is uncertain
Stochastic constraint programs n n Introduced at ECAI-2002 Decision variables ¨ n user sets Stochastic variables nature sets according to probability distribution ¨ examples: demand, market up/down, arrival time, … ¨ ECAI 2002 conference dinner 9/30/2020 n Can be (in)dependent [Walsh 2002]
Stochastic constraint programs n Hard constraints over decision vars, or decision and stochastic vars demand[i] = production[i]+stock[i] ¨ not purely over stochastic vars ¨ relation of (dis)allowed values ¨ n Chance constraints ¨ 9/30/2020 not necessarily satisfied in all worlds Prob(demand[i] = production[i]+stock[i]) >= 0. 95
Stochastic constraint programs n Many different objectives supported expectation maximized or minimized ¨ downside minimized or upside maximized ¨ spread or variance minimized ¨ …. ¨ 9/30/2020
One stage n n user makes decisions nature then sets stochastic variables M 1=1 Outcome 1 S 1=3 B 1=2 M 1=0 Outcome 2 9/30/2020
Two stages n n n user makes decisions nature sets stochastic variables user then makes some more decisions M 1=1 S 2=10 B 2=6 S 1=3 B 1=2 M 1=0 9/30/2020 S 2=1 B 2=1
Multiple stages n n user makes decisions nature sets stochastic variables user then makes some more decisions … M 1=1 S 3=32 B 3=20 M 2=0 S 3=4 B 3=2 M 2=1 S 3=4 B 3=2 S 2=10 B 2=6 S 1=3 B 1=2 M 1=0 M 2=1 S 2=1 B 2=1 M 2=0 9/30/2020 S 3=0 B 3=1
Financial planning example n Decision variables Si in stocks in ith year ¨ Bi in bonds in ith year ¨ n Stochastic variables Mi = 1, market up ¨ Mi = 0, market down ¨ with 50% probability ¨ M 1=1 S 3=32 B 3=20 M 2=0 S 3=4 B 3=2 M 2=1 S 3=4 B 3=2 S 2=10 B 2=6 S 1=3 B 1=2 M 1=0 M 2=1 S 2=1 B 2=1 M 2=0 9/30/2020 S 3=0 B 3=1
Financial planning example n Market up stocks make 300% ¨ bonds make 100% ¨ n Market down stocks make -100% ¨ bonds make 0% ¨ n n All money must be put in bonds or stocks Maximize expected profit ¨ E(Sn+Bn) M 1=1 S 3=32 B 3=20 M 2=0 S 3=4 B 3=2 M 2=1 S 3=4 B 3=2 S 2=10 B 2=6 S 1=3 B 1=2 M 1=0 M 2=1 S 2=1 B 2=1 M 2=0 9/30/2020 S 3=0 B 3=1
Financial planning example n Solution now policy tree of decisions ¨ one path for each possible scenario ¨ n Goal is to find policy that maximizes expected profit: E[Profit] = sum(paths) prob(path) * (Sn+Bn) M 1=1 S 3=32 B 3=20 M 2=0 S 3=4 B 3=2 M 2=1 S 3=4 B 3=2 S 2=10 B 2=6 S 1=3 B 1=2 M 1=0 M 2=1 S 2=1 B 2=1 M 2=0 9/30/2020 S 3=0 B 3=1
Solving stochastic CPs n Search method and/or search tree [ECAI 2002] ¨ stochastic vars => and nodes ¨ decisions vars => or nodes ¨ n Compilation method ¨ 9/30/2020 gives regular (deterministic) constraint program
Compiling stochastic CPs n Introduce new decision vars for each scenario replace stochastic vars with their scenario value ¨ scenarios with common paths share decision vars ¨ n +ve ¨ n -ve ¨ 9/30/2020 gives regular (deterministic) CP exponential space in worst case
Stochastic OPL n Compiles down into ILOG’s OPL modelling language ¨ n 9/30/2020 itself compiles down into C++ Solver code Exploits powerful propagators and modelling features found in OPL/Solver
Stochastic OPL int n = …; var int stocks[n]; var int bonds[n]; stochastic var 0. . 1 market[n] uniform; maximize expected 4*stocks[n]*market[n] + 2*bonds[n]*market[n] + bonds[n]*(1 -market[n]) subject to stocks[1]+bonds[1]=5; forall(i in 1. . n-1) stocks[i+1]+bonds[i+1] = 4*stocks[i]*market[i] + 2*bonds[i]*market[i] + bonds[i]*(1 -market[i]); 9/30/2020
Stochastic OPL n Variable declarations var int stocks[n]; var int bonds[n]; stochastic var 0. . 1 market[n] uniform; stochastic var 100. . 105 demand[n] {1, 2, 3, 3, 2, 1}; stochastic var int incoming. Calls[n] poisson(100); 9/30/2020
Stochastic OPL n Hard constraints forall(i in 1. . n-1) stocks[i+1]+bonds[i+1] = 4*stocks[i]*market[i] + 2*bonds[i]*market[i] + bonds[i]*(1 -market[i]); n Chance constraints forall(i in 1. . n) prob(demand[i] <= production[i]+stock[i]) >= 0. 96 9/30/2020
Stochastic OPL n Objectives maximize expected profit[n] subject to … maximize min profit[n] subject to … minimize variance profit[n] subject to … minimize spread profit[n] subject to … maximize chance profit[n]>100 subject to … … 9/30/2020
Scenario reduction n To cope with the exponential number of scenarios scenario mean; scenario median; scenario sample 100 montecarlo; scenario sample 100 latinhypercube; scenario top 10; scenario top 95 percent; … 9/30/2020
Robust solutions n Insist on identical decisions in different scenarios robust solution; … robust production[0]; robust production[1]; … maximize chance wealth[n] >= 2*wealth[0] subject to. . … maximize robustness subject to. . 9/30/2020
Conclusions n Stochastic constraint programs stochastic vars ¨ chance constraints ¨ several different objectives ¨ n n maximized expectation minimized downside … Stochastic OPL compiles to (regular) OPL ¨ exploits power of CP toolkit ¨ 9/30/2020
- Slides: 21