Couenne 0.5.8
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
18namespace Couenne {
19
21
22class 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 &,
68 t_chg_bounds * = NULL, int = -1,
71
73 virtual enum expr_type code ()
74 {return COU_EXPRSUM;}
75
98
103
104protected:
105
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
#define COUENNE_INFINITY
Cut Generator for linear convexifications.
Class for MINLP problems with symbolic information.
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
Auxiliary variable.
general n-ary operator-type expression: requires argument list.
int nargs_
number of arguments (cardinality of arglist)
expression ** arglist_
argument list is an array of pointers to other expressions
expression ** clonearglist(Domain *d=NULL) const
clone argument list (for use with clone method)
virtual bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
Implied bound.
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
virtual enum expr_type code()
Code for comparison.
std::string printOp() const
Print operator.
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 expression * clone(Domain *d=NULL) const
Cloning method.
virtual void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
virtual expression * simplify()
Simplification.
virtual exprAux * standardize(CouenneProblem *p, bool addAux=true)
Reduce expression in standard form, creating additional aux variables (and constraints)
virtual void getBounds(CouNumber &, CouNumber &)
Get lower and upper bound of an expression (if any)
virtual int Linearity()
Get a measure of "how linear" the expression is:
exprSum(expression *, expression *)
Constructor with two elements.
exprSum(expression **=NULL, int=0)
Constructors, destructor.
virtual expression * differentiate(int index)
Differentiation.
virtual ~exprSum()
Empty destructor.
exprAux * createQuadratic(CouenneProblem *)
Checks for quadratic terms in the expression and returns an exprQuad if there are enough to create so...
virtual CouNumber operator()()
Function for the evaluation of the expression.
Expression base class.
auxSign
"sign" of the constraint defining an auxiliary.
status of lower/upper bound of a variable, to be checked/modified in bound tightening
general include file for different compilers
double CouNumber
main number type in Couenne
expr_type
code returned by the method expression::code()