expression Class Reference

Expression base class. More...

#include <expression.hpp>

Inheritance diagram for expression:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 expression ()
 Constructor.
 expression (const expression &e, Domain *d=NULL)
 Copy constructor.
virtual ~expression ()
 Destructor.
virtual expressionclone (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 expressionArgument () 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 expressionImage () 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 expressionOriginal () 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 expressiondifferentiate (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 expressionsimplify ()
 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 exprAuxstandardize (CouenneProblem *p, bool addAux=true)
 Create standard form of this expression, by:.
virtual void generateCuts (expression *w, 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 expressionCopy () const
 return copy of this expression (only makes sense in exprCopy)

Detailed Description

Expression base class.

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.


Constructor & Destructor Documentation

expression::expression (  )  [inline]

Constructor.

Definition at line 51 of file expression.hpp.

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]

Destructor.

Definition at line 59 of file expression.hpp.


Member Function Documentation

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 exprSin::gradientNorm(), exprOpp::gradientNorm(), exprExp::gradientNorm(), exprCos::gradientNorm(), exprAbs::gradientNorm(), exprSin::impliedBound(), exprCos::impliedBound(), and exprQuad::operator()().

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.

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.

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.

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.

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.

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.

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.

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]

return l-2 norm of gradient at given point

Reimplemented in exprCopy, exprVar, exprAbs, exprCos, exprDiv, exprExp, exprGroup, exprInv, exprLog, exprMul, exprOpp, exprPow, exprQuad, and exprSin.

Definition at line 119 of file expression.hpp.

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.

virtual 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.

Referenced by dependsOn().

int expression::dependsOn ( int  singleton,
enum dig_type  type = STOP_AT_AUX 
) [inline]

version with one index only

Definition at line 130 of file expression.hpp.

References dependsOn().

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.

virtual expression* expression::simplify (  )  [inline, virtual]

simplify expression (useful for derivatives)

Reimplemented in exprAux, exprCopy, exprOp, exprUnary, exprVar, exprDiv, exprGroup, exprMax, exprMin, exprMul, exprOpp, exprPow, exprQuad, exprSub, and exprSum.

Definition at line 141 of file expression.hpp.

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]

is this expression integer?

Reimplemented in exprAux, exprConst, exprCopy, exprIVar, exprOp, exprUnary, exprVar, exprAbs, exprDiv, exprGroup, exprOpp, exprPow, and exprQuad.

Definition at line 153 of file expression.hpp.

Referenced by isDefinedInteger().

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.

virtual void expression::getBounds ( CouNumber ,
CouNumber  
) [virtual]

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.

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,
OsiCuts &  cs,
const CouenneCutGenerator cg,
t_chg_bounds chg = NULL,
int  wind = -1,
CouNumber  lb = -COUENNE_INFINITY,
CouNumber  ub = COUENNE_INFINITY 
) [inline, virtual]

generate convexification cut for constraint w = this

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 178 of file expression.hpp.

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.

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.

virtual int expression::compare ( expression  )  [virtual]

compare expressions

Reimplemented in exprCopy.

virtual int expression::compare ( exprCopy  )  [virtual]

compare copies of expressions

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::replace ( exprVar ,
exprVar  
) [inline, virtual]

replace expression with another

Reimplemented in exprCopy, exprOp, exprUnary, exprGroup, and exprQuad.

Definition at line 231 of file expression.hpp.

virtual void expression::fillDepSet ( std::set< DepNode *, compNode > *  ,
DepGraph  
) [inline, virtual]

update dependence set with index of variables on which this expression depends

Reimplemented in exprCopy, exprOp, exprUnary, exprVar, exprGroup, and exprQuad.

Definition at line 235 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]

empty function to redirect variables to proper variable vector

Reimplemented in exprCopy, exprOp, exprUnary, exprGroup, and exprQuad.

Definition at line 241 of file expression.hpp.

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.

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.

virtual void expression::closestFeasible ( expression varind,
expression vardep,
CouNumber left,
CouNumber right 
) const [virtual]

closest feasible points in function in both directions

Reimplemented in exprCopy, exprAbs, exprCos, exprDiv, exprMul, exprPow, exprQuad, and exprSin.

virtual bool expression::isCuttable ( CouenneProblem problem,
int  index 
) const [inline, virtual]

can this expression be further linearized or are we on its concave ("bad") side

Reimplemented in exprCopy, exprAbs, exprCos, exprDiv, exprExp, exprInv, exprLog, exprMul, exprPow, exprQuad, and exprSin.

Definition at line 257 of file expression.hpp.

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.


The documentation for this class was generated from the following file:
Generated on Wed Jan 20 03:05:26 2010 for Couenne by  doxygen 1.4.7