#include <expression.hpp>
Inheritance diagram for expression:
Public Member Functions | |
expression () | |
Constructor. | |
expression (const expression &e, Domain *d=NULL) | |
Copy constructor. | |
virtual | ~expression () |
Destructor. | |
virtual expression * | clone (Domain *d=NULL) const |
Cloning method. | |
virtual int | Index () const |
Return index of variable (only valid for exprVar and exprAux). | |
virtual int | nArgs () const |
return number of arguments (when applicable, that is, with N-ary functions) | |
virtual expression ** | ArgList () const |
return arglist (when applicable, that is, with N-ary functions) | |
virtual void | ArgList (expression **al) |
set arglist (used in deleting nodes without deleting children) | |
virtual expression * | Argument () const |
return argument (when applicable, i.e., with univariate functions) | |
virtual expression ** | ArgPtr () |
return pointer to argument (when applicable, i.e., with univariate functions) | |
virtual enum nodeType | Type () const |
node type | |
virtual expression * | Image () const |
return pointer to corresponding expression (for auxiliary variables only) | |
virtual void | Image (expression *image) |
set expression associated with this auxiliary variable (for compatibility with exprAux) | |
virtual CouNumber | Value () const |
value (empty) | |
virtual const expression * | Original () const |
If this is an exprClone of a exprClone of an expr???, point to the original expr??? instead of an exprClone -- improve computing efficiency. | |
virtual void | print (std::ostream &s=std::cout, bool=false) const |
descend into auxiliaries' image? | |
virtual CouNumber | operator() ()=0 |
null function for evaluating the expression | |
virtual CouNumber | gradientNorm (const double *x) |
return l-2 norm of gradient at given point | |
virtual expression * | differentiate (int) |
differentiation | |
virtual int | dependsOn (int *ind, int n, enum dig_type type=STOP_AT_AUX) |
dependence on variable set: return cardinality of subset of the set of indices in first argument which occur in expression. | |
int | dependsOn (int singleton, enum dig_type type=STOP_AT_AUX) |
version with one index only | |
virtual int | DepList (std::set< int > &deplist, enum dig_type type=ORIG_ONLY) |
fill std::set with indices of variables on which this expression depends. | |
virtual expression * | simplify () |
simplify expression (useful for derivatives) | |
virtual int | Linearity () |
get a measure of "how linear" the expression is (see CouenneTypes.h) | |
virtual bool | isDefinedInteger () |
is this expression defined as an integer? | |
virtual bool | isInteger () |
is this expression integer? | |
virtual void | getBounds (expression *&, expression *&) |
Get lower and upper bound of an expression (if any). | |
virtual void | getBounds (CouNumber &, CouNumber &) |
Get lower and upper bound of an expression (if any) -- real values. | |
virtual exprAux * | standardize (CouenneProblem *p, bool addAux=true) |
Create standard form of this expression, by:. | |
virtual void | generateCuts (expression *w, const OsiSolverInterface &si, OsiCuts &cs, const CouenneCutGenerator *cg, t_chg_bounds *chg=NULL, int wind=-1, CouNumber lb=-COUENNE_INFINITY, CouNumber ub=COUENNE_INFINITY) |
generate convexification cut for constraint w = this | |
virtual enum expr_type | code () |
return integer for comparing expressions (used to recognize common expression) | |
virtual enum convexity | convexity () const |
either CONVEX, CONCAVE, AFFINE, or NONCONVEX | |
virtual int | compare (expression &) |
compare expressions | |
virtual int | compare (exprCopy &) |
compare copies of expressions | |
virtual int | rank () |
used in rank-based branching variable choice: original variables have rank 1; auxiliary w=f(x) has rank r(w) = r(x)+1; finally, auxiliary w=f(x1,x2. | |
virtual bool | impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *) |
does a backward implied bound processing on every expression, including exprSums although already done by Clp (useful when repeated within Couenne). | |
virtual int | Multiplicity () |
multiplicity of a variable | |
virtual CouNumber | selectBranch (const CouenneObject *obj, const OsiBranchingInformation *info, expression *&var, double *&brpts, double *&brDist, int &way) |
set up branching object by evaluating many branching points for each expression's arguments. | |
virtual void | replace (exprVar *, exprVar *) |
replace expression with another | |
virtual void | fillDepSet (std::set< DepNode *, compNode > *, DepGraph *) |
update dependence set with index of variables on which this expression depends | |
virtual void | linkDomain (Domain *d) |
empty function to update domain pointer | |
virtual void | realign (const CouenneProblem *p) |
empty function to redirect variables to proper variable vector | |
virtual bool | isBijective () const |
indicating if function is monotonically increasing | |
virtual CouNumber | inverse (expression *vardep) const |
compute the inverse function | |
virtual void | closestFeasible (expression *varind, expression *vardep, CouNumber &left, CouNumber &right) const |
closest feasible points in function in both directions | |
virtual bool | isCuttable (CouenneProblem *problem, int index) const |
can this expression be further linearized or are we on its concave ("bad") side | |
virtual bool | isaCopy () const |
return true if this is a copy of something (i.e. an exprCopy) | |
virtual expression * | Copy () const |
return copy of this expression (only makes sense in exprCopy) |
An empty expression class with no type or operator() from which all other expression classes (for constants, variables, and operators) are derived.
Definition at line 46 of file expression.hpp.
expression::expression | ( | ) | [inline] |
expression::expression | ( | const expression & | e, | |
Domain * | d = NULL | |||
) | [inline] |
Copy constructor.
Pass pointer to variable vector when generating new problem, whose set of variables is equivalent but may be changed or whose value is independent.
Definition at line 56 of file expression.hpp.
virtual expression::~expression | ( | ) | [inline, virtual] |
virtual expression* expression::clone | ( | Domain * | d = NULL |
) | const [inline, virtual] |
Cloning method.
Reimplemented in exprAux, exprLowerBound, exprUpperBound, exprClone, exprConst, exprCopy, exprIVar, exprStore, exprVar, exprLBCos, exprUBCos, exprLBDiv, exprUBDiv, exprLBMul, exprUBMul, exprLBQuad, exprUBQuad, exprLBSin, exprUBSin, exprAbs, exprCos, exprDiv, exprExp, exprGroup, exprInv, exprLog, exprMax, exprMin, exprMul, exprOpp, exprPow, exprQuad, exprSin, exprSub, and exprSum.
Definition at line 62 of file expression.hpp.
Referenced by exprOp::clonearglist().
virtual int expression::Index | ( | ) | const [inline, virtual] |
Return index of variable (only valid for exprVar and exprAux).
Reimplemented in exprCopy, and exprVar.
Definition at line 66 of file expression.hpp.
Referenced by exprQuad::alphaConvexify(), exprMul::balancedMul(), exprMul::closestFeasible(), exprDiv::closestFeasible(), exprQuad::compare(), exprGroup::compare(), compare(), exprQuad::computeQBound(), exprQuad::computeQuadFiniteBound(), exprQuad::differentiate(), exprGroup::differentiate(), exprGroup::exprGroup(), exprQuad::exprQuad(), exprQuad::fillDepSet(), exprGroup::fillDepSet(), exprConst::generateCuts(), exprSum::generateCuts(), exprSub::generateCuts(), exprPow::generateCuts(), exprOpp::generateCuts(), exprMul::generateCuts(), exprLog::generateCuts(), exprInv::generateCuts(), exprGroup::generateCuts(), exprExp::generateCuts(), exprDiv::generateCuts(), exprAbs::generateCuts(), exprGroup::getBounds(), exprSin::gradientNorm(), exprQuad::gradientNorm(), exprPow::gradientNorm(), exprOpp::gradientNorm(), exprMul::gradientNorm(), exprLog::gradientNorm(), exprInv::gradientNorm(), exprExp::gradientNorm(), exprDiv::gradientNorm(), exprCos::gradientNorm(), exprAbs::gradientNorm(), exprSub::impliedBound(), exprSin::impliedBound(), exprOpp::impliedBound(), exprLog::impliedBound(), exprInv::impliedBound(), exprExp::impliedBound(), exprCos::impliedBound(), exprAbs::impliedBound(), exprSum::impliedBound(), exprQuad::impliedBound(), exprPow::impliedBound(), exprMul::impliedBound(), exprDiv::impliedBound(), exprPow::isCuttable(), exprLog::isCuttable(), exprInv::isCuttable(), exprExp::isCuttable(), exprAbs::isCuttable(), exprQuad::operator()(), exprQuad::print(), exprQuad::quadCuts(), exprQuad::realign(), exprGroup::realign(), exprQuad::replace(), exprGroup::replace(), exprUnary::replace(), exprOp::replace(), exprQuad::selectBranch(), exprPow::selectBranch(), exprMul::selectBranch(), exprLog::selectBranch(), exprInv::selectBranch(), exprExp::selectBranch(), exprDiv::selectBranch(), exprAbs::selectBranch(), and exprSum::standardize().
virtual int expression::nArgs | ( | ) | const [inline, virtual] |
return number of arguments (when applicable, that is, with N-ary functions)
Reimplemented in exprCopy, exprOp, and exprUnary.
Definition at line 70 of file expression.hpp.
Referenced by exprAux::generateCuts().
virtual expression** expression::ArgList | ( | ) | const [inline, virtual] |
return arglist (when applicable, that is, with N-ary functions)
Reimplemented in exprCopy, and exprOp.
Definition at line 74 of file expression.hpp.
Referenced by exprAux::generateCuts(), and exprAux::properObject().
virtual void expression::ArgList | ( | expression ** | al | ) | [inline, virtual] |
set arglist (used in deleting nodes without deleting children)
Reimplemented in exprCopy, and exprOp.
Definition at line 78 of file expression.hpp.
virtual expression* expression::Argument | ( | ) | const [inline, virtual] |
return argument (when applicable, i.e., with univariate functions)
Reimplemented in exprCopy, and exprUnary.
Definition at line 81 of file expression.hpp.
Referenced by exprAux::generateCuts().
virtual expression** expression::ArgPtr | ( | ) | [inline, virtual] |
return pointer to argument (when applicable, i.e., with univariate functions)
Reimplemented in exprCopy, and exprUnary.
Definition at line 85 of file expression.hpp.
virtual enum nodeType expression::Type | ( | ) | const [inline, virtual] |
node type
Reimplemented in exprAux, exprLowerBound, exprUpperBound, exprConst, exprCopy, exprOp, exprUnary, and exprVar.
Definition at line 89 of file expression.hpp.
References EMPTY.
virtual expression* expression::Image | ( | ) | const [inline, virtual] |
return pointer to corresponding expression (for auxiliary variables only)
Reimplemented in exprAux, and exprCopy.
Definition at line 93 of file expression.hpp.
Referenced by exprCos::generateCuts(), and exprSin::generateCuts().
virtual void expression::Image | ( | expression * | image | ) | [inline, virtual] |
set expression associated with this auxiliary variable (for compatibility with exprAux)
Reimplemented in exprAux.
Definition at line 98 of file expression.hpp.
virtual CouNumber expression::Value | ( | ) | const [inline, virtual] |
value (empty)
Reimplemented in exprClone, exprConst, and exprCopy.
Definition at line 101 of file expression.hpp.
Referenced by exprPow::closestFeasible(), compare(), exprSum::generateCuts(), exprSub::generateCuts(), exprPow::generateCuts(), exprMul::generateCuts(), exprGroup::generateCuts(), exprPow::getBounds(), exprMul::getBounds(), exprPow::gradientNorm(), exprMul::gradientNorm(), exprDiv::gradientNorm(), exprSub::impliedBound(), exprSum::impliedBound(), exprPow::impliedBound(), exprMul::impliedBound(), exprDiv::impliedBound(), exprPow::isCuttable(), exprPow::Linearity(), exprGroup::print(), exprPow::selectBranch(), exprSum::simplify(), exprSub::simplify(), exprPow::simplify(), exprOpp::simplify(), exprMul::simplify(), exprDiv::simplify(), and exprPow::standardize().
virtual const expression* expression::Original | ( | ) | const [inline, virtual] |
If this is an exprClone of a exprClone of an expr???, point to the original expr??? instead of an exprClone -- improve computing efficiency.
Only overloaded for exprClones/exprCopy, of course.
Reimplemented in exprCopy.
Definition at line 107 of file expression.hpp.
Referenced by compare(), exprQuad::realign(), and exprGroup::realign().
virtual void expression::print | ( | std::ostream & | s = std::cout , |
|
bool | = false | |||
) | const [inline, virtual] |
descend into auxiliaries' image?
Reimplemented in exprAux, exprLowerBound, exprUpperBound, exprConst, exprCopy, exprIVar, exprOp, exprUnary, exprVar, exprLBQuad, exprUBQuad, exprGroup, exprInv, exprOpp, and exprQuad.
Definition at line 111 of file expression.hpp.
References s.
virtual CouNumber expression::operator() | ( | ) | [pure virtual] |
null function for evaluating the expression
Implemented in exprAux, exprLowerBound, exprUpperBound, exprClone, exprConst, exprCopy, exprStore, exprUnary, exprVar, exprLBCos, exprUBCos, exprLBDiv, exprUBDiv, exprLBMul, exprUBMul, exprLBQuad, exprUBQuad, exprLBSin, exprUBSin, exprDiv, exprGroup, exprMax, exprMin, exprMul, exprPow, exprQuad, exprSub, and exprSum.
virtual CouNumber expression::gradientNorm | ( | const double * | x | ) | [inline, virtual] |
expression * expression::differentiate | ( | int | ) | [virtual] |
differentiation
Reimplemented in exprAux, exprLowerBound, exprUpperBound, exprConst, exprCopy, exprVar, exprAbs, exprCos, exprDiv, exprExp, exprGroup, exprInv, exprLog, exprMax, exprMin, exprMul, exprOpp, exprPow, exprQuad, exprSin, exprSub, and exprSum.
Definition at line 24 of file expression.cpp.
int expression::dependsOn | ( | int * | ind, | |
int | n, | |||
enum dig_type | type = STOP_AT_AUX | |||
) | [virtual] |
dependence on variable set: return cardinality of subset of the set of indices in first argument which occur in expression.
Reimplemented in exprLowerBound, exprUpperBound, and exprConst.
Definition at line 169 of file expression.cpp.
References DepList().
Referenced by dependsOn(), exprSum::differentiate(), exprSub::differentiate(), exprQuad::differentiate(), exprPow::differentiate(), exprMul::differentiate(), exprGroup::differentiate(), and exprDiv::differentiate().
int expression::dependsOn | ( | int | singleton, | |
enum dig_type | type = STOP_AT_AUX | |||
) | [inline] |
virtual int expression::DepList | ( | std::set< int > & | deplist, | |
enum dig_type | type = ORIG_ONLY | |||
) | [inline, virtual] |
fill std::set with indices of variables on which this expression depends.
Also deal with expressions that have no variable pointers (exprGroup, exprQuad)
Reimplemented in exprAux, exprCopy, exprOp, exprUnary, exprVar, exprGroup, and exprQuad.
Definition at line 136 of file expression.hpp.
Referenced by dependsOn().
virtual expression* expression::simplify | ( | ) | [inline, virtual] |
virtual int expression::Linearity | ( | ) | [inline, virtual] |
get a measure of "how linear" the expression is (see CouenneTypes.h)
Reimplemented in exprAux, exprLowerBound, exprUpperBound, exprConst, exprCopy, exprOp, exprUnary, exprVar, exprDiv, exprGroup, exprInv, exprMax, exprMin, exprMul, exprOpp, exprPow, exprQuad, exprSub, and exprSum.
Definition at line 145 of file expression.hpp.
References NONLINEAR.
virtual bool expression::isDefinedInteger | ( | ) | [inline, virtual] |
is this expression defined as an integer?
Reimplemented in exprAux, exprIVar, and exprVar.
Definition at line 149 of file expression.hpp.
References isInteger().
virtual bool expression::isInteger | ( | ) | [inline, virtual] |
void expression::getBounds | ( | expression *& | , | |
expression *& | ||||
) | [virtual] |
Get lower and upper bound of an expression (if any).
Reimplemented in exprConst, exprCopy, exprVar, exprAbs, exprCos, exprDiv, exprExp, exprGroup, exprInv, exprLog, exprMax, exprMin, exprMul, exprOpp, exprPow, exprQuad, exprSin, exprSub, and exprSum.
Definition at line 29 of file expression.cpp.
Referenced by getBounds(), exprQuad::getBounds(), exprUnary::isInteger(), and exprOp::isInteger().
Get lower and upper bound of an expression (if any) -- real values.
Reimplemented in exprConst, exprCopy, exprVar, exprAbs, exprCos, exprDiv, exprExp, exprGroup, exprInv, exprLog, exprMul, exprOpp, exprPow, exprQuad, exprSin, exprSub, and exprSum.
Definition at line 37 of file expression.cpp.
References getBounds().
virtual exprAux* expression::standardize | ( | CouenneProblem * | p, | |
bool | addAux = true | |||
) | [inline, virtual] |
Create standard form of this expression, by:.
For the base exprOp class we only do the first part (for argument list components only), and the calling class (Sum, Sub, Mul, Pow, and the like) will do the part for its own object
addAux is true if a new auxiliary variable should be added associated with the standardized expression
Reimplemented in exprCopy, exprOp, exprUnary, exprDiv, exprMax, exprMin, exprMul, exprOpp, exprPow, exprSub, and exprSum.
Definition at line 174 of file expression.hpp.
virtual void expression::generateCuts | ( | expression * | w, | |
const OsiSolverInterface & | si, | |||
OsiCuts & | cs, | |||
const CouenneCutGenerator * | cg, | |||
t_chg_bounds * | chg = NULL , |
|||
int | wind = -1 , |
|||
CouNumber | lb = -COUENNE_INFINITY , |
|||
CouNumber | ub = COUENNE_INFINITY | |||
) | [inline, virtual] |
virtual enum expr_type expression::code | ( | ) | [inline, virtual] |
return integer for comparing expressions (used to recognize common expression)
Reimplemented in exprLowerBound, exprUpperBound, exprConst, exprCopy, exprOp, exprUnary, exprVar, exprAbs, exprCos, exprDiv, exprExp, exprGroup, exprInv, exprLog, exprMax, exprMin, exprMul, exprOpp, exprPow, exprQuad, exprSin, exprSub, and exprSum.
Definition at line 186 of file expression.hpp.
References COU_EXPRESSION.
Referenced by compare().
virtual enum convexity expression::convexity | ( | ) | const [inline, virtual] |
either CONVEX, CONCAVE, AFFINE, or NONCONVEX
Reimplemented in exprCopy, and exprVar.
Definition at line 190 of file expression.hpp.
References NONCONVEX.
int expression::compare | ( | expression & | ) | [virtual] |
compare expressions
Reimplemented in exprCopy.
Definition at line 61 of file expression.cpp.
References code(), COU_EXPROP, COU_EXPRUNARY, Index(), and Value().
Referenced by compare().
int expression::compare | ( | exprCopy & | ) | [virtual] |
compare copies of expressions
Definition at line 135 of file expression.cpp.
References c, compare(), and Original().
virtual int expression::rank | ( | ) | [inline, virtual] |
used in rank-based branching variable choice: original variables have rank 1; auxiliary w=f(x) has rank r(w) = r(x)+1; finally, auxiliary w=f(x1,x2.
..,xk) has rank r(w) = 1+max{r(xi):i=1..k}.
Reimplemented in exprAux, exprConst, exprCopy, exprOp, exprUnary, exprVar, exprGroup, and exprQuad.
Definition at line 202 of file expression.hpp.
virtual bool expression::impliedBound | ( | int | , | |
CouNumber * | , | |||
CouNumber * | , | |||
t_chg_bounds * | ||||
) | [inline, virtual] |
does a backward implied bound processing on every expression, including exprSums although already done by Clp (useful when repeated within Couenne).
Parameters are the index of the (auxiliary) variable in question and the current lower/upper bound. The method returns true if there has been a change on any bound on the variables on which the expression depends.
Reimplemented in exprCopy, exprVar, exprAbs, exprCos, exprDiv, exprExp, exprInv, exprLog, exprMul, exprOpp, exprPow, exprQuad, exprSin, exprSub, and exprSum.
Definition at line 211 of file expression.hpp.
virtual int expression::Multiplicity | ( | ) | [inline, virtual] |
multiplicity of a variable
Reimplemented in exprAux, and exprCopy.
Definition at line 215 of file expression.hpp.
virtual CouNumber expression::selectBranch | ( | const CouenneObject * | obj, | |
const OsiBranchingInformation * | info, | |||
expression *& | var, | |||
double *& | brpts, | |||
double *& | brDist, | |||
int & | way | |||
) | [inline, virtual] |
set up branching object by evaluating many branching points for each expression's arguments.
Return estimated improvement in objective function
Reimplemented in exprCopy, exprAbs, exprCos, exprDiv, exprExp, exprInv, exprLog, exprMul, exprPow, exprQuad, and exprSin.
Definition at line 221 of file expression.hpp.
virtual void expression::linkDomain | ( | Domain * | d | ) | [inline, virtual] |
empty function to update domain pointer
Reimplemented in exprAux, and exprVar.
Definition at line 238 of file expression.hpp.
virtual void expression::realign | ( | const CouenneProblem * | p | ) | [inline, virtual] |
virtual bool expression::isBijective | ( | ) | const [inline, virtual] |
indicating if function is monotonically increasing
Reimplemented in exprCopy, exprExp, exprInv, and exprLog.
Definition at line 244 of file expression.hpp.
Referenced by closestFeasible().
virtual CouNumber expression::inverse | ( | expression * | vardep | ) | const [inline, virtual] |
compute the inverse function
Reimplemented in exprCopy, exprExp, exprInv, and exprLog.
Definition at line 248 of file expression.hpp.
References COUENNE_INFINITY.
Referenced by closestFeasible().
void expression::closestFeasible | ( | expression * | varind, | |
expression * | vardep, | |||
CouNumber & | left, | |||
CouNumber & | right | |||
) | const [virtual] |
virtual bool expression::isCuttable | ( | CouenneProblem * | problem, | |
int | index | |||
) | const [inline, virtual] |
virtual bool expression::isaCopy | ( | ) | const [inline, virtual] |
return true if this is a copy of something (i.e. an exprCopy)
Reimplemented in exprCopy.
Definition at line 261 of file expression.hpp.
virtual expression* expression::Copy | ( | ) | const [inline, virtual] |
return copy of this expression (only makes sense in exprCopy)
Reimplemented in exprCopy.
Definition at line 265 of file expression.hpp.