# FlopSmiEx::TwoStageTree Class Reference

Class for a 2-stage tree (bush). More...

`#include <scen-tree_struct.hpp>`

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

List of all members.

## Public Member Functions
| TwoStageTree (int const nScens)
| Constructor.
| ~TwoStageTree ()
| Destructor.
int | get_parent_node (int n) const
| Get the parent of a given node.
void | set_scen_prob (double *const pr)
| Set scenario probabilities (if non-equiprobable).
double | get_scen_prob (int const sc) const
| Get probability of a given scenarios.
int const * | get_scen_nodes (int const sc)
| Get the vector of nodes of a given scenarios.
int const * | get_next_scen (int &scen, int &parentScen, int &branchStage, double &prob)
| Get vector of nodes of a next scenario in the list.
## Public Attributes
int | nmbStages
| number of stages, again counted from zero
## Protected Member Functions
int | set_scen_nodes (int const sc)
| Fill `scenNodeNmb` with nodes of a given scenarios.
## Protected Attributes
int | nmbScens
| number of scenarios
vector< int > | leaves
| list of leaf nodes - they define scenarios
vector< double > | probs
| scenario probabilities
int | scenNodeNmb [2]
| vector of nodes of a scenario - for internal use
int | nextScen
| next scenario to be processed by gen_next_scen

## Detailed Description

Class for a 2-stage tree (bush).

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

## Constructor & Destructor Documentation

FlopSmiEx::TwoStageTree::TwoStageTree | ( | int const | nScens | ) |

Constructor.

FlopSmiEx::TwoStageTree::~TwoStageTree | ( |  | ) | `[inline]`

Destructor.

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

## Member Function Documentation

int FlopSmiEx::TwoStageTree::set_scen_nodes | ( | int const | sc | ) | `[inline, protected]`

Fill `scenNodeNmb` with nodes of a given scenarios.

Returns:
  first stage when the scen. differs from current `scenNodeNmb`

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

int FlopSmiEx::TwoStageTree::get_parent_node | ( | int | n | ) | const`[inline, virtual]`

Get the parent of a given node.

Implements FlopSmiEx::ScenTreeStruct.

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

void FlopSmiEx::TwoStageTree::set_scen_prob | ( | double *const | pr | ) |

Set scenario probabilities (if non-equiprobable).

double FlopSmiEx::TwoStageTree::get_scen_prob | ( | int const | sc | ) | const`[inline, virtual]`

Get probability of a given scenarios.

Implements FlopSmiEx::ScenTreeStruct.

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

int const* FlopSmiEx::TwoStageTree::get_scen_nodes | ( | int const | sc | ) | `[inline, virtual]`

Get the vector of nodes of a given scenarios.

Implements FlopSmiEx::ScenTreeStruct.

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

int const* FlopSmiEx::TwoStageTree::get_next_scen | ( | int & | scen,
|  | int & | parentScen,
|  | int & | branchStage,
|  | double & | prob |
| ) |  |  | `[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

Implements FlopSmiEx::ScenTreeStruct.

## Member Data Documentation

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

number of scenarios

Reimplemented from FlopSmiEx::ScenTreeStruct.

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

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

list of leaf nodes - they define scenarios

Reimplemented from FlopSmiEx::ScenTreeStruct.

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

vector<double> FlopSmiEx::TwoStageTree::probs`[protected]`

scenario probabilities

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

int FlopSmiEx::TwoStageTree::scenNodeNmb[2]`[protected]`

vector of nodes of a scenario - for internal use

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

int FlopSmiEx::TwoStageTree::nextScen`[protected]`

next scenario to be processed by gen_next_scen

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

int FlopSmiEx::TwoStageTree::nmbStages

number of stages, again counted from zero

Reimplemented from FlopSmiEx::ScenTreeStruct.

Definition at line 134 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