20 #ifndef CORENODE_BASE_HPP
21 #define CORENODE_BASE_HPP
30 using namespace flopc;
63 : p2parent(p2pred), p2child(NULL), stage(nodeStage)
65 if (p2parent != NULL) {
66 assert (p2parent->p2child == NULL &&
"only one child per node in Core");
67 p2parent->p2child =
this;
84 vector<VariableRef const *> all_variables;
92 p2varValues = p2values;
98 if (p2parent != NULL) {
99 cerr <<
"Warning: get_obj_func called from a non-root node!" << endl;
119 varIndx(static_cast<int>(p2node->all_variables.size()))
122 cout <<
"Stage " << p2node->stage <<
": adding SP_variable with "
123 << s1.
size() * s2.size() <<
" element(s), starting at col "
126 for (
int i1 = 0; i1 < s1.size(); i1++) {
127 for (
int i2 = 0; i2 < s2.size(); i2++) {
128 p2node->all_variables.push_back(& this->
operator()(i1,i2));
141 double value(
int const i1 = 0,
int const i2 = 0)
const {
143 &&
"variable values must be set before they are accessed!");
177 constrIndx(static_cast<int>(p2node->all_constraints.size()))
180 cout <<
"Stage " << p2node->stage <<
": adding SP_constr. with "
181 << s1.
size() <<
" element(s), starting at row " << constrIndx
184 for (
int i1 = 0; i1 < s1.size(); i1++) {
185 p2node->all_constraints.push_back(
this);
186 p2node->constr_row_offsets.push_back(i1);
196 void make_obj_func_rec();
Problem-independent base class for an LP/MIP model in one node of a tree.
MP_expression objFuncRec
objective function in this node and below
vector< MP_constraint * > all_constraints
list of ref. to constraints
CoreNodeBase(CoreNodeBase *p2pred, int nodeStage=-1)
constructor
class for a stochastic (node-based) variable
vector< int > constr_row_offsets
list of row offsets
static MP_set & getEmpty()
gets the distinct 'empty' MP_set.
Semantic representation of a linear constraint.
MP_expression & get_obj_func()
make and return the recursive objective function
void set_var_values(double const *p2values)
point a given pointer to the vector of scenario solution values
SP_variable(MP_set const &s1=MP_set::getEmpty(), MP_set const &s2=MP_set::getEmpty())
static CoreNodeBase * p2activeNode
static pointer to the current CoreNodeBase object
int varIndx
index of the 1st el. in the vector of node's variables
CoreNodeBase * p2node
pointer to the node the constr. belongs to
class for a stochastic (node-based) constraint
Representation of a set for indexing into some other construct.
virtual ~CoreNodeBase()
destructor
Symantic representation of a variable.
double value(int const i1=0, int const i2=0) const
get the value of a given variable
MP_expression objFuncNode
objective function in this node
static double const * p2varValues
vector of scenario solution values, for use in SP_variable
CoreNodeBase * p2node
pointer to the node the var belongs to
CoreNodeBase * p2child
pointer to the node's child
Symbolic representation of a linear expression.
int stage
stage of the node (used only for reporting)
CoreNodeBase * p2parent
pointer to the node's parent