Changeset 416 for branches/devel/Cbc/src


Ignore:
Timestamp:
Jul 15, 2006 4:14:39 PM (13 years ago)
Author:
forrest
Message:

for allCuts

Location:
branches/devel/Cbc/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/CbcBranchActual.cpp

    r310 r416  
    33253325  }
    33263326}
     3327
     3328// Default Constructor
     3329CbcDummyBranchingObject::CbcDummyBranchingObject(CbcModel * model)
     3330  :CbcBranchingObject(model,0,0,0.5)
     3331{
     3332  numberBranchesLeft_=1;
     3333}
     3334
     3335
     3336// Copy constructor
     3337CbcDummyBranchingObject::CbcDummyBranchingObject ( const CbcDummyBranchingObject & rhs) :CbcBranchingObject(rhs)
     3338{
     3339}
     3340
     3341// Assignment operator
     3342CbcDummyBranchingObject &
     3343CbcDummyBranchingObject::operator=( const CbcDummyBranchingObject& rhs)
     3344{
     3345  if (this != &rhs) {
     3346    CbcBranchingObject::operator=(rhs);
     3347  }
     3348  return *this;
     3349}
     3350CbcBranchingObject *
     3351CbcDummyBranchingObject::clone() const
     3352{
     3353  return (new CbcDummyBranchingObject(*this));
     3354}
     3355
     3356
     3357// Destructor
     3358CbcDummyBranchingObject::~CbcDummyBranchingObject ()
     3359{
     3360}
     3361
     3362/*
     3363  Perform a dummy branch
     3364*/
     3365double
     3366CbcDummyBranchingObject::branch(bool normalBranch)
     3367{
     3368  if (model_->messageHandler()->logLevel()>2&&normalBranch)
     3369    print(normalBranch);
     3370  numberBranchesLeft_=0;
     3371  return 0.0;
     3372}
     3373// Print what would happen 
     3374void
     3375CbcDummyBranchingObject::print(bool normalBranch)
     3376{
     3377  printf("Dummy branch\n");
     3378}
  • branches/devel/Cbc/src/CbcBranchActual.hpp

    r295 r416  
    10111011  int * variable_;
    10121012};
     1013/** Dummy branching object
     1014
     1015  This object specifies a one-way dummy branch.
     1016  This is so one can carry on branching even when it looks feasible
     1017*/
     1018
     1019class CbcDummyBranchingObject : public CbcBranchingObject {
     1020
     1021public:
     1022
     1023  /// Default constructor
     1024  CbcDummyBranchingObject (CbcModel * model=NULL);
     1025
     1026  /// Copy constructor
     1027  CbcDummyBranchingObject ( const CbcDummyBranchingObject &);
     1028   
     1029  /// Assignment operator
     1030  CbcDummyBranchingObject & operator= (const CbcDummyBranchingObject& rhs);
     1031
     1032  /// Clone
     1033  virtual CbcBranchingObject * clone() const;
     1034
     1035  /// Destructor
     1036  virtual ~CbcDummyBranchingObject ();
     1037 
     1038  /** \brief Dummy branch
     1039  */
     1040  virtual double branch(bool normalBranch=false);
     1041
     1042  /** \brief Print something about branch - only if log level high
     1043  */
     1044  virtual void print(bool normalBranch);
     1045
     1046};
     1047
    10131048
    10141049#endif
  • branches/devel/Cbc/src/CbcModel.cpp

    r414 r416  
    15521552            statistics_[numberNodes2_-1]->sayInfeasible();
    15531553        }
    1554         if (newNode)
    1555         { if (newNode->variable() >= 0)
     1554        if (newNode) {
     1555          if (newNode->variable() < 0&&solverCharacteristics_->solverType()==4) {
     1556            // need to check if any cuts would do anything
     1557            OsiCuts theseCuts;
     1558            for (int i = 0;i<numberCutGenerators_;i++) {
     1559              bool generate = generator_[i]->normal();
     1560              // skip if not optimal and should be (maybe a cut generator has fixed variables)
     1561              if (generator_[i]->needsOptimalBasis()&&!solver_->basisIsAvailable())
     1562                generate=false;
     1563              if (!generator_[i]->mustCallAgain())
     1564                generate=false; // only special cuts
     1565              if (generate) {
     1566                generator_[i]->generateCuts(theseCuts,true,NULL) ;
     1567                int numberRowCutsAfter = theseCuts.sizeRowCuts() ;
     1568                if (numberRowCutsAfter) {
     1569                  // need dummy branch
     1570                  newNode->setBranchingObject(new CbcDummyBranchingObject(this));
     1571                  newNode->nodeInfo()->initializeInfo(1);
     1572                  break;
     1573                }
     1574              }
     1575            }
     1576          }
     1577          if (newNode->variable() >= 0)
    15561578          { handler_->message(CBC_BRANCH,messages_)
    15571579               << numberNodes_<< newNode->objectiveValue()
  • branches/devel/Cbc/src/CbcNode.hpp

    r303 r416  
    545545  {guessedObjectiveValue_=value;};
    546546  /// Branching object for this node
    547   const CbcBranchingObject * branchingObject() const
     547  inline const CbcBranchingObject * branchingObject() const
    548548  { return branch_;};
    549549  /// Modifiable branching object for this node
    550   CbcBranchingObject * modifiableBranchingObject() const
     550  inline CbcBranchingObject * modifiableBranchingObject() const
    551551  { return branch_;};
     552  /// Set branching object for this node (takes ownership)
     553  inline void setBranchingObject(CbcBranchingObject * branchingObject)
     554  { branch_ = branchingObject;};
    552555
    553556private:
  • branches/devel/Cbc/src/Makefile.in

    r415 r416  
    128128mkinstalldirs = $(install_sh) -d
    129129CONFIG_HEADER = $(top_builddir)/inc/config_cbc.h
    130 CONFIG_CLEAN_FILES = CbcOrClpParam.cpp CbcOrClpParam.hpp
     130CONFIG_CLEAN_FILES =
    131131am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
    132132am__vpath_adj = case $$p in \
Note: See TracChangeset for help on using the changeset viewer.