290 likes | 466 Views
Solver and modelling support for stochastic programming. H.I. Gassmann, Dalhousie University. Happy Birthday Andr á s, November 2009. Agenda. Stochastic programs An Example Algebraic modelling languages GAMS MPL AMPL Frontline Systems SMI (Stochastic modelling interface)
E N D
Solver and modelling support for stochastic programming H.I. Gassmann, Dalhousie University Happy Birthday András, November 2009
Agenda • Stochastic programs • An Example • Algebraic modelling languages • GAMS • MPL • AMPL • Frontline Systems • SMI (Stochastic modelling interface) • Optimization Services • Other software
Stochastic programs • Two-stage recourse problems • Multistage recourse problems • Chance-constrained problems • Continuous distributions
An Example (Ferguson & Dantzig) xij = # aircraft of type i assigned to route j yj = # empty seats on route j zj = # lost sales on route j In the original formulation, d is defined by marginals
Words to ponder… • “Simple recourse is so previous millennium” • “Always build your scenario tree prior to calling the solver” • “No need to bother with special algorithms ― Cplex on the deterministic equivalent is best” • “Robust optimization is irrelevant”
GAMS SET equip := (E1, E2, E3, E4); route := (R1, R2, R3, R4, R5); scen := (S1*S720); DATA avail[equip] := (E1,10, E2,19, E3,25, E4,15); price[route] := (R1,13, R2,13, R3, 7, R4, 7, R5, 1); capac[equip,route] := (...); cost [equip,route] := (...); demand[route,scen] := (...); prob[scen] := (...); DECISION VARIABLES Assign[equip,route]; Empty[route,scen]; LostSales[route,scen]; MODEL MIN totalcost = SUM(equip,route: cost*Assign) + SUM(route,scen: prob*price*LostSales); SUBJECT TO availability[equip]: SUM(route: Assign) <= avail; passengers[route,scen]: SUM(equip: capac*Assign) – Empty + LostSales = demand;
GAMS • Solve deterministic equivalent • Two-stage problems can use DECIS • Discrete scenarios only
MPL INDEX aircraft : = (A,B,C,D); STOCHASTIC INDEP route := (NL1, NL2, ND0, ND1, NB0) -> (r1,r2,r3,r4,r45); OUTCOME out5 := 1..5; EVENT RouteOut[route,out5] := (NL1, 1..5, NL2, 1..2, ND0, 1..5, ND1, 1..5, NB0, 1..3); PROBABILITIES p[route, out5 in RouteOut] := [NL1, 1, 0.2, NL1, 2, 0.05, ... ];
MPL (continued) RANDOM DATA Demand[route, out5 in RouteOut] := ... DATA AircraftAvail[aircraft] := ...; TicketPrice[route] := ...; PotentialPass[aircraft,route] := ...; MonthlyCost [aircraft,route] := ...; DECISION VARIABLES Assign[aircraft,route] -> x WHERE (PotentialPass > 0); STAGE2 VARIABLES EmptySeats[route] -> y1; TurnedAway[route] -> y2; MODEL MIN TotalCost = SUM(aircraft,route: MonthlyCost * Assign) + SUM(route: TicketPrice * TurnedAway); SUBJECT TO AircraftCap[aircraft]: SUM(route: Assign) <= AircraftAvail; PassengerBal[route]: SUM(aircraft: PotentialPass * Assign) + TurnedAway[route] – EmptySeats[route] = Demand[route];
MPL capabilities • Solve deterministic equivalent (any MPL solver) • Built-in decomposition solver (two-stage - Cplex) • Communication with SMI • Planned extensions: nested decomposition
AMPL set aircraft := {A1, A2, A3, A4}; set routes := {r1, r2, r3, r4, r5}; param avail{aircraft} >= 0; param ticketPrice{routes} > 0; param potentialPassenger{aircraft, routes} default 0; param MonthlyCost {a in aircraft, r in routes: potentialPassenger[a,r] > 0}; var demand{route} random; var Assign{a in aircraft, r in routes: potentialPassenger[a,r] > 0} >= 0; var EmptySeats{route} suffix stage 2; var TurnedAway{route} suffix stage 2; minimize totalCost: sum{a in aircraft, r in routes: potentialPassenger[a,r] > 0} MonthlyCost[a,r]*Assign[a,r] + sum{r in routes} TicketPrice[r]*TurnedAway[r]; subject to AircraftCap{a in aircraft}: sum{r in routes: potentialPassenger[a,r] > 0} Assign[a,r] <= avail[a]; subject to PassengerBalance{r in routes}: sum{a in aircraft: potentialPassenger[a,r] > 0} potentialPassenger[a,r] * Assign[a,r] + TurnedAway[r] - EmptySeats[r] = demand[r];
Frontline systems • Robust optimization • Chance constraints • Recourse models • Expected value, VaR, CVar objectives • One or two stages • Continuous distributions (automatic sampling) • Deterministic equivalent or simulation • Example
SMI (Stochastic Modeling Interface) • Coin-OR project • API for interaction with stochastic models • Scenario-based • Discrete distributions
Optimization Services • The Optimization Services project aims to provide A set of standards to facilitate communication between modeling languages, solvers, problem analyzers, simulation engines, and registry and discovery services in a distributed computing environment.
Data inter-change AML User interface Corporate databases Solvers
What Is Optimization Services (OS)? A set of XML-based standards for representing, among others, • optimization instances (OSiL, also OSgL, OSnL and OSsL) • optimization results (OSrL and OSaL) • optimization solver options (OSoL) • communication between clients and solvers (OSpL) • Open source libraries to work with these standards • A robust API for solver algorithms and modeling systems • Support for linear, integer, nonlinear and stochastic programs • A command line executable OSSolverService • Executables OSAmplClient and GAMSLinks for AMPL and GAMS • Utilities to convert MPS files and AMPL nl files into OSiL • Server software that works with Apache Tomcat and Apache Axis
. . . . . . . . . . . . Solvers Solvers Modelling systems Modelling systems Why a standard interface? n*m hook-ups n+m hook-ups
Why XML? • Existing parsers to check syntax • Easy to generate automatically • Tree structure naturally mirrors expression trees for nonlinear functions • Arbitrary precision and name space • Automatic attribute checking (e.g., nonnegativity) • Querying capabilities via XQuery • Encryption standards being developed • Easy integration into broader IT infrastructure
… OSiL Schema – Deterministic data
Representation of uncertainty • Explicit event trees • Scenario formulation • Only record data items that differ from parent scenario • Implicit trees (distribution-based formulation) • Assume independence between stages • Distributions within stage discrete or continuous • Probabilistic constraints • Simple chance constraints • Joint chance constraints
OSInstance: In-memory representation • XML elements correspond to C++ classes • Child elements mapped as member classes • set(), get() and calculate() methods class OSInstance{ public: OSInstance(); InstanceHeader *instanceHeader; InstanceData *instanceData; }; // class OSInstance
OSoL – OS option language • Solver options • Initializations of variables • System requirements • Job parameters • In-memory representation: OSOption • API: get(), set(), add() methods
OSrL and OSResult • Result of the optimization • Solution status • Statistics • Value of primal and dual variables • Can be displayed in a browser
Solver support • All versions of OS download with COIN-OR solvers • Clp • Cbc • Ipopt • Bonmin • Couenne • Symphony • Additiona solver support • Cplex • GLPK • Lindo
Future developments • Stochastic programming • Cone programming • Instance modification • Solution analysis
Other software • SLP-IOR • SPInE/SAMPL/SMPL • Fort-SP • DECIS • MSLiP • …
Conclusions • Slow but steady progress • Stochastic programming is more than scenario trees and deterministic equivalents • SP-aware modeling systems