CouenneExprSub.hpp

Go to the documentation of this file.
00001 /* $Id: CouenneExprSub.hpp 615 2011-06-08 20:36:24Z pbelotti $
00002  *
00003  * Name:    exprSub.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of subtractions
00006  *
00007  * (C) Carnegie-Mellon University, 2006-10.
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPRSUB_HPP
00012 #define COUENNE_EXPRSUB_HPP
00013 
00014 #include "CouenneExprOp.hpp"
00015 #include "CouennePrecisions.hpp"
00016 #include "CouenneProblem.hpp"
00017 
00018 namespace Couenne {
00019 
00021 
00022 class exprSub: public exprOp {
00023 
00024  public:
00025 
00027   exprSub  (expression **al, int n = 2): 
00028     exprOp (al, n) {} //< non-leaf expression, with argument list
00029 
00031   exprSub (expression *arg0, expression *arg1):
00032     exprOp (arg0, arg1) {}
00033 
00035   expression *clone (Domain *d = NULL) const
00036     {return new exprSub (clonearglist (d), nargs_);}
00037 
00039   std::string printOp () const
00040     {return "-";}
00041 
00043   CouNumber operator () ();
00044 
00046   expression *differentiate (int index); 
00047 
00049   expression *simplify ();
00050 
00052   virtual inline int Linearity () {
00053 
00054     int lin1 = arglist_ [0] -> Linearity ();
00055     int lin2 = arglist_ [1] -> Linearity ();
00056 
00057     if (lin1 < lin2) return lin2;
00058     else             return lin1;
00059   }
00060 
00062   void getBounds (expression *&, expression *&);
00063 
00065   void getBounds (CouNumber &lb, CouNumber &ub);
00066 
00069   virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
00070 
00072   virtual void generateCuts (expression *, //const OsiSolverInterface &, 
00073                              OsiCuts &, const CouenneCutGenerator *,
00074                              t_chg_bounds * = NULL, int = -1,
00075                              CouNumber = -COUENNE_INFINITY, 
00076                              CouNumber =  COUENNE_INFINITY);
00077 
00079   virtual enum expr_type code () {return COU_EXPRSUB;}
00080 
00082   bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *, enum auxSign = expression::AUX_EQ);
00083 };
00084 
00085 
00087 
00088 inline CouNumber exprSub::operator () ()
00089 {return ((*(*arglist_)) () - (*(arglist_ [1])) ());}
00090 
00091 }
00092 
00093 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 13 May 2015 for Couenne by  doxygen 1.6.1