Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouenneExprSub.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprSub.hpp 615 2011-06-08 20:36:24Z pbelotti $
2  *
3  * Name: exprSub.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of subtractions
6  *
7  * (C) Carnegie-Mellon University, 2006-10.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNE_EXPRSUB_HPP
12 #define COUENNE_EXPRSUB_HPP
13 
14 #include "CouenneExprOp.hpp"
15 #include "CouennePrecisions.hpp"
16 #include "CouenneProblem.hpp"
17 
18 namespace Couenne {
19 
21 
22 class exprSub: public exprOp {
23 
24  public:
25 
27  exprSub (expression **al, int n = 2):
28  exprOp (al, n) {} //< non-leaf expression, with argument list
29 
31  exprSub (expression *arg0, expression *arg1):
32  exprOp (arg0, arg1) {}
33 
35  expression *clone (Domain *d = NULL) const
36  {return new exprSub (clonearglist (d), nargs_);}
37 
39  std::string printOp () const
40  {return "-";}
41 
44 
46  expression *differentiate (int index);
47 
49  expression *simplify ();
50 
52  virtual inline int Linearity () {
53 
54  int lin1 = arglist_ [0] -> Linearity ();
55  int lin2 = arglist_ [1] -> Linearity ();
56 
57  if (lin1 < lin2) return lin2;
58  else return lin1;
59  }
60 
62  void getBounds (expression *&, expression *&);
63 
65  void getBounds (CouNumber &lb, CouNumber &ub);
66 
69  virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
70 
72  virtual void generateCuts (expression *, //const OsiSolverInterface &,
73  OsiCuts &, const CouenneCutGenerator *,
74  t_chg_bounds * = NULL, int = -1,
77 
79  virtual enum expr_type code () {return COU_EXPRSUB;}
80 
83 };
84 
85 
87 
89 {return ((*(*arglist_)) () - (*(arglist_ [1])) ());}
90 
91 }
92 
93 #endif
Cut Generator for linear convexifications.
expression * differentiate(int index)
Differentiation.
exprSub(expression *arg0, expression *arg1)
Constructor with two explicit elements.
exprSub(expression **al, int n=2)
Constructor.
class for subtraction,
expression * simplify()
Simplification.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
virtual int Linearity()
Get a measure of &quot;how linear&quot; the expression is (see CouenneTypes.h)
std::string printOp() const
print operator
void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
virtual void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
Special version for linear constraints.
CouNumber operator()()
Function for the evaluation of the difference.
auxSign
&quot;sign&quot; of the constraint defining an auxiliary.
expression ** clonearglist(Domain *d=NULL) const
clone argument list (for use with clone method)
expression * clone(Domain *d=NULL) const
Cloning method.
virtual exprAux * standardize(CouenneProblem *p, bool addAux=true)
Reduce expression in standard form, creating additional aux variables (and constraints) ...
Class for MINLP problems with symbolic information.
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.
#define COUENNE_INFINITY
Auxiliary variable.
expr_type
code returned by the method expression::code()
Expression base class.
virtual enum expr_type code()
Code for comparisons.
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
Implied bound processing.