exprMul.hpp

Go to the documentation of this file.
00001 /* $Id: exprMul.hpp 154 2009-06-16 18:52:53Z pbelotti $ */
00002 /*
00003  * Name:    exprMul.hpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of multiplications
00006  *
00007  * (C) Carnegie-Mellon University, 2006. 
00008  * This file is licensed under the Common Public License (CPL)
00009  */
00010 
00011 #ifndef COUENNE_EXPRMUL_H
00012 #define COUENNE_EXPRMUL_H
00013 
00014 #include <vector>
00015 
00016 #include "exprOp.hpp"
00017 
00018 
00020 
00021 class exprMul: public exprOp {
00022 
00023  public:
00024 
00026   exprMul (expression **, int);
00027 
00029   exprMul (expression *, expression *);
00030 
00032   expression *clone (Domain *d = NULL) const
00033   {return new exprMul (clonearglist (d), nargs_);}
00034 
00036   std::string printOp () const
00037   {return "*";}
00038 
00040   inline CouNumber operator () ();
00041 
00043   CouNumber gradientNorm (const double *x);
00044 
00046   expression *differentiate (int index); 
00047 
00049   expression *simplify ();
00050 
00052   virtual int Linearity ();
00053 
00055   virtual void getBounds (expression *&, expression *&);
00056 
00058   virtual void getBounds (CouNumber &lb, CouNumber &ub);
00059 
00062   virtual exprAux *standardize (CouenneProblem *p, bool addAux = true);
00063 
00065   void generateCuts (expression *w, const OsiSolverInterface &si, 
00066                      OsiCuts &cs, const CouenneCutGenerator *cg, 
00067                      t_chg_bounds * = NULL, int = -1, 
00068                      CouNumber = -COUENNE_INFINITY, 
00069                      CouNumber =  COUENNE_INFINITY);
00070 
00072   virtual enum expr_type code () 
00073   {return COU_EXPRMUL;}
00074 
00076   bool impliedBound (int, CouNumber *, CouNumber *, t_chg_bounds *);
00077 
00080   virtual CouNumber selectBranch (const CouenneObject *obj, 
00081                                   const OsiBranchingInformation *info,
00082                                   expression * &var, 
00083                                   double * &brpts, 
00084                                   double * &brDist, // distance of current LP
00085                                                     // point to new convexifications
00086                                   int &way);
00087 
00089   virtual void closestFeasible (expression *varind,
00090                                 expression *vardep,
00091                                 CouNumber &left,
00092                                 CouNumber &right) const;
00093 protected:
00094 
00096   int impliedBoundMul (CouNumber wl, 
00097                        CouNumber wu, 
00098                        std::vector <CouNumber> &xl,
00099                        std::vector <CouNumber> &xu,
00100                        std::vector <std::pair <int, CouNumber> > &nl,
00101                        std::vector <std::pair <int, CouNumber> > &nu);
00102 
00104   CouNumber balancedMul (const OsiBranchingInformation *info, int index, int wind);
00105 
00108   virtual bool isCuttable (CouenneProblem *problem, int index) const
00109   {return false;} // concave on both sides, as for products
00110 };
00111 
00112 
00114 inline CouNumber exprMul:: operator () () {
00115 
00116   CouNumber ret = 1.;
00117   expression **al = arglist_;
00118 
00119   for (int n = nargs_; n--;)
00120     ret *= (**al++) ();
00121 
00122   return ret;
00123 }
00124 
00125 
00127 void unifiedProdCuts (const CouenneCutGenerator *, OsiCuts &, 
00128                       int, CouNumber, CouNumber, CouNumber,
00129                       int, CouNumber, CouNumber, CouNumber,
00130                       int, CouNumber, CouNumber, CouNumber,
00131                       t_chg_bounds *);
00132 
00133 
00134 // compute distance from future convexifications in set \f$\{(x,y,w):
00135 // w = xy\}\f$ with x,y,w bounded. Unified with exprDiv
00136 double *computeMulBrDist (const OsiBranchingInformation *info,
00137                           int xi, int yi, int wi, int brind, double *brpt, int nPts = 1);
00138 
00139 #endif

Generated on Wed Oct 7 03:10:23 2009 for Couenne by  doxygen 1.4.7