Couenne 0.5.8
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
18namespace Couenne {
19
21
22class 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
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
47
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
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 &,
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
#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)
class for subtraction,
exprSub(expression *arg0, expression *arg1)
Constructor with two explicit elements.
virtual void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
Special version for linear constraints.
bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign=expression::AUX_EQ)
Implied bound processing.
virtual exprAux * standardize(CouenneProblem *p, bool addAux=true)
Reduce expression in standard form, creating additional aux variables (and constraints)
CouNumber operator()()
Function for the evaluation of the difference.
void getBounds(CouNumber &lb, CouNumber &ub)
Get value of lower and upper bound of an expression (if any)
virtual enum expr_type code()
Code for comparisons.
void getBounds(expression *&, expression *&)
Get lower and upper bound of an expression (if any)
expression * clone(Domain *d=NULL) const
Cloning method.
virtual int Linearity()
Get a measure of "how linear" the expression is (see CouenneTypes.h)
exprSub(expression **al, int n=2)
Constructor.
expression * simplify()
Simplification.
std::string printOp() const
print operator
expression * differentiate(int index)
Differentiation.
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()