# CouenneObject.hpp

Go to the documentation of this file.

    00001 /* $Id: CouenneObject.hpp 793 2012-01-26 03:07:16Z 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 Eclipse Public License (EPL)
    00010  */
    00011
    00012 #ifndef COUENNEOBJECT_HPP
    00013 #define COUENNEOBJECT_HPP
    00014
    00015 #include "BonBabSetupBase.hpp"
    00016
    00017 #include "CouenneExprVar.hpp"
    00018 #include "CouenneJournalist.hpp"
    00019 #include "OsiBranchingObject.hpp"
    00020
    00021 namespace Couenne {
    00022
    00023 const CouNumber default_alpha  = 0.25;
    00024 const CouNumber default_clamp  = 0.2;
    00025 const CouNumber max_pseudocost = 1000.;
    00026
    00028 const double large_bound = 1e9;
    00029
    00030 #define AGGR_MUL 2
    00031 #define THRES_ZERO_SYMM 0.8
    00032
    00033 const CouNumber closeToBounds = .05;
    00034
    00039
    00040 enum {TWO_LEFT,                 TWO_RIGHT,   TWO_RAND,
    00041       THREE_LEFT, THREE_CENTER, THREE_RIGHT, THREE_RAND, BRANCH_NONE};
    00042
    00043 class funtriplet;
    00044 class CouenneProblem;
    00045 class CouenneCutGenerator;
    00046
    00047 CouNumber minMaxDelta (funtriplet *ft, CouNumber lb, CouNumber ub);
    00048 CouNumber maxHeight   (funtriplet *ft, CouNumber lb, CouNumber ub);
    00049
    00050
    00056
    00057   class CouenneObject: public OsiObject {
    00058
    00059 public:
    00060
    00062     enum pseudocostMult {INFEASIBILITY,
    00063                        INTERVAL_LP, INTERVAL_LP_REV,
    00064                        INTERVAL_BR, INTERVAL_BR_REV,
    00065                        PROJECTDIST};
    00066
    00068   enum branch_obj {EXPR_OBJ, VAR_OBJ, VT_OBJ};
    00069
    00071   enum brSelStrat {NO_STRATEGY, NO_BRANCH, MID_INTERVAL, MIN_AREA, BALANCED, LP_CENTRAL, LP_CLAMPED};
    00072
    00074   CouenneObject ();
    00075
    00077   CouenneObject (CouenneCutGenerator *cutgen,
    00078                  CouenneProblem *p,
    00079                  exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
    00080
    00082   CouenneObject (exprVar *ref, Bonmin::BabSetupBase *base, JnlstPtr jnlst);
    00083
    00085   ~CouenneObject () {}
    00086
    00088   CouenneObject (const CouenneObject &src);
    00089
    00091   virtual CouenneObject * clone () const
    00092   {return new CouenneObject (*this);}
    00093
    00095   void setParameters (Bonmin::BabSetupBase *base);
    00096
    00099   virtual double infeasibility (const OsiBranchingInformation *info, int &way) const;
    00100
    00103   virtual double checkInfeasibility (const OsiBranchingInformation * info) const;
    00104
    00106   virtual double feasibleRegion (OsiSolverInterface*, const OsiBranchingInformation*) const;
    00107
    00110   virtual OsiBranchingObject *createBranch (OsiSolverInterface*,
    00111                                             const OsiBranchingInformation*, int) const;
    00112
    00114   exprVar *Reference () const
    00115   {return reference_;}
    00116
    00118   enum brSelStrat Strategy ()  const
    00119   {return strategy_;}
    00120
    00122   CouNumber getBrPoint (funtriplet *ft, CouNumber x0, CouNumber l, CouNumber u, const OsiBranchingInformation *info = NULL) const;
    00123
    00126   CouNumber midInterval (CouNumber x, CouNumber l, CouNumber u, const OsiBranchingInformation *info = NULL) const;
    00127
    00129   virtual double downEstimate () const
    00130   {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
    00131     //printf ("DOWN EST = %g for ", downEstimate_);
    00132     //reference_ -> print ();
    00133     //printf ("\n");
    00134     //}
    00135   return downEstimate_;}
    00136
    00138   virtual double upEstimate () const
    00139   {//if (jnlst_ -> ProduceOutput (J_MATRIX, J_BRANCHING)) {
    00140     //printf ("UP EST = %g for ", upEstimate_);
    00141     //reference_ -> print ();
    00142     //printf ("\n");
    00143     //}
    00144   return upEstimate_;}
    00145
    00150   void setEstimate (double est, int direction)
    00151   {(direction ? upEstimate_ : downEstimate_) = est;}
    00152
    00154   void setEstimates (const OsiBranchingInformation *info,
    00155                      CouNumber *infeasibility,
    00156                      CouNumber *brpt) const;
    00157
    00159   virtual bool isCuttable () const {
    00160     return (reference_ -> Image ()) ?
    00161       ((!(reference_ -> isInteger ())) &&
    00162        reference_ -> Image () -> isCuttable (problem_, reference_ -> Index ())) :
    00163       (!(reference_ -> isInteger ()));
    00164   }
    00165
    00167   virtual double intInfeasibility (double value, double lb, double ub) const;
    00168
    00170   CouNumber lp_clamp () const
    00171   {return lp_clamp_;}
    00172
    00174   virtual int columnNumber () const
    00175   {return (reference_ ? reference_ -> Index () : -1);}
    00176
    00177 protected:
    00178
    00180   CouenneCutGenerator *cutGen_;
    00181
    00183   CouenneProblem *problem_;
    00184
    00188   exprVar *reference_;
    00189
    00191   enum brSelStrat strategy_;
    00192
    00194   JnlstPtr jnlst_;
    00195
    00198   CouNumber alpha_;
    00199
    00201   CouNumber lp_clamp_;
    00202
    00204   CouNumber feas_tolerance_;
    00205
    00207   bool doFBBT_;
    00208
    00210   bool doConvCuts_;
    00211
    00213   mutable double downEstimate_;
    00214
    00216   mutable double upEstimate_;
    00217
    00219   enum pseudocostMult pseudoMultType_;
    00220 };
    00221
    00222 }
    00223
    00224 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines