SmiScnModel Class Reference

SmiScnModel: COIN-SMI Scenario Model Class. More...

#include <SmiScnModel.hpp>

Collaboration diagram for SmiScnModel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

SmiScenarioIndex getNumScenarios ()
double getScenarioProb (SmiScenarioIndex ns)
SmiScnNodegetLeafNode (SmiScenarioIndex i)
SmiScnNodegetRootNode ()
double getObjectiveValue (SmiScenarioIndex ns)
double * getColSolution (SmiScenarioIndex ns, int *length)
double * getRowSolution (SmiScenarioIndex ns, int *length)
void setOsiSolverHandle (OsiSolverInterface &osi)
void setOsiSolverHandle (OsiSolverInterface *osi)
OsiSolverInterfacegetOsiSolverInterface ()
void releaseSolver ()
 SmiScnModel ()
 ~SmiScnModel ()
void addNode (SmiScnNode *node)
Read SMPS files.

There should be three files: {name}.

[core, time, stoch]. If you have different extension conventions, then you can hack the method yourself. The files can be compressed. The object that reads the files is derived from CoinMpsIO.

The optional argument SmiCoreCombineRule allows user to pass in a class to override the default methods to combine core and stochastic data.



int readSmps (const char *name, SmiCoreCombineRule *r=NULL)
Direct methods.

Direct methods require the user to create instances of Core data and Scenario data.

Currently, the dimension of the core nodes determines the dimension of the scenario nodes, but this is something that could easily be changed.



void processDiscreteDistributionIntoScenarios (SmiDiscreteDistribution *s, bool test=false)
 generate scenarios from discrete distribution
SmiScenarioIndex generateScenario (SmiCoreData *core, CoinPackedMatrix *matrix, CoinPackedVector *dclo, CoinPackedVector *dcup, CoinPackedVector *dobj, CoinPackedVector *drlo, CoinPackedVector *drup, SmiStageIndex branch, SmiScenarioIndex anc, double prob, SmiCoreCombineRule *r=SmiCoreCombineReplace::Instance())
 generate scenario with ancestor/branch node identification
SmiScenarioIndex generateScenario (SmiCoreData *core, CoinPackedMatrix *matrix, CoinPackedVector *dclo, CoinPackedVector *dcup, CoinPackedVector *dobj, CoinPackedVector *drlo, CoinPackedVector *drup, vector< int >labels, double prob, SmiCoreCombineRule *r=SmiCoreCombineReplace::Instance())
 generate scenario with labels information
loadOsiSolverData

Loads deterministic equivalent model into internal osi data structures and return handle.

Note: this uses a callback class SmiCoreCombineRule to decide how to combine the core and stochastic data. The user can override the default methods when the scenario is generated (see SmiScnModel::generateScenario) or when SMPS files are processed (see SmiScnModel::readSmps).



OsiSolverInterfaceloadOsiSolverData ()

Private Attributes

CoinMessageHandlerhandler_
SmiMessagemessages_
OsiSolverInterfaceosiStoch_
int nrow_
int ncol_
int nels_
int nels_max
double * drlo_
double * drup_
double * dobj_
double * dclo_
double * dcup_
CoinPackedMatrixmatrix_
double * dels_
int * indx_
int * rstrt_
int minrow_
bool solve_synch_
double totalProb_
SmiCoreDatacore_
SmiScenarioTree< SmiScnNode * > smiTree_

Friends

void SmiScnModelDiscreteUnitTest ()

Detailed Description

SmiScnModel: COIN-SMI Scenario Model Class.

Concrete class for generating scenario stochastic linear programs.

This class implements the Scenarios format of the Stochastic MPS modeling system (TODO: web pointer). Core data and Scenarios data can be passed using COIN/OSI structures, or can be read from SMPS formatted files.

Typical driver fragment looks like this

        SmiScnModel smi;
        smi.readSmps("app0110R");
        smi.setOsiSolverHandle(new OsiClpSolverInterface());
        OsiSolverInterface *osiStoch = smi.loadOsiSolverData();
        osiStoch->initialSolve();

The setOsiSolverHandle method allows the user to pass in any OSI compatible solver.

Definition at line 53 of file SmiScnModel.hpp.


Constructor & Destructor Documentation

SmiScnModel::SmiScnModel (  )  [inline]

Definition at line 179 of file SmiScnModel.hpp.

SmiScnModel::~SmiScnModel (  ) 

Member Function Documentation

int SmiScnModel::readSmps ( const char *  name,
SmiCoreCombineRule r = NULL 
)
void SmiScnModel::processDiscreteDistributionIntoScenarios ( SmiDiscreteDistribution s,
bool  test = false 
)

generate scenarios from discrete distribution

