CouenneExprCos.hpp

Go to the documentation of this file.
00001 /* $Id: CouenneExprCos.hpp 615 2011-06-08 20:36:24Z pbelotti $
00002  *
00003  * Name:    exprCos.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of cosine 
00006  *
00007  * (C) Carnegie-Mellon University, 2006-10.
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPRCOS_HPP
00012 #define COUENNE_EXPRCOS_HPP
00013 
00014 #include "CouenneExprSin.hpp"
00015 
00016 namespace Couenne {
00017 
00019 
00020 class exprCos: public exprUnary {
00021 
00022  public:
00023 
00025   exprCos (expression *al):
00026     exprUnary (al) {}
00027 
00029   expression *clone (Domain *d = NULL) const
00030   {return new exprCos (argument_ -> clone (d));}
00031 
00033   inline unary_function F () 
00034   {return cos;}
00035 
00037   std::string printOp () const
00038   {return "cos";}
00039 
00041   inline CouNumber gradientNorm (const double *x) {
00042     return (argument_ -> Index () < 0) ? 
00043       0. : fabs (sin (x [argument_ -> Index ()]));
00044   }
00045 
00047   expression *differentiate (int index); 
00048 
00050   void getBounds (expression *&, expression *&);
00051 
00053   void getBounds (CouNumber &lb, CouNumber &ub);
00054 
00056   void generateCuts (expression *w, //const OsiSolverInterface &si, 
00057                      OsiCuts &cs, const CouenneCutGenerator *cg, 
00058                      t_chg_bounds * = NULL, int = -1, 
00059                      CouNumber = -COUENNE_INFINITY, 
00060                      CouNumber =  COUENNE_INFINITY);
00061 
00063   virtual enum expr_type code ()
00064   {return COU_EXPRCOS;}
00065 
00067   bool impliedBound (int index, CouNumber *l, CouNumber *u, t_chg_bounds *chg, enum auxSign = expression::AUX_EQ) {
00068 
00069     bool impl = trigImpliedBound (COU_COSINE, index, argument_ -> Index (), l, u, chg);
00070 
00071     if (impl && argument_ -> isInteger ()) {
00072 
00073       int ind = argument_ -> Index ();
00074       assert (ind >= 0);
00075       l [ind] = ceil  (l [ind] - COUENNE_EPS);
00076       u [ind] = floor (u [ind] + COUENNE_EPS);
00077     }
00078 
00079     return impl;
00080   }
00081 
00084   virtual CouNumber selectBranch (const CouenneObject *obj, 
00085                                   const OsiBranchingInformation *info,
00086                                   expression * &var, 
00087                                   double * &brpts, 
00088                                   double * &brDist, // distance of current LP
00089                                                     // point to new convexifications
00090                                   int &way)
00091   {return trigSelBranch (obj, info, var, brpts, brDist, way, COU_COSINE);}
00092 
00094   virtual void closestFeasible (expression *varind, expression *vardep,
00095                                 CouNumber& left, CouNumber& right) const;
00096 
00099   virtual bool isCuttable (CouenneProblem *problem, int index) const
00100   {return false;}
00101 
00103   //virtual enum convexity convexity () const;
00104 };
00105 
00106 
00108 CouNumber trigNewton (CouNumber, CouNumber, CouNumber);
00109 
00110 }
00111 
00112 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 14 Jan 2015 for Couenne by  doxygen 1.6.1