Couenne 0.5.8
Loading...
Searching...
No Matches
CouenneExprConst.hpp
Go to the documentation of this file.
1/* $Id: CouenneExprConst.hpp 490 2011-01-14 16:07:12Z pbelotti $
2 *
3 * Name: exprConst.hpp
4 * Author: Pietro Belotti
5 * Purpose: definition of the class exprConst
6 *
7 * (C) Carnegie-Mellon University, 2006-09.
8 * This file is licensed under the Eclipse Public License (EPL)
9 */
10
11#ifndef COUENNE_EXPRCONST_HPP
12#define COUENNE_EXPRCONST_HPP
13
14#include <iostream>
15
16#include "CouenneTypes.hpp"
17#include "CouenneExpression.hpp"
18
19namespace Couenne {
20
22
23class exprConst: public expression {
24
25private:
26
28 CouNumber value_;
29
30public:
31
33 inline enum nodeType Type () const
34 {return CONST;}
35
37 inline CouNumber Value () const
38 {return value_;}
39
42 value_ (value) {}
43
45 exprConst (const exprConst &e, Domain *d = NULL)
46 {value_ = e.value_;}
47
49 virtual inline expression *clone (Domain *d = NULL) const
50 {return new exprConst (value_);}
51
53 void print (std::ostream &out = std::cout,
54 bool = false) const
55 {out << value_;}
56
59 {return value_;}
60
63 {return new exprConst (0.);}
64
66 inline int dependsOn (int *ind, int n, enum dig_type type = STOP_AT_AUX)
67 {return 0;}
68
70 inline int Linearity ()
71 {return ((fabs (value_) < COUENNE_EPS) ? ZERO: CONSTANT);}
72
74 inline void getBounds (expression *&lower, expression *&upper) {
75 lower = new exprConst (value_);
76 upper = new exprConst (value_);
77 }
78
80 inline void getBounds (CouNumber &lower, CouNumber &upper)
81 {lower = upper = value_;}
82
84 void generateCuts (expression *, //const OsiSolverInterface &,
85 OsiCuts &, const CouenneCutGenerator *,
86 t_chg_bounds * = NULL, int = -1,
89
91 virtual inline enum expr_type code ()
92 {return COU_EXPRCONST;}
93
95 virtual inline bool isInteger ()
96 {return Couenne::isInteger (value_);}
97
99 virtual inline int rank ()
100 {return 0;}
101};
102
103}
104
105#endif
#define COUENNE_EPS
#define COUENNE_INFINITY
Cut Generator for linear convexifications.
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
constant-type operator
int dependsOn(int *ind, int n, enum dig_type type=STOP_AT_AUX)
dependence on variable set
CouNumber Value() const
value of expression
CouNumber operator()()
return constant's value
virtual bool isInteger()
is this expression integer?
void getBounds(expression *&lower, expression *&upper)
Get lower and upper bound of an expression (if any)
void print(std::ostream &out=std::cout, bool=false) const
I/O.
virtual enum expr_type code()
code for comparisons
enum nodeType Type() const
node type
void generateCuts(expression *, OsiCuts &, const CouenneCutGenerator *, t_chg_bounds *=NULL, int=-1, CouNumber=-COUENNE_INFINITY, CouNumber=COUENNE_INFINITY)
generate convexification cut for constraint w = this
expression * differentiate(int)
differentiation
exprConst(CouNumber value)
Constructor.
int Linearity()
get a measure of "how linear" the expression is (see CouenneTypes.h)
exprConst(const exprConst &e, Domain *d=NULL)
Copy constructor.
void getBounds(CouNumber &lower, CouNumber &upper)
Get value of lower and upper bound of an expression (if any)
virtual expression * clone(Domain *d=NULL) const
Cloning method.
virtual int rank()
used in rank-based branching variable choice
Expression base class.
status of lower/upper bound of a variable, to be checked/modified in bound tightening
general include file for different compilers
nodeType
type of a node in an expression tree
dig_type
type of digging when filling the dependence list
double CouNumber
main number type in Couenne
expr_type
code returned by the method expression::code()
bool isInteger(CouNumber x)
is this number integer?