CouenneObject.hpp

Go to the documentation of this file.
00001 /* $Id: CouenneObject.hpp 141 2009-06-03 04:19:19Z 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-08.
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 
00031 
00032 enum {TWO_LEFT,                 TWO_RIGHT,   TWO_RAND,
00033       THREE_LEFT, THREE_CENTER, THREE_RIGHT, THREE_RAND, BRANCH_NONE};
00034 
00035 class funtriplet;
00036 class CouenneProblem;
00037 
00038 CouNumber minMaxDelta (funtriplet *ft, CouNumber lb, CouNumber ub);
00039 CouNumber maxHeight   (funtriplet *ft, CouNumber lb, CouNumber ub);
00040 
00041 
00047 
00048 class CouenneObject: public OsiObject {
00049 
00050 public:
00051 
00053   enum pseudocostMult {INFEASIBILITY, 
00054                        INTERVAL_LP, INTERVAL_LP_REV,
00055                        INTERVAL_BR, INTERVAL_BR_REV,
00056                        PROJECTDIST};
00057 
00059   enum branch_obj {EXPR_OBJ, VAR_OBJ, VT_OBJ};
00060 
00062   enum brSelStrat {NO_STRATEGY, NO_BRANCH, MID_INTERVAL, MIN_AREA, BALANCED, LP_CENTRAL, LP_CLAMPED};
00063 
00065   CouenneObject ();
00066 
00068   CouenneObject (CouenneProblem *p, 
00069                  exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
00070 
00072   CouenneObject (exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
00073 
00075   ~CouenneObject () {}
00076 
00078   CouenneObject (const CouenneObject &src);
00079 
00081   virtual OsiObject * clone () const
00082   {return new CouenneObject (*this);}
00083 
00085   void setParameters (Bonmin::BabSetupBase *base);
00086 
00089   virtual double infeasibility (const OsiBranchingInformation *info, int &way) const;
00090 
00093   virtual double checkInfeasibility (const OsiBranchingInformation * info) const;
00094 
00096   virtual double feasibleRegion (OsiSolverInterface*, const OsiBranchingInformation*) const;
00097 
00100   virtual OsiBranchingObject *createBranch (OsiSolverInterface*, 
00101                                             const OsiBranchingInformation*, int) const;
00102 
00104   exprVar *Reference () const
00105   {return reference_;}
00106 
00108   enum brSelStrat Strategy ()  const
00109   {return strategy_;}
00110 
00112   CouNumber getBrPoint (funtriplet *ft, CouNumber x0, CouNumber l, CouNumber u) const;
00113 
00116   CouNumber midInterval (CouNumber x, CouNumber l, CouNumber u) const;
00117 
00119   virtual double downEstimate () const
00120   {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
00121     //printf ("DOWN EST = %g for ", downEstimate_); 
00122     //reference_ -> print (); 
00123     //printf ("\n");
00124     //}
00125   return downEstimate_;}
00126 
00128   virtual double upEstimate () const
00129   {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
00130     //printf ("UP EST = %g for ", upEstimate_); 
00131     //reference_ -> print (); 
00132     //printf ("\n");
00133     //}
00134   return upEstimate_;}
00135 
00140   void setEstimate (double est, int direction)
00141   {(direction ? upEstimate_ : downEstimate_) = est;}
00142 
00144   void setEstimates (const OsiBranchingInformation *info,
00145                      CouNumber *infeasibility,
00146                      CouNumber *brpt) const;
00147 
00149   virtual bool isCuttable () const {
00150     return (reference_ -> Image ()) ? 
00151       ((!(reference_ -> isInteger ())) &&
00152        reference_ -> Image () -> isCuttable (problem_, reference_ -> Index ())) :
00153       (!(reference_ -> isInteger ()));
00154   }
00155 
00157   virtual double intInfeasibility (double value) const
00158   {return CoinMin (value - floor (value + COUENNE_EPS), ceil (value - COUENNE_EPS) - value);}
00159 
00160 protected:
00161 
00163   CouenneProblem *problem_;
00164 
00168   exprVar *reference_;
00169 
00171   enum brSelStrat strategy_;
00172 
00174   JnlstPtr jnlst_;
00175 
00178   CouNumber alpha_;
00179 
00181   CouNumber lp_clamp_;
00182 
00184   CouNumber feas_tolerance_;
00185 
00187   bool doFBBT_;
00188 
00190   bool doConvCuts_;
00191 
00193   mutable double downEstimate_;
00194 
00196   mutable double upEstimate_;
00197 
00199   enum pseudocostMult pseudoMultType_;
00200 };
00201 
00202 #endif

Generated on Wed Jul 8 03:05:41 2009 for Couenne by  doxygen 1.4.7