SmiScenarioIndex SmiScnModel::generateScenario ( SmiCoreData core,
CoinPackedMatrix matrix,
CoinPackedVector dclo,
CoinPackedVector dcup,
CoinPackedVector dobj,
CoinPackedVector drlo,
CoinPackedVector drup,
SmiStageIndex  branch,
SmiScenarioIndex  anc,
double  prob,
SmiCoreCombineRule r = SmiCoreCombineReplace::Instance() 
)

generate scenario with ancestor/branch node identification

Core argument must be supplied. Data values combine with corresponding core values, if found, or creates them if not.

Scenario nodes need to have same dimensions as core nodes.

Data field arguments can be NULL, or empty.

branch, anc, arguments must be supplied. These identify the branching node according to the Stochastic MPS standard.

SmiScenarioIndex SmiScnModel::generateScenario ( SmiCoreData core,
CoinPackedMatrix matrix,
CoinPackedVector dclo,
CoinPackedVector dcup,
CoinPackedVector dobj,
CoinPackedVector drlo,
CoinPackedVector drup,
vector< int >  labels,
double  prob,
SmiCoreCombineRule r = SmiCoreCombineReplace::Instance() 
)

generate scenario with labels information

Core argument must be supplied. Data values combine with corresponding core values, if found, or creates them if not.

Scenario nodes need to have same dimensions as core nodes.

Data field arguments can be NULL, or empty.

Labels are passed as vector<int> array. Adds new path using labels to find branching node. The depth (root to leaf) of new path is labels.size().

OsiSolverInterface* SmiScnModel::loadOsiSolverData (  ) 
SmiScenarioIndex SmiScnModel::getNumScenarios (  )  [inline]

Definition at line 153 of file SmiScnModel.hpp.

double SmiScnModel::getScenarioProb ( SmiScenarioIndex  ns  ) 
SmiScnNode* SmiScnModel::getLeafNode ( SmiScenarioIndex  i  )  [inline]

Definition at line 155 of file SmiScnModel.hpp.

SmiScnNode* SmiScnModel::getRootNode (  )  [inline]

Definition at line 156 of file SmiScnModel.hpp.

double SmiScnModel::getObjectiveValue ( SmiScenarioIndex  ns  ) 
double* SmiScnModel::getColSolution ( SmiScenarioIndex  ns,
int *  length 
)
double* SmiScnModel::getRowSolution ( SmiScenarioIndex  ns,
int *  length 
)
void SmiScnModel::setOsiSolverHandle ( OsiSolverInterface osi  )  [inline]

Definition at line 165 of file SmiScnModel.hpp.

void SmiScnModel::setOsiSolverHandle ( OsiSolverInterface osi  )  [inline]

Definition at line 169 of file SmiScnModel.hpp.

OsiSolverInterface* SmiScnModel::getOsiSolverInterface (  ) 
void SmiScnModel::releaseSolver (  )  [inline]

Definition at line 175 of file SmiScnModel.hpp.

void SmiScnModel::addNode ( SmiScnNode node  ) 

Friends And Related Function Documentation

void SmiScnModelDiscreteUnitTest (  )  [friend]

Member Data Documentation

Definition at line 191 of file SmiScnModel.hpp.

Definition at line 192 of file SmiScnModel.hpp.

Definition at line 195 of file SmiScnModel.hpp.

int SmiScnModel::nrow_ [private]

Definition at line 197 of file SmiScnModel.hpp.

int SmiScnModel::ncol_ [private]

Definition at line 198 of file SmiScnModel.hpp.

int SmiScnModel::nels_ [private]

Definition at line 199 of file SmiScnModel.hpp.

int SmiScnModel::nels_max [private]

Definition at line 200 of file SmiScnModel.hpp.

double* SmiScnModel::drlo_ [private]

Definition at line 202 of file SmiScnModel.hpp.

double* SmiScnModel::drup_ [private]

Definition at line 203 of file SmiScnModel.hpp.

double* SmiScnModel::dobj_ [private]

Definition at line 204 of file SmiScnModel.hpp.

double* SmiScnModel::dclo_ [private]

Definition at line 205 of file SmiScnModel.hpp.

double* SmiScnModel::dcup_ [private]

Definition at line 206 of file SmiScnModel.hpp.

Definition at line 207 of file SmiScnModel.hpp.

double* SmiScnModel::dels_ [private]

Definition at line 208 of file SmiScnModel.hpp.

int* SmiScnModel::indx_ [private]

Definition at line 209 of file SmiScnModel.hpp.

int* SmiScnModel::rstrt_ [private]

Definition at line 210 of file SmiScnModel.hpp.

int SmiScnModel::minrow_ [private]

Definition at line 214 of file SmiScnModel.hpp.

bool SmiScnModel::solve_synch_ [private]

Definition at line 216 of file SmiScnModel.hpp.

double SmiScnModel::totalProb_ [private]

Definition at line 218 of file SmiScnModel.hpp.

Definition at line 220 of file SmiScnModel.hpp.

Definition at line 222 of file SmiScnModel.hpp.


The documentation for this class was generated from the following file:

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1