Ignore:
Timestamp:
Oct 2, 2007 9:16:23 AM (13 years ago)
Author:
forrest
Message:

for more repeatable runs and OsiPseudoCost?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcCompareBase.hpp

    r724 r814  
    2525public:
    2626  // Default Constructor
    27   CbcCompareBase () {test_=NULL;}
     27  CbcCompareBase () {test_=NULL;threaded_=false;}
    2828
    2929  // This allows any method to change behavior as it is called
     
    5353  // Copy constructor
    5454  CbcCompareBase ( const CbcCompareBase & rhs)
    55   {test_=rhs.test_;}
     55  {test_=rhs.test_;threaded_=rhs.threaded_;}
    5656   
    5757  // Assignment operator
    5858  CbcCompareBase & operator=( const CbcCompareBase& rhs)
    59   {  if (this!=&rhs) {test_=rhs.test_;}
     59  {  if (this!=&rhs) {test_=rhs.test_;threaded_=rhs.threaded_;}
    6060  return *this;
    6161  }
     
    7979    assert (x);
    8080    assert (y);
    81 #ifndef CBC_THREAD
    82     CbcNodeInfo * infoX = x->nodeInfo();
    83     assert (infoX);
    84     int nodeNumberX = infoX->nodeNumber();
    85     CbcNodeInfo * infoY = y->nodeInfo();
    86     assert (infoY);
    87     int nodeNumberY = infoY->nodeNumber();
    88     assert (nodeNumberX!=nodeNumberY);
    89     return (nodeNumberX>nodeNumberY);
    90 #else
    91     // doesn't work if threaded
    92     assert (x!=y);
    93     return (x>y);
    94 #endif
     81    if (!threaded_) {
     82      CbcNodeInfo * infoX = x->nodeInfo();
     83      assert (infoX);
     84      int nodeNumberX = infoX->nodeNumber();
     85      CbcNodeInfo * infoY = y->nodeInfo();
     86      assert (infoY);
     87      int nodeNumberY = infoY->nodeNumber();
     88      assert (nodeNumberX!=nodeNumberY);
     89      return (nodeNumberX>nodeNumberY);
     90    } else {
     91      // doesn't work if threaded
     92      assert (x!=y);
     93      return (x>y);
     94    }
    9595  }
     96  /// Say threaded
     97  inline void sayThreaded()
     98  { threaded_ = true;}
    9699protected:
    97100  CbcCompareBase * test_;
     101  // If not threaded we can use better way to break ties
     102  bool threaded_;
    98103};
    99104class CbcCompare {
Note: See TracChangeset for help on using the changeset viewer.