# FlopSmiEx::CoreNodeBase Class Reference

Problem-independent base class for an LP/MIP model in one node of a tree. More...

`#include <corenode_base.hpp>`

Collaboration diagram for FlopSmiEx::CoreNodeBase:
[legend]

List of all members.

## Classes
class | SP_constraint
| class for a stochastic (node-based) constraint More...
class | SP_variable
| class for a stochastic (node-based) variable More...
## Public Member Functions
| CoreNodeBase (CoreNodeBase *p2pred, int nodeStage=-1)
| constructor
virtual | ~CoreNodeBase ()
| destructor
void | set_var_values (double const *p2values)
| point a given pointer to the vector of scenario solution values
MP_expression & | get_obj_func ()
| make and return the recursive objective function
## Public Attributes
CoreNodeBase * | p2parent
| pointer to the node's parent
CoreNodeBase * | p2child
| pointer to the node's child
int | stage
| stage of the node (used only for reporting)
references to variables and constraints
vector< VariableRef const * > | all_variables
| The idea is to have "meta objects" with all variables and constraints in a node.
vector< MP_constraint * > | all_constraints
| list of ref. to constraints
vector< int > | constr_row_offsets
| list of row offsets
## Protected Member Functions
void | make_obj_func_rec ()
| create the objective function expression, recursively for all children
## Protected Attributes
MP_expression | objFuncNode
| objective function in this node
MP_expression | objFuncRec
| objective function in this node and below
## Static Protected Attributes
static CoreNodeBase * | p2activeNode
| static pointer to the current CoreNodeBase object
static double const * | p2varValues
| vector of scenario solution values, for use in `SP_variable`

## Detailed Description

Problem-independent base class for an LP/MIP model in one node of a tree.

Definition at line 36 of file corenode_base.hpp.

## Constructor & Destructor Documentation

FlopSmiEx::CoreNodeBase::CoreNodeBase | ( | CoreNodeBase * | p2pred,
|  | int | nodeStage = `-1` |
| ) |  |  | `[inline]`

constructor

Definition at line 62 of file corenode_base.hpp.

virtual FlopSmiEx::CoreNodeBase::~CoreNodeBase | ( |  | ) | `[inline, virtual]`

destructor

Definition at line 72 of file corenode_base.hpp.

## Member Function Documentation

void FlopSmiEx::CoreNodeBase::set_var_values | ( | double const * | p2values | ) | `[inline]`

point a given pointer to the vector of scenario solution values

Definition at line 91 of file corenode_base.hpp.

MP_expression& FlopSmiEx::CoreNodeBase::get_obj_func | ( |  | ) | `[inline]`

make and return the recursive objective function

This probably makes sense only in root nodes.

Definition at line 97 of file corenode_base.hpp.

void FlopSmiEx::CoreNodeBase::make_obj_func_rec | ( |  | ) | `[protected]`

create the objective function expression, recursively for all children

This function is protected, as it only makes sense to call it in the root, to create the complete objective function.

## Member Data Documentation

CoreNodeBase* FlopSmiEx::CoreNodeBase::p2activeNode`[static, protected]`

static pointer to the current CoreNodeBase object

Each time a variable or constraint is constructed, it should register itself with the node it belongs to. However, this means that they need a pointer to the node object. The easiest option is to pass a pointer to the constructor, but this would clutter the code. Instead, we declare this static variable and let the `CoreNodeBase's` constructor set it to itself. Since every node calls the constructor of the base class first, `p2activeNode` will point to the correct node at the time the node's variables and constraints get constructed.

Definition at line 47 of file corenode_base.hpp.

double const* FlopSmiEx::CoreNodeBase::p2varValues`[static, protected]`

vector of scenario solution values, for use in `SP_variable`

The `value()` member of `SP_variable` needs to have access to scenario solution values. One option would be to pass a pointer, but this would make the function a bit more difficult to read. Instead, we point this static pointer to the solution and then use this one in `value()` instead.

Definition at line 55 of file corenode_base.hpp.

MP_expression FlopSmiEx::CoreNodeBase::objFuncNode`[protected]`

objective function in this node

Definition at line 57 of file corenode_base.hpp.

MP_expression FlopSmiEx::CoreNodeBase::objFuncRec`[protected]`

objective function in this node and below

Definition at line 58 of file corenode_base.hpp.

CoreNodeBase* FlopSmiEx::CoreNodeBase::p2parent

pointer to the node's parent

Definition at line 74 of file corenode_base.hpp.

CoreNodeBase* FlopSmiEx::CoreNodeBase::p2child

pointer to the node's child

Definition at line 75 of file corenode_base.hpp.

int FlopSmiEx::CoreNodeBase::stage

stage of the node (used only for reporting)

Definition at line 76 of file corenode_base.hpp.

vector<VariableRef const *> FlopSmiEx::CoreNodeBase::all_variables

The idea is to have "meta objects" with all variables and constraints in a node.

This is important in creation of the Smi object, where we have to associate the nodes variables and constraints to stages. Without these new objects, we would have to access all the derived classes independently, cluttering the code. list of ref. to variables

Definition at line 85 of file corenode_base.hpp.

vector<MP_constraint *> FlopSmiEx::CoreNodeBase::all_constraints

list of ref. to constraints

Definition at line 86 of file corenode_base.hpp.

vector<int> FlopSmiEx::CoreNodeBase::constr_row_offsets

list of row offsets

Definition at line 87 of file corenode_base.hpp.

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

- /home/coin/svn-release/Smi-0.93.1/Smi/flopcpp_examples/corenode_base.hpp