Base class for scenario-trees. More...
#include <scen-tree_struct.hpp>
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... | |
Base class for scenario-trees.
Definition at line 28 of file scen-tree_struct.hpp.
|
inline |
Constructor.
Definition at line 37 of file scen-tree_struct.hpp.
|
inlinevirtual |
Destructor.
Definition at line 41 of file scen-tree_struct.hpp.
|
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.
|
inline |
Get the number of stages.
Definition at line 50 of file scen-tree_struct.hpp.
|
inline |
Get the number of scenarios = the number of leaves.
Definition at line 53 of file scen-tree_struct.hpp.
|
pure virtual |
Get probability of a given scenarios.
Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.
|
pure virtual |
Get the vector of nodes of a given scenarios.
Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.
|
inline |
Get the vector of nodes of a core scenario - just a wrapper.
Definition at line 62 of file scen-tree_struct.hpp.
|
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.
[out] | scen | number of the new scenario |
[out] | parentScen | parent scenario |
[out] | branchStage | stage where scen diverges from parentScen |
[out] | prob | probability of the new scenario |
Implemented in FlopSmiEx::TwoStageTree, and FlopSmiEx::BinTreeStruct.
|
protected |
number of scenarios
Definition at line 30 of file scen-tree_struct.hpp.
|
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.