Couenne  0.5.7
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
expression * clone(Domain *d=NULL) const
cloning method
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 COUENNE_INFINITY
void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
virtual enum expr_type code()
code for comparisons
unary_function F()
the operator's function
expr_type
code returned by the method expression::code()
bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
implied bound processing
CouNumber(* unary_function)(CouNumber)
unary function, used in all exprUnary
void print(std::ostream &out, bool descend) const
Output.
Cut Generator for linear convexifications.
auxSign
"sign" of the constraint defining an auxiliary.
double CouNumber
main number type in Couenne
expression class for unary functions (sin, log, etc.)
expression * differentiate(int index)
differentiation
bool isInteger()
is this expression integer?
virtual expression * simplify()
simplification
int Linearity()
get a measure of "how linear" the expression is (see CouenneTypes.h)
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...
int Index
exprOpp(expression *al)
Constructors, destructor.
expression * argument_
single argument taken by this expression
exprAux * standardize(CouenneProblem *, bool addAux=true)
standardization (to deal with complex arguments)
class opposite,
Expression base class.
CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point
status of lower/upper bound of a variable, to be checked/modified in bound tightening
CouNumber opp(register CouNumber arg)
operator opp: returns the opposite of a number
Auxiliary variable.
general include file for different compilers