SlideShare a Scribd company logo
1 of 14
Stochastic Extensions




New Stochastic Programming Features
   for the MPL Modeling Language

                     Presented by

           Bjarni Kristjansson
          Maximal Software, Inc.




     Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                   1
Presentation Overview


•   Previous Stochastic Work
•   Design Issues for Modeling Languages
•   New Keywords for Stochastic Models
•   Stochastic Programming with MPL
•   Formulating Scenario-Based Models in MPL
•   Formulating Independent Variable Models in MPL
•   Solving Stochastic Models with CPLEX and GUROBI
•   Demonstration of MPL Stochastic Models
•   News on Gurobi Support and Academic Program




             Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                           2
Previous Stochastic Work


MPL/SPInE Project
   •   Collaboration project with Brunel University
   •   Fully implemented Scenario-based modeling for MPL
   •   Solved models using FortSP (Nested Benders)
   •   Could also compute HN, WS, EV, DEQ
   •   Generated SMPS format
But there were some issues:
   •   Designed as preprocessor for MPL
   •   Separate MPL file generated for every scenario
   •   Serious scalability issues
   •   Lacking support for other model types (indep variables, etc.)
   •   Limited to a single stochastic solver

                  Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                3
New Project: Stochastic Support for MPL


Current release of MPL provides following support for
Stochastic Programming:
   •   Multiple model types (Scenarios, Independent, etc.)
   •   New keywords and cleanup on syntax
   •   New callable library interface (C-API)
   •   Support for multiple solvers (BendX, FortSP, Coin-SMI, etc.)
   •   Support for both SMPS and OptML (XML)




                 Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                               4
MPL Stochastic Extensions


•   New Syntax for stochastic models in MPL
•   Data structures for storing stochastic information
•   Callable Interface for Stochastic Programming
•   New Stochastic Solver - BendX (Callable Library)
                Deterministic Equivalent
                Two-stage Benders
                Multi-stage Benders
•   Connect to BendX to MPL
•   SMPS Reader/Writer
•   XML Reader/Writer (OptML/OSiL)
•   Create Model Library
•   Testing Software
•   Release to Market

                 Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                               5
Design Issues for Modeling Languages


Stochastic Representation in Modeling Language
  should be:
   •   Readable
   •   Straightforward
   •   Compact
   •   Efficient Model Generation
   •   Interface Directly with Solvers
   •   Utilize Original Data
   •   Complete
   •   Extensible




                  Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                6
Keywords for Scenario Based Models


STOCHASTIC
 Keyword marking the start of stochastic formulation (optional)
TIME
  Index used to describe the temporal horizon (optional)
STAGES
 Decision stages for the model (optional)
STAGEMAP
 Mapping of time index into stages (optional)
SCENARIO
 Index used identify the scenarios
TREE
 Specify the structure of the event tree for the scenarios (optional)
PROBABILITIES
 Probabilities (discrete) associated with each scenario
RANDOM DATA
 Random parameters of the problem for each scenario


                  Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                7
Keywords for Discrete Based Models


STOCHASTIC
 Keyword marking the start of stochastic formulation (optional)
STAGES
 Decision stages for the model (optional)
STAGEMAP
 Mapping of time index into stages (optional)
INDEP
  Index for the independent variables
OUTCOME
 The values representing outcome of the independent variables
EVENT
 Connect outcomes to independent variables (optional)
PROBABILITIES
 Probabilities (discrete) associated with each outcome
RANDOM DATA
 Random parameters of the problem for each outcome


                  Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                8
Farmer Model (sample from Birge book)

TITLE
   Farmer;

STOCHASTIC

SCENARIO
   sc := 1..3;

INDEX
   crop    := (Wheat,Corn,SugarB);
   prLevel := 1..2;

PROBABILITIES
   Prob[sc] := ALLEQUAL;

RANDOM DATA
   Yield[crop,sc] := SPARSEFILE("Farmer.dat");

DATA
   Cost[crop] := (150,230,260);
   SellPrice[crop,prLevel]   := (170, 0,
                                 150, 0,
                                  36, 10);
   PurPrice[crop] := (238, 210, 0);
   MinReq[crop] := (200,240, 0);
   AvailLand := 500;
   MaxBeets := 6000;

                           Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                         9
Farmer Model (cont.)

VARIABLES
   Plant[crop];

STAGE2 VARIABLES
   CropPurchased[crop] WHERE (PurPrice > 0);
   CropSold[crop,prLevel] WHERE (SellPrice > 0);

MODEL
   MIN TotalCost = - SUM(crop,prLevel: SellPrice * CropSold)
              + SUM(crop: PurPrice * CropPurchased)
              + SUM(crop: Cost * Plant);

SUBJECT TO

   LandUse: SUM(crop: Plant) <= AvailLand;

   MeetMinReq[crop]:  - Yield * Plant
                    - CropPurchased
                    + SUM(prLevel: CropSold)
                   <= -MinReq;

   BeetCap[crop=SugarB]:      Yield * Plant
                            - SUM(prLevel: CropSold)
                           >= 0.0;
BOUNDS
   CropSold[crop:=SugarB,prLevel:=1] <= MaxBeets;

END

                            Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                          10
Aircraft Allocation Model

TITLE
   AircraftAlloc;

STOCHASTIC

INDEX
    aircraft := (A,B,C,D);
INDEP
   route := (NL1, NL2, ND0, ND1, NB0) -> {r1,r2,r3,r4,r5);

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,
          . . . . . . .
          NB0, 2, 0.8,
          NB0, 3, 0.1];
                             Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                           11
Aircraft Allocation Model (cont.)

RANDOM DATA
  Demand[route, out5 IN RouteOut] :=
       [NL1, 1, 200,
        NL1, 2, 220,
        . . . . . . .
         NB0, 2, 600,
         NB0, 3, 620];

DATA
   AircraftAvail[aircraft] := (10, 19, 25, 15);
   PriceTicket[route]      := (13, 13, 7, 7, 1);
   PotentialPass[aircraft, route]
       := (16, 15, 28, 23, 81,
             , 10, 14, 15, 57,
             , 5,    , 7, 29,
            9, 11, 22, 17, 55);
   MonthlyCost[aircraft, route]
       := (18, 21, 18, 16, 10,
             , 15, 16, 14, 9,
             , 10,   , 9, 6,
           17, 16, 17, 15, 10);

DECISION VARIABLES
   Assign[aircraft, route] -> x
      WHERE (PotentialPass > 0);




                         Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                       12
Aircraft Allocation Model (cont.)

STAGE2 VARIABLES
   EmptySeats[route] -> y1;
   TurnedAway[route] -> y2;

MACRO
   OperatingCost := SUM(aircraft, route: MonthlyCost * Assign);
   LostRevenue   := SUM(route: PriceTicket * TurnedAway);

MODEL
    MIN TotalCost = OperatingCost + LostRevenue;

SUBJECT TO
   AircraftCap[aircraft]:
       SUM(route: Assign)
    <=
       AircraftAvail;

   PassBal[route]:
       SUM(aircraft: PotentialPass * Assign)
       + TurnedAway[route]
       - EmptySeats[route]
     =
       Demand[route];
END




                            Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                          13
BendX - Callable Library Interface (C-API)


int BendxLoadStochStages(HPROB hProb, int StageCount,
                         int *VarStages, int *ConStages,
                         char **StageNames);

int BendxLoadStochTree(HPROB hProb, int TreeType, int TreeCount,
                       int *TreeData, int *TreeData2);

int BendxLoadStochScenarios(HPROB hProb, int ScenCount, double *ProbData,
                            int *TreeStageStart, int *ScenBegin,
                            int RandomCount, int *RandomCol,
                            int *RandomRow, double *RandomData,
                            char **ScenNames);

int BendxLoadStochIndep(HPROB hProb, int IndepCount, int *RandomCol,
                        int *RandomRow, int *OutcomeCounts, int EventCount,
                        double *ProbData, double *RandomData);

int BendxLoadStochBlocks(HPROB hProb, int IndepCount, int *OutcomeCounts,
                         int EventCount, double *ProbData, int *EventBegin,
                         int RandomCount, int *RandomCol, int *RandomRow,
                         double *RandomData);



                         Copyright © 2011 Maximal Software, Inc. All rights reserved
                                                                                       14

More Related Content

Similar to Seminar: New Stochastic Programming Features for MPL - Nov 2011

Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGuillaume Laforge
 
Track A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMTrack A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMchiportal
 
Close encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet CodeClose encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet Codelbergmans
 
Close Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet codeClose Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet codelbergmans
 
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Benoit Combemale
 
Advanced kapacitor
Advanced kapacitorAdvanced kapacitor
Advanced kapacitorInfluxData
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsSerge Stinckwich
 
