Couenne 0.5.8
Loading...
Searching...
No Matches
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
17namespace Couenne {
18
20
21inline CouNumber opp (register CouNumber arg)
22{return - arg;}
23
24
26
27class 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
53
55 virtual expression *simplify ();
56
58 inline int Linearity ()
59 {return argument_ -> Linearity ();}
60
63
66
68 virtual void generateCuts (expression *, //const OsiSolverInterface &,
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
#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.
CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point
void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
unary_function F()
the operator's function
exprAux * standardize(CouenneProblem *, bool addAux=true)
standardization (to deal with complex arguments)
void getBounds(CouNumber &, CouNumber &)
Get value of lower and upper bound of an expression (if any)
expression * clone(Domain *d=NULL) const
cloning method
int Linearity()
get a measure of "how linear" the expression is (see CouenneTypes.h)
virtual enum expr_type code()
code for comparisons
bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
implied bound processing
void print(std::ostream &out, bool descend) const
Output.
virtual void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
special version for linear constraints
expression * differentiate(int index)
differentiation
virtual expression * simplify()
simplification
bool isInteger()
is this expression integer?
exprOpp(expression *al)
Constructors, destructor.
expression * argument_
single argument taken by this expression
exprUnary(expression *argument)
Constructor.
Expression base class.
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
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
CouNumber opp(register CouNumber arg)
operator opp: returns the opposite of a number
double CouNumber
main number type in Couenne
CouNumber(* unary_function)(CouNumber)
unary function, used in all exprUnary
expr_type
code returned by the method expression::code()