CouenneObject.hpp

Go to the documentation of this file.
00001 /* $Id: CouenneObject.hpp 734 2011-07-04 01:34:41Z pbelotti $
00002  *
00003  * Name:    CouenneObject.hpp
00004  * Authors: Pierre Bonami, IBM Corp.
00005  *          Pietro Belotti, Carnegie Mellon University
00006  * Purpose: Object for auxiliary variables
00007  *
00008  * (C) Carnegie-Mellon University, 2006-11.
00009  * This file is licensed under the Common Public License (CPL)
00010  */
00011 
00012 #ifndef COUENNEOBJECT_HPP
00013 #define COUENNEOBJECT_HPP
00014 
00015 #include "BonBabSetupBase.hpp"
00016 #include "CoinFinite.hpp"
00017 
00018 #include "exprVar.hpp"
00019 #include "CouenneJournalist.hpp"
00020 #include "OsiBranchingObject.hpp"
00021 
00022 #define AGGR_MUL 2
00023 #define THRES_ZERO_SYMM 0.8
00024 
00025 const CouNumber closeToBounds = .05;
00026 const CouNumber default_alpha = .2;
00027 
00032 
00033 enum {TWO_LEFT,                 TWO_RIGHT,   TWO_RAND,
00034       THREE_LEFT, THREE_CENTER, THREE_RIGHT, THREE_RAND, BRANCH_NONE};
00035 
00036 class funtriplet;
00037 class CouenneProblem;
00038 class CouenneCutGenerator;
00039 
00040 CouNumber minMaxDelta (funtriplet *ft, CouNumber lb, CouNumber ub);
00041 CouNumber maxHeight   (funtriplet *ft, CouNumber lb, CouNumber ub);
00042 
00043 
00049 
00050 class CouenneObject: public OsiObject {
00051 
00052 public:
00053 
00055   enum pseudocostMult {INFEASIBILITY, 
00056                        INTERVAL_LP, INTERVAL_LP_REV,
00057                        INTERVAL_BR, INTERVAL_BR_REV,
00058                        PROJECTDIST};
00059 
00061   enum branch_obj {EXPR_OBJ, VAR_OBJ, VT_OBJ};
00062 
00064   enum brSelStrat {NO_STRATEGY, NO_BRANCH, MID_INTERVAL, MIN_AREA, BALANCED, LP_CENTRAL, LP_CLAMPED};
00065 
00067   CouenneObject ();
00068 
00070   CouenneObject (CouenneCutGenerator *cutgen,
00071                  CouenneProblem *p, 
00072                  exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
00073 
00075   CouenneObject (exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
00076 
00078   ~CouenneObject () {}
00079 
00081   CouenneObject (const CouenneObject &src);
00082 
00084   virtual CouenneObject * clone () const
00085   {return new CouenneObject (*this);}
00086 
00088   void setParameters (Bonmin::BabSetupBase *base);
00089 
00092   virtual double infeasibility (const OsiBranchingInformation *info, int &way) const;
00093 
00096   virtual double checkInfeasibility (const OsiBranchingInformation * info) const;
00097 
00099   virtual double feasibleRegion (OsiSolverInterface*, const OsiBranchingInformation*) const;
00100 
00103   virtual OsiBranchingObject *createBranch (OsiSolverInterface*, 
00104                                             const OsiBranchingInformation*, int) const;
00105 
00107   exprVar *Reference () const
00108   {return reference_;}
00109 
00111   enum brSelStrat Strategy ()  const
00112   {return strategy_;}
00113 
00115   CouNumber getBrPoint (funtriplet *ft, CouNumber x0, CouNumber l, CouNumber u) const;
00116 
00119   CouNumber midInterval (CouNumber x, CouNumber l, CouNumber u) const;
00120 
00122   virtual double downEstimate () const
00123   {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
00124     //printf ("DOWN EST = %g for ", downEstimate_); 
00125     //reference_ -> print (); 
00126     //printf ("\n");
00127     //}
00128   return downEstimate_;}
00129 
00131   virtual double upEstimate () const
00132   {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
00133     //printf ("UP EST = %g for ", upEstimate_); 
00134     //reference_ -> print (); 
00135     //printf ("\n");
00136     //}
00137   return upEstimate_;}
00138 
00143   void setEstimate (double est, int direction)
00144   {(direction ? upEstimate_ : downEstimate_) = est;}
00145 
00147   void setEstimates (const OsiBranchingInformation *info,
00148                      CouNumber *infeasibility,
00149                      CouNumber *brpt) const;
00150 
00152   virtual bool isCuttable () const {
00153     return (reference_ -> Image ()) ? 
00154       ((!(reference_ -> isInteger ())) &&
00155        reference_ -> Image () -> isCuttable (problem_, reference_ -> Index ())) :
00156       (!(reference_ -> isInteger ()));
00157   }
00158 
00160   virtual double intInfeasibility (double value, double lb, double ub) const;
00161 
00163   CouNumber lp_clamp () const
00164   {return lp_clamp_;}
00165 
00166   // Column number if single column object, -1 otherwise.
00167   virtual int columnNumber () const
00168   {//printf ("calling columnNumber(), returning %d\n",
00169    //((reference_) ? reference_ -> Index () : -1)); 
00170     return ((reference_) ? reference_ -> Index () : -1);}
00171 
00172 protected:
00173 
00175   CouenneCutGenerator *cutGen_;
00176 
00178   CouenneProblem *problem_;
00179 
00183   exprVar *reference_;
00184 
00186   enum brSelStrat strategy_;
00187 
00189   JnlstPtr jnlst_;
00190 
00193   CouNumber alpha_;
00194 
00196   CouNumber lp_clamp_;
00197 
00199   CouNumber feas_tolerance_;
00200 
00202   bool doFBBT_;
00203 
00205   bool doConvCuts_;
00206 
00208   mutable double downEstimate_;
00209 
00211   mutable double upEstimate_;
00212 
00214   enum pseudocostMult pseudoMultType_;
00215 };
00216 
00217 #endif

Generated on Mon Aug 8 03:04:11 2011 for Couenne by  doxygen 1.4.7