iOS overview
iOS overviewiOS overview
iOS overviewgupta25
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0Petr Zapletal
 
Cassandra and materialized views
Cassandra and materialized viewsCassandra and materialized views
Cassandra and materialized viewsGrzegorz Duda
 
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06ManhHoangVan
 
Intermachine Parallelism
Intermachine ParallelismIntermachine Parallelism
Intermachine ParallelismSri Prasanna
 
Performance modeling and simulation for accumulo applications
Performance modeling and simulation for accumulo applicationsPerformance modeling and simulation for accumulo applications
Performance modeling and simulation for accumulo applicationsAccumulo Summit
 
QSOUL/Aop
QSOUL/AopQSOUL/Aop
QSOUL/AopESUG
 
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...Intel® Software
 
Madeo - a CAD Tool for reconfigurable Hardware
Madeo - a CAD Tool for reconfigurable HardwareMadeo - a CAD Tool for reconfigurable Hardware
Madeo - a CAD Tool for reconfigurable HardwareESUG
 
ISCA Final Presentation - HSAIL
ISCA Final Presentation - HSAILISCA Final Presentation - HSAIL
ISCA Final Presentation - HSAILHSA Foundation
 
IMPRESS Presentation Carnegie Mellon University
IMPRESS Presentation Carnegie Mellon UniversityIMPRESS Presentation Carnegie Mellon University
IMPRESS Presentation Carnegie Mellon UniversityAlkis Vazacopoulos
 

Similar to Seminar: New Stochastic Programming Features for MPL - Nov 2011 (20)

How to Use OpenMP on Native Activity
How to Use OpenMP on Native ActivityHow to Use OpenMP on Native Activity
How to Use OpenMP on Native Activity
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
 
Track A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMTrack A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBM
 
20160908 hivemall meetup
20160908 hivemall meetup20160908 hivemall meetup
20160908 hivemall meetup
 
Close encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet CodeClose encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet Code
 
Close Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet codeClose Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet code
 
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
 
Advanced kapacitor
Advanced kapacitorAdvanced kapacitor
Advanced kapacitor
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
iOS overview
iOS overviewiOS overview
iOS overview
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0
 
Cassandra and materialized views
Cassandra and materialized viewsCassandra and materialized views
Cassandra and materialized views
 
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
 
Intermachine Parallelism
Intermachine ParallelismIntermachine Parallelism
Intermachine Parallelism
 
Performance modeling and simulation for accumulo applications
Performance modeling and simulation for accumulo applicationsPerformance modeling and simulation for accumulo applications
Performance modeling and simulation for accumulo applications
 
QSOUL/Aop
QSOUL/AopQSOUL/Aop
QSOUL/Aop
 
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
 
Madeo - a CAD Tool for reconfigurable Hardware
Madeo - a CAD Tool for reconfigurable HardwareMadeo - a CAD Tool for reconfigurable Hardware
Madeo - a CAD Tool for reconfigurable Hardware
 
ISCA Final Presentation - HSAIL
ISCA Final Presentation - HSAILISCA Final Presentation - HSAIL
ISCA Final Presentation - HSAIL
 
IMPRESS Presentation Carnegie Mellon University
IMPRESS Presentation Carnegie Mellon UniversityIMPRESS Presentation Carnegie Mellon University
IMPRESS Presentation Carnegie Mellon University
 

More from Bjarni Kristjánsson

New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015
New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015
New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015Bjarni Kristjánsson
 
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...Bjarni Kristjánsson
 
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...Bjarni Kristjánsson
 
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012Bjarni Kristjánsson
 
Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012
Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012
Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012Bjarni Kristjánsson
 
Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012Bjarni Kristjánsson
 
Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012
Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012
Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012Bjarni Kristjánsson
 
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012Bjarni Kristjánsson
 
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011Bjarni Kristjánsson
 
INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011Bjarni Kristjánsson
 
INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011Bjarni Kristjánsson
 

More from Bjarni Kristjánsson (11)

New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015
New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015
New Release 5.0 of MPL and OptiMax Library - OR Vienna 2015
 
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
Maximal: Achieving Optimal Solution Performance for your Optimization Modelin...
 
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
Maximal: Deploying Optimization Models on Servers and Mobile Platforms - Oct ...
 
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
Maximal: Comparison of Optimization Modeling Software for Python - Oct 2012
 
Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012
Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012
Maximal: MPL Software Demo - INFORMS Phoenix Oct 2012
 
Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012Seminar: Data Modeling for Optimization with MPL - Oct 2012
Seminar: Data Modeling for Optimization with MPL - Oct 2012
 
Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012
Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012
Seminar: Embedding Optimization in Applications with MPL OptiMax - April 2012
 
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
Seminar: New Pricing Programs and Free Software Offers by Maximal - Oct 2012
 
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
OR Connect: A New Web 2.0 Online Initiative for O.R. - INFORMS Jan 2011
 
INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011INFORMS: IT Board Report - April 2011
INFORMS: IT Board Report - April 2011
 
INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011INFORMS: IT Committee Report - August 2011
INFORMS: IT Committee Report - August 2011
 

Seminar: New Stochastic Programming Features for MPL - Nov 2011

  • 1. Stochastic Extensions New Stochastic Programming Features for the MPL Modeling Language Presented by Bjarni Kristjansson Maximal Software, Inc. Copyright © 2011 Maximal Software, Inc. All rights reserved 1
  • 2. Presentation Overview • Previous Stochastic Work • Design Issues for Modeling Languages • New Keywords for Stochastic Models • Stochastic Programming with MPL • Formulating Scenario-Based Models in MPL • Formulating Independent Variable Models in MPL • Solving Stochastic Models with CPLEX and GUROBI • Demonstration of MPL Stochastic Models • News on Gurobi Support and Academic Program Copyright © 2011 Maximal Software, Inc. All rights reserved 2
  • 3. Previous Stochastic Work MPL/SPInE Project • Collaboration project with Brunel University • Fully implemented Scenario-based modeling for MPL • Solved models using FortSP (Nested Benders) • Could also compute HN, WS, EV, DEQ • Generated SMPS format But there were some issues: • Designed as preprocessor for MPL • Separate MPL file generated for every scenario • Serious scalability issues • Lacking support for other model types (indep variables, etc.) • Limited to a single stochastic solver Copyright © 2011 Maximal Software, Inc. All rights reserved 3
  • 4. New Project: Stochastic Support for MPL Current release of MPL provides following support for Stochastic Programming: • Multiple model types (Scenarios, Independent, etc.) • New keywords and cleanup on syntax • New callable library interface (C-API) • Support for multiple solvers (BendX, FortSP, Coin-SMI, etc.) • Support for both SMPS and OptML (XML) Copyright © 2011 Maximal Software, Inc. All rights reserved 4
  • 5. MPL Stochastic Extensions • New Syntax for stochastic models in MPL • Data structures for storing stochastic information • Callable Interface for Stochastic Programming • New Stochastic Solver - BendX (Callable Library) Deterministic Equivalent Two-stage Benders Multi-stage Benders • Connect to BendX to MPL • SMPS Reader/Writer • XML Reader/Writer (OptML/OSiL) • Create Model Library • Testing Software • Release to Market Copyright © 2011 Maximal Software, Inc. All rights reserved 5
  • 6. Design Issues for Modeling Languages Stochastic Representation in Modeling Language should be: • Readable • Straightforward • Compact • Efficient Model Generation • Interface Directly with Solvers • Utilize Original Data • Complete • Extensible Copyright © 2011 Maximal Software, Inc. All rights reserved 6
  • 7. Keywords for Scenario Based Models STOCHASTIC Keyword marking the start of stochastic formulation (optional) TIME Index used to describe the temporal horizon (optional) STAGES Decision stages for the model (optional) STAGEMAP Mapping of time index into stages (optional) SCENARIO Index used identify the scenarios TREE Specify the structure of the event tree for the scenarios (optional) PROBABILITIES Probabilities (discrete) associated with each scenario RANDOM DATA Random parameters of the problem for each scenario Copyright © 2011 Maximal Software, Inc. All rights reserved 7
  • 8. Keywords for Discrete Based Models STOCHASTIC Keyword marking the start of stochastic formulation (optional) STAGES Decision stages for the model (optional) STAGEMAP Mapping of time index into stages (optional) INDEP Index for the independent variables OUTCOME The values representing outcome of the independent variables EVENT Connect outcomes to independent variables (optional) PROBABILITIES Probabilities (discrete) associated with each outcome RANDOM DATA Random parameters of the problem for each outcome Copyright © 2011 Maximal Software, Inc. All rights reserved 8
  • 9. Farmer Model (sample from Birge book) TITLE Farmer; STOCHASTIC SCENARIO sc := 1..3; INDEX crop := (Wheat,Corn,SugarB); prLevel := 1..2; PROBABILITIES Prob[sc] := ALLEQUAL; RANDOM DATA Yield[crop,sc] := SPARSEFILE("Farmer.dat"); DATA Cost[crop] := (150,230,260); SellPrice[crop,prLevel] := (170, 0, 150, 0, 36, 10); PurPrice[crop] := (238, 210, 0); MinReq[crop] := (200,240, 0); AvailLand := 500; MaxBeets := 6000; Copyright © 2011 Maximal Software, Inc. All rights reserved 9
  • 10. Farmer Model (cont.) VARIABLES Plant[crop]; STAGE2 VARIABLES CropPurchased[crop] WHERE (PurPrice > 0); CropSold[crop,prLevel] WHERE (SellPrice > 0); MODEL MIN TotalCost = - SUM(crop,prLevel: SellPrice * CropSold) + SUM(crop: PurPrice * CropPurchased) + SUM(crop: Cost * Plant); SUBJECT TO LandUse: SUM(crop: Plant) <= AvailLand; MeetMinReq[crop]: - Yield * Plant - CropPurchased + SUM(prLevel: CropSold) <= -MinReq; BeetCap[crop=SugarB]: Yield * Plant - SUM(prLevel: CropSold) >= 0.0; BOUNDS CropSold[crop:=SugarB,prLevel:=1] <= MaxBeets; END Copyright © 2011 Maximal Software, Inc. All rights reserved 10
  • 11. Aircraft Allocation Model TITLE AircraftAlloc; STOCHASTIC INDEX aircraft := (A,B,C,D); INDEP route := (NL1, NL2, ND0, ND1, NB0) -> {r1,r2,r3,r4,r5); 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, . . . . . . . NB0, 2, 0.8, NB0, 3, 0.1]; Copyright © 2011 Maximal Software, Inc. All rights reserved 11
  • 12. Aircraft Allocation Model (cont.) RANDOM DATA Demand[route, out5 IN RouteOut] := [NL1, 1, 200, NL1, 2, 220, . . . . . . . NB0, 2, 600, NB0, 3, 620]; DATA AircraftAvail[aircraft] := (10, 19, 25, 15); PriceTicket[route] := (13, 13, 7, 7, 1); PotentialPass[aircraft, route] := (16, 15, 28, 23, 81, , 10, 14, 15, 57, , 5, , 7, 29, 9, 11, 22, 17, 55); MonthlyCost[aircraft, route] := (18, 21, 18, 16, 10, , 15, 16, 14, 9, , 10, , 9, 6, 17, 16, 17, 15, 10); DECISION VARIABLES Assign[aircraft, route] -> x WHERE (PotentialPass > 0); Copyright © 2011 Maximal Software, Inc. All rights reserved 12
  • 13. Aircraft Allocation Model (cont.) STAGE2 VARIABLES EmptySeats[route] -> y1; TurnedAway[route] -> y2; MACRO OperatingCost := SUM(aircraft, route: MonthlyCost * Assign); LostRevenue := SUM(route: PriceTicket * TurnedAway); MODEL MIN TotalCost = OperatingCost + LostRevenue; SUBJECT TO AircraftCap[aircraft]: SUM(route: Assign) <= AircraftAvail; PassBal[route]: SUM(aircraft: PotentialPass * Assign) + TurnedAway[route] - EmptySeats[route] = Demand[route]; END Copyright © 2011 Maximal Software, Inc. All rights reserved 13
  • 14. BendX - Callable Library Interface (C-API) int BendxLoadStochStages(HPROB hProb, int StageCount, int *VarStages, int *ConStages, char **StageNames); int BendxLoadStochTree(HPROB hProb, int TreeType, int TreeCount, int *TreeData, int *TreeData2); int BendxLoadStochScenarios(HPROB hProb, int ScenCount, double *ProbData, int *TreeStageStart, int *ScenBegin, int RandomCount, int *RandomCol, int *RandomRow, double *RandomData, char **ScenNames); int BendxLoadStochIndep(HPROB hProb, int IndepCount, int *RandomCol, int *RandomRow, int *OutcomeCounts, int EventCount, double *ProbData, double *RandomData); int BendxLoadStochBlocks(HPROB hProb, int IndepCount, int *OutcomeCounts, int EventCount, double *ProbData, int *EventBegin, int RandomCount, int *RandomCol, int *RandomRow, double *RandomData); Copyright © 2011 Maximal Software, Inc. All rights reserved 14