# FlopSmiEx::CoreNodeBase::SP_constraint Class Reference

class for a stochastic (node-based) constraint More...

`#include <corenode_base.hpp>`

Inheritance diagram for FlopSmiEx::CoreNodeBase::SP_constraint:
[legend]
Collaboration diagram for FlopSmiEx::CoreNodeBase::SP_constraint:
[legend]

List of all members.

## Public Member Functions
| SP_constraint (MP_set const &s1=MP_set::getEmpty())
## Private Attributes
CoreNodeBase * | p2node
| pointer to the node the constr. belongs to
int | constrIndx

## Detailed Description

class for a stochastic (node-based) constraint

Basically, this is identical to the MP_constraint, but it registers itself with the scenario-tree node and adds a new `value()` method.

So far, we implement only variables indexed on simple one-dimensional sets.

Note that constraints are different from variables, since we cannot get a pointer to one constraint in the set (one row). This is because if we have an `MP_constraint` `C`, then

- `C(i)` sets the internal indices to point to the right row and returns a pointer to `C` (as pointer to `C(i)` does not exist); by default, the internal indices point to the first row.
- `C()` returns the row of the currently selected row, based on the values of the internal indices; this is why `C(i)`() returns the row corresponding to the i-th constraint!
- `C.row_number(i)` is the same as ``(), but with bound checking. This implies that even if we put pointers/references to `C(i)` into `all_constraints`, we get repeated pointers to the same object. One way around this is to detect this when we process the list, but that would mean an extra burden on the user. Instead, we add a vector `constr_row_offsets` of offsets that are added to the rows.

Definition at line 170 of file corenode_base.hpp.

## Constructor & Destructor Documentation

FlopSmiEx::CoreNodeBase::SP_constraint::SP_constraint | ( | MP_set const & | s1 = `MP_set::getEmpty()` | ) | `[inline]`

Definition at line 175 of file corenode_base.hpp.

## Member Data Documentation

CoreNodeBase* FlopSmiEx::CoreNodeBase::SP_constraint::p2node`[private]`

pointer to the node the constr. belongs to

Definition at line 172 of file corenode_base.hpp.

int FlopSmiEx::CoreNodeBase::SP_constraint::constrIndx`[private]`

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