# FlopSmiEx::ScenTreeStruct Class Reference

Base class for scenario-trees. More...

`#include <scen-tree_struct.hpp>`

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

List of all members.

## Public Member Functions
| ScenTreeStruct (int const nScens, int const nStages=0)
| Constructor.
virtual | ~ScenTreeStruct ()
| Destructor.
virtual int | get_parent_node (int n) const =0
| Get the parent of a given node.
int | get_nmb_stages () const
| Get the number of stages.
int | get_nmb_scens () const
| Get the number of scenarios = the number of leaves.
virtual double | get_scen_prob (int const sc) const =0
| Get probability of a given scenarios.
virtual int const * | get_scen_nodes (int const sc)=0
| Get the vector of nodes of a given scenarios.
int const * | get_core_scen ()
| Get the vector of nodes of a core scenario - just a wrapper.
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.
## Public Attributes
int | nmbStages
| number of stages, again counted from zero
## Protected Attributes
int | nmbScens
| number of scenarios
vector< int > | leaves
| list of leaf nodes - they define scenarios

## 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 | ( |  | ) | `[inline, virtual]`

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::BinTreeStruct, and FlopSmiEx::TwoStageTree.

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::BinTreeStruct, and FlopSmiEx::TwoStageTree.

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::BinTreeStruct, and FlopSmiEx::TwoStageTree.

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]` | 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

Returns:
  vector of node indices of the new scen, NULL at the end

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

## Member Data Documentation

int FlopSmiEx::ScenTreeStruct::nmbScens`[protected]`

number of scenarios

Reimplemented in FlopSmiEx::TwoStageTree.

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

vector<int> FlopSmiEx::ScenTreeStruct::leaves`[protected]`

list of leaf nodes - they define scenarios

Reimplemented in FlopSmiEx::TwoStageTree.

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

int FlopSmiEx::ScenTreeStruct::nmbStages

number of stages, again counted from zero

Reimplemented in FlopSmiEx::TwoStageTree.

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

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

- /home/coin/svn-release/Smi-0.93.1/Smi/flopcpp_examples/scen-tree_struct.hpp