Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouenneExprOpp.hpp
Go to the documentation of this file.
1 /* $Id: CouenneExprOpp.hpp 615 2011-06-08 20:36:24Z pbelotti $
2  *
3  * Name: exprOpp.hpp
4  * Author: Pietro Belotti
5  * Purpose: definition of the opposite -f(x) of a function
6  *
7  * (C) Carnegie-Mellon University, 2006-10.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNE_EXPROPP_HPP
12 #define COUENNE_EXPROPP_HPP
13 
14 #include "CouennePrecisions.hpp"
15 #include "CouenneExprUnary.hpp"
16 
17 namespace Couenne {
18 
20 
21 inline CouNumber opp (register CouNumber arg)
22 {return - arg;}
23 
24 
26 
27 class exprOpp: public exprUnary {
28 
29  public:
30 
33  exprUnary (al) {} //< non-leaf expression, with argument list
34 
36  expression *clone (Domain *d = NULL) const
37  {return new exprOpp (argument_ -> clone (d));}
38 
40  inline unary_function F ()
41  {return opp;}
42 
44  void print (std::ostream &out,
45  bool descend) const;
46 
48  inline CouNumber gradientNorm (const double *x)
49  {return (argument_ -> Index () < 0) ? 0. : 1.;}
50 
52  expression *differentiate (int index);
53 
55  virtual expression *simplify ();
56 
58  inline int Linearity ()
59  {return argument_ -> Linearity ();}
60 
62  void getBounds (expression *&, expression *&);
63 
65  void getBounds (CouNumber &, CouNumber&);
66 
68  virtual void generateCuts (expression *, //const OsiSolverInterface &,
69  OsiCuts &, const CouenneCutGenerator *,
70  t_chg_bounds * = NULL, int = -1,
73 
75  virtual enum expr_type code ()
76  {return COU_EXPROPP;}
77 
79  bool isInteger ()
80  {return argument_ -> isInteger ();}
81 
84 
86  exprAux *standardize (CouenneProblem *, bool addAux = true);
87 };
88 
89 }
90 
91 #endif
Cut Generator for linear convexifications.
void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
class opposite,
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
exprAux * standardize(CouenneProblem *, bool addAux=true)
standardization (to deal with complex arguments)
expression * argument_
single argument taken by this expression
expression class for unary functions (sin, log, etc.)
int Linearity()
get a measure of &quot;how linear&quot; the expression is (see CouenneTypes.h)
unary_function F()
the operator&#39;s function
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
auxSign
&quot;sign&quot; of the constraint defining an auxiliary.
virtual enum expr_type code()
code for comparisons
exprOpp(expression *al)
Constructors, destructor.
CouNumber(* unary_function)(CouNumber)
unary function, used in all exprUnary
bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
implied bound processing
Class for MINLP problems with symbolic information.
CouNumber opp(register CouNumber arg)
operator opp: returns the opposite of a number
bool isInteger()
is this expression integer?
expression * clone(Domain *d=NULL) const
cloning method
virtual expression * simplify()
simplification
double CouNumber
main number type in Couenne
void print(std::ostream &out, bool descend) const
Output.
#define COUENNE_INFINITY
Auxiliary variable.
expr_type
code returned by the method expression::code()
Expression base class.
CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point
expression * differentiate(int index)
differentiation
virtual void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
special version for linear constraints
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...