Public Member Functions | Public Attributes | Protected Attributes | List of all members
FlopSmiEx::ScenTreeStruct Class Referenceabstract

Base class for scenario-trees. More...

#include <scen-tree_struct.hpp>

Inheritance diagram for FlopSmiEx::ScenTreeStruct:
Inheritance graph
[legend]
Collaboration diagram for FlopSmiEx::ScenTreeStruct:
Collaboration graph
[legend]

Public Member Functions

 ScenTreeStruct (int const nScens, int const nStages=0)
 Constructor. More...
 
virtual ~ScenTreeStruct ()
 Destructor. More...
 
virtual int get_parent_node (int n) const =0
 Get the parent of a given node. More...
 
int get_nmb_stages () const
 Get the number of stages. More...
 
int get_nmb_scens () const
 Get the number of scenarios = the number of leaves. More...
 
virtual double get_scen_prob (int const sc) const =0
 Get probability of a given scenarios. More...
 
virtual int const * get_scen_nodes (int const sc)=0
 Get the vector of nodes of a given scenarios. More...
 
int const * get_core_scen ()
 Get the vector of nodes of a core scenario - just a wrapper. More...
 
virtual int const * get_next_scen (int &scen, int &parentScen, int &branchStage, double &prob)=0
 Get vector of nodes of a next scenario in the list. More...
 

Public Attributes

int nmbStages
 number of stages, again counted from zero More...
 

Protected Attributes

int nmbScens
 number of scenarios More...
 
vector< int > leaves
 list of leaf nodes - they define scenarios More...
 

Detailed Description

Base class for scenario-trees.

Definition at line 28 of file scen-tree_struct.hpp.

Constructor & Destructor Documentation

FlopSmiEx::ScenTreeStruct::ScenTreeStruct ( int const  nScens,
int const  nStages = 0 
)
inline

Constructor.

Definition at line 37 of file scen-tree_struct.hpp.

virtual FlopSmiEx::ScenTreeStruct::~ScenTreeStruct ( )
inlinevirtual

Destructor.

Definition at line 41 of file scen-tree_struct.hpp.

Member Function Documentation

virtual int FlopSmiEx::ScenTreeStruct::get_parent_node ( int  n) const
pure virtual

Get the parent of a given node.

In a general case, this would be given by a table, for balanced trees one can use a simple formula. The question is what to do with the root: should the function return 0, -1, or throw an exception?

Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.

int FlopSmiEx::ScenTreeStruct::get_nmb_stages ( ) const
inline

Get the number of stages.

Definition at line 50 of file scen-tree_struct.hpp.

int FlopSmiEx::ScenTreeStruct::get_nmb_scens ( ) const
inline

Get the number of scenarios = the number of leaves.

Definition at line 53 of file scen-tree_struct.hpp.

virtual double FlopSmiEx::ScenTreeStruct::get_scen_prob ( int const  sc) const
pure virtual

Get probability of a given scenarios.

Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.

virtual int const* FlopSmiEx::ScenTreeStruct::get_scen_nodes ( int const  sc)
pure virtual

Get the vector of nodes of a given scenarios.

Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.

int const* FlopSmiEx::ScenTreeStruct::get_core_scen ( )
inline

Get the vector of nodes of a core scenario - just a wrapper.

Definition at line 62 of file scen-tree_struct.hpp.

virtual int const* FlopSmiEx::ScenTreeStruct::get_next_scen ( int &  scen,
int &  parentScen,
int &  branchStage,
double &  prob 
)
pure virtual

Get vector of nodes of a next scenario in the list.

This assumes that the class itself will keep track of the calls and hence knows what is the next scenario. This is used for Smi, when each scenario is described as a difference from a given parent scenario.

Parameters
[out]scennumber of the new scenario
[out]parentScenparent scenario
[out]branchStagestage where scen diverges from parentScen
[out]probprobability of the new scenario
Returns
vector of node indices of the new scen, NULL at the end

Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.

Member Data Documentation

int FlopSmiEx::ScenTreeStruct::nmbScens
protected

number of scenarios

Definition at line 30 of file scen-tree_struct.hpp.

vector<int> FlopSmiEx::ScenTreeStruct::leaves
protected

list of leaf nodes - they define scenarios

Definition at line 31 of file scen-tree_struct.hpp.

int FlopSmiEx::ScenTreeStruct::nmbStages

number of stages, again counted from zero

Definition at line 34 of file scen-tree_struct.hpp.


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