/home/coin/SVN-release/OS-2.1.1/Couenne/src/expression/exprBound.hpp

Go to the documentation of this file.
00001 /* $Id: exprBound.hpp 217 2009-07-08 17:02:07Z 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 Common Public License (CPL)
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

Generated on Mon May 3 03:05:19 2010 by  doxygen 1.4.7