# CouenneExprBound.hpp

Go to the documentation of this file.

    00001 /* $Id: CouenneExprBound.hpp 490 2011-01-14 16:07:12Z pbelotti $
    00002  *
    00003  * Name:    exprBound.hpp
    00004  * Author:  Pietro Belotti
    00005  * Purpose: definition of the class for variable bounds
    00006  *
    00007  * (C) Carnegie-Mellon University, 2006.
    00008  * This file is licensed under the Eclipse Public License (EPL)
    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 "CouenneExprVar.hpp"
    00019
    00020 namespace Couenne {
    00021
    00034
    00035
    00037
    00038 class exprLowerBound: public exprVar {
    00039
    00040  public:
    00041
    00043   inline enum nodeType Type () const
    00044   {return CONST;}
    00045
    00047   exprLowerBound (int varIndex, Domain *d = NULL):
    00048     exprVar (varIndex, d) {}
    00049
    00051   exprLowerBound (const exprLowerBound &src, Domain *d = NULL):
    00052     exprVar (src, d) {}
    00053
    00055   inline exprLowerBound *clone (Domain *d = NULL) const
    00056   {return new exprLowerBound (*this, d);}
    00057
    00059   void print (std::ostream &out = std::cout,
    00060               bool = false) const
    00061   {out << "l_" << varIndex_;}
    00062
    00064   inline CouNumber operator () ()
    00065   {assert (domain_); return domain_ -> lb (varIndex_);}
    00066
    00068   inline expression *differentiate (int)
    00069   {return new exprConst (0.);}
    00070
    00072   inline int dependsOn (int *, int, enum dig_type type = STOP_AT_AUX)
    00073   {return 0;}
    00074
    00076   virtual inline int Linearity ()
    00077   {return CONST;}
    00078
    00080   virtual inline enum expr_type code ()
    00081   {return COU_EXPRLBOUND;}
    00082 };
    00083
    00084
    00086
    00087 class exprUpperBound: public exprVar {
    00088
    00089  public:
    00090
    00092   inline enum nodeType Type () const
    00093   {return CONST;}
    00094
    00096   exprUpperBound (int varIndex, Domain *d = NULL):
    00097     exprVar (varIndex, d) {}
    00098
    00100   exprUpperBound (const exprUpperBound &src, Domain *d = NULL):
    00101     exprVar (src, d) {}
    00102
    00104   inline exprUpperBound *clone (Domain *d = NULL) const
    00105   {return new exprUpperBound (*this, d);}
    00106
    00108   void print (std::ostream &out = std::cout,
    00109               bool = false) const
    00110   {out << "u_" << varIndex_;}
    00111
    00113   inline CouNumber operator () ()
    00114   {assert (domain_); return domain_ -> ub (varIndex_);}
    00115
    00117   inline expression *differentiate (int)
    00118   {return new exprConst (0.);}
    00119
    00121   inline int dependsOn (int *, int, enum dig_type type = STOP_AT_AUX)
    00122   {return 0;}
    00123
    00125   virtual inline int Linearity ()
    00126   {return CONST;}
    00127
    00129   virtual inline enum expr_type code ()
    00130   {return COU_EXPRUBOUND;}
    00131 };
    00132
    00133 }
    00134
    00135 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines