/home/coin/SVN-release/OS-2.2.0/Couenne/src/expression/operators/exprInv.hpp

Go to the documentation of this file.
00001 /* $Id: exprInv.hpp 217 2009-07-08 17:02:07Z pbelotti $
00002  *
00003  * Name:    exprInv.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of inverse of a function (1/f(x))
00006  *
00007  * (C) Carnegie-Mellon University, 2006-09.
00008  * This file is licensed under the Common Public License (CPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPRINV_H
00012 #define COUENNE_EXPRINV_H
00013 
00014 #include "exprUnary.hpp"
00015 
00016 
00018 inline CouNumber inv (register CouNumber arg) 
00019 {return 1. / arg;}
00020 
00021 
00023 inline CouNumber oppInvSqr (register CouNumber x) 
00024 {return (- inv (x*x));}
00025 
00026 
00028 inline CouNumber inv_dblprime (register CouNumber x) 
00029 {return (2 * inv (x*x*x));}
00030 
00031 
00033 
00034 class exprInv: public exprUnary {
00035 
00036  public:
00037 
00039   exprInv (expression *al): 
00040     exprUnary (al) {} //< non-leaf expression, with argument list
00041 
00043   expression *clone (Domain *d = NULL) const
00044     {return new exprInv (argument_ -> clone (d));}
00045 
00047   inline unary_function F () {return inv;}
00048 
00050   virtual void print (std::ostream &out = std::cout, bool = false) const;
00051 
00053   CouNumber gradientNorm (const double *x);
00054 
00056   expression *differentiate (int index); 
00057 
00059   virtual inline int Linearity () {
00060     if (argument_ -> Type () == CONST) return CONSTANT;
00061     else                               return NONLINEAR;
00062   }
00063 
00065   void getBounds (expression *&, expression *&);
00066 
00068   void getBounds (CouNumber &lb, CouNumber &ub);
00069 
00071   void generateCuts (expression *w, //const OsiSolverInterface &si, 
00072                      OsiCuts &cs, const CouenneCutGenerator *cg, 
00073                      t_chg_bounds * = NULL, int = -1, 
00074                      CouNumber = -COUENNE_INFINITY, 
00075                      CouNumber =  COUENNE_INFINITY);
00076 
00078   virtual enum expr_type code () {return COU_EXPRINV;}
00079 
00081   bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *);
00082 
00085   virtual CouNumber selectBranch (const CouenneObject *obj, 
00086                                   const OsiBranchingInformation *info,
00087                                   expression * &var, 
00088                                   double * &brpts, 
00089                                   double * &brDist, // distance of current LP
00090                                                     // point to new convexifications
00091                                   int &way);
00092 
00094   virtual bool isBijective() const {return true;}
00095 
00097   virtual CouNumber inverse(expression *vardep) const
00098   {
00099     return 1./((*vardep)());
00100   }
00101 
00104   virtual bool isCuttable (CouenneProblem *problem, int index) const;
00105 };
00106 
00107 #endif

Generated on Thu Aug 5 03:02:57 2010 by  doxygen 1.4.7