00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef COUENNE_EXPRBOUND_HPP
00012 #define COUENNE_EXPRBOUND_HPP
00013
00014 #include <iostream>
00015 #include <assert.h>
00016
00017 #include "CouenneTypes.hpp"
00018 #include "exprVar.hpp"
00019
00032
00033
00035
00036 class exprLowerBound: public exprVar {
00037
00038 public:
00039
00041 inline enum nodeType Type () const
00042 {return CONST;}
00043
00045 exprLowerBound (int varIndex, Domain *d = NULL):
00046 exprVar (varIndex, d) {}
00047
00049 exprLowerBound (const exprLowerBound &src, Domain *d = NULL):
00050 exprVar (src, d) {}
00051
00053 inline exprLowerBound *clone (Domain *d = NULL) const
00054 {return new exprLowerBound (*this, d);}
00055
00057 void print (std::ostream &out = std::cout,
00058 bool = false) const
00059 {out << "l_" << varIndex_;}
00060
00062 inline CouNumber operator () ()
00063 {assert (domain_); return domain_ -> lb (varIndex_);}
00064
00066 inline expression *differentiate (int)
00067 {return new exprConst (0.);}
00068
00070 inline int dependsOn (int *, int, enum dig_type type = STOP_AT_AUX)
00071 {return 0;}
00072
00074 virtual inline int Linearity ()
00075 {return CONST;}
00076
00078 virtual inline enum expr_type code ()
00079 {return COU_EXPRLBOUND;}
00080 };
00081
00082
00084
00085 class exprUpperBound: public exprVar {
00086
00087 public:
00088
00090 inline enum nodeType Type () const
00091 {return CONST;}
00092
00094 exprUpperBound (int varIndex, Domain *d = NULL):
00095 exprVar (varIndex, d) {}
00096
00098 exprUpperBound (const exprUpperBound &src, Domain *d = NULL):
00099 exprVar (src, d) {}
00100
00102 inline exprUpperBound *clone (Domain *d = NULL) const
00103 {return new exprUpperBound (*this, d);}
00104
00106 void print (std::ostream &out = std::cout,
00107 bool = false) const
00108 {out << "u_" << varIndex_;}
00109
00111 inline CouNumber operator () ()
00112 {assert (domain_); return domain_ -> ub (varIndex_);}
00113
00115 inline expression *differentiate (int)
00116 {return new exprConst (0.);}
00117
00119 inline int dependsOn (int *, int, enum dig_type type = STOP_AT_AUX)
00120 {return 0;}
00121
00123 virtual inline int Linearity ()
00124 {return CONST;}
00125
00127 virtual inline enum expr_type code ()
00128 {return COU_EXPRUBOUND;}
00129 };
00130
00131 #endif