Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouenneExprSum.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprSum.hpp 615 2011-06-08 20:36:24Z pbelotti $
2  *
3  * Name: exprSum.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of sum expressions
6  *
7  * (C) Carnegie-Mellon University, 2006-10.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNE_EXPRSUM_H
12 #define COUENNE_EXPRSUM_H
13 
14 #include <vector>
15 
16 #include "CouenneExprOp.hpp"
17 
18 namespace Couenne {
19 
21 
22 class exprSum: public exprOp {
23 
24  public:
25 
27  exprSum (expression ** = NULL, int = 0);
28 
31 
33  virtual ~exprSum () {}
34 
36  virtual expression *clone (Domain *d = NULL) const
37  {return new exprSum (clonearglist (d), nargs_);}
38 
40  std::string printOp () const
41  {return "+";}
42 
44  virtual CouNumber operator () ();
45 
47  virtual expression *differentiate (int index);
48 
50  virtual expression *simplify ();
51 
53  virtual int Linearity ();
54 
56  virtual void getBounds (expression *&, expression *&);
57 
59  virtual void getBounds (CouNumber &, CouNumber &);
60 
63  virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
64 
66  virtual void generateCuts (expression *, //const OsiSolverInterface &,
67  OsiCuts &, const CouenneCutGenerator *,
68  t_chg_bounds * = NULL, int = -1,
71 
73  virtual enum expr_type code ()
74  {return COU_EXPRSUM;}
75 
97  virtual bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign = expression::AUX_EQ);
98 
103 
104 protected:
105 
107  int impliedBoundSum (CouNumber wl,
108  CouNumber wu,
109  std::vector <CouNumber> &xl,
110  std::vector <CouNumber> &xu,
111  std::vector <std::pair <int, CouNumber> > &nl,
112  std::vector <std::pair <int, CouNumber> > &nu);
113 };
114 
115 
117 
119 
120  CouNumber ret = 0;
121 
122  expression **al = arglist_;
123 
124  for (int n = nargs_; n--;)
125  ret += (**al++) ();
126 
127  return ret;
128 }
129 
130 }
131 
132 #endif
Cut Generator for linear convexifications.
virtual void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
Special version for linear constraints.
virtual CouNumber operator()()
Function for the evaluation of the expression.
virtual expression * differentiate(int index)
Differentiation.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
std::string printOp() const
Print operator.
auxSign
&quot;sign&quot; of the constraint defining an auxiliary.
virtual int Linearity()
Get a measure of &quot;how linear&quot; the expression is:
exprAux * createQuadratic(CouenneProblem *)
Checks for quadratic terms in the expression and returns an exprQuad if there are enough to create so...
exprSum(expression **=NULL, int=0)
Constructors, destructor.
expression ** clonearglist(Domain *d=NULL) const
clone argument list (for use with clone method)
Class for MINLP problems with symbolic information.
virtual ~exprSum()
Empty destructor.
expression ** arglist_
argument list is an array of pointers to other expressions
double CouNumber
main number type in Couenne
int nargs_
number of arguments (cardinality of arglist)
general n-ary operator-type expression: requires argument list.
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
#define COUENNE_INFINITY
Auxiliary variable.
expr_type
code returned by the method expression::code()
virtual expression * simplify()
Simplification.
virtual exprAux * standardize(CouenneProblem *p, bool addAux=true)
Reduce expression in standard form, creating additional aux variables (and constraints) ...
virtual expression * clone(Domain *d=NULL) const
Cloning method.
Expression base class.
virtual bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
Implied bound.
virtual enum expr_type code()
Code for comparison.
int impliedBoundSum(CouNumber wl, CouNumber wu, std::vector< CouNumber > &xl, std::vector< CouNumber > &xu, std::vector< std::pair< int, CouNumber > > &nl, std::vector< std::pair< int, CouNumber > > &nu)
inferring bounds on factors of a product
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...