Ignore:
Timestamp:
Jun 26, 2007 5:17:15 AM (12 years ago)
Author:
forrest
Message:

trunk from branches/devel

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:externals
      •  

        old new  
        1 MSVisualStudio   https://projects.coin-or.org/svn/MSVisualStudio/trunk/ExternalsDirs/Cbc
        2 BuildTools    https://projects.coin-or.org/svn/BuildTools/stable/0.5
         1MSVisualStudio   https://projects.coin-or.org/svn/MSVisualStudio/branches/devel/ExternalsDirs/Cbc
         2BuildTools    https://projects.coin-or.org/svn/BuildTools/trunk
        33ThirdParty/ASL https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.0
         4ThirdParty/Blas https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.0
         5ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.0
        46Data/Netlib   https://projects.coin-or.org/svn/Data/stable/1.0/Netlib
        57Data/Sample   https://projects.coin-or.org/svn/Data/stable/1.0/Sample
  • trunk/Cbc/src/CbcCompareActual.cpp

    r485 r640  
    142142    saveWeight_(0.0),
    143143    numberSolutions_(0),
    144     treeSize_(0)
     144    treeSize_(0),
     145    breadthDepth_(5)
    145146{
    146147  test_=this;
     
    153154    saveWeight_(0.0),
    154155    numberSolutions_(0),
    155     treeSize_(0)
     156    treeSize_(0),
     157    breadthDepth_(5)
    156158{
    157159  test_=this;
     
    168170  numberSolutions_=rhs.numberSolutions_;
    169171  treeSize_ = rhs.treeSize_;
     172  breadthDepth_ = rhs.breadthDepth_;
    170173}
    171174
     
    187190    numberSolutions_=rhs.numberSolutions_;
    188191    treeSize_ = rhs.treeSize_;
     192    breadthDepth_ = rhs.breadthDepth_;
    189193  }
    190194  return *this;
     
    201205{
    202206#if 0
    203   // was
    204   if (weight_<0.0||treeSize_>100000) {
    205     // before solution
    206     /* printf("x %d %d %g, y %d %d %g\n",
    207        x->numberUnsatisfied(),x->depth(),x->objectiveValue(),
    208        y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */
    209     if (x->numberUnsatisfied() > y->numberUnsatisfied())
    210       return true;
    211     else if (x->numberUnsatisfied() < y->numberUnsatisfied())
    212       return false;
     207  // always choose *smallest* depth if one or both <= breadthDepth_
     208  int depthX = x->depth();
     209  int depthY = y->depth();
     210  if (depthX<=breadthDepth_||depthY<=breadthDepth_) {
     211    if (depthX!=depthY)
     212      return depthX > depthY;
    213213    else
    214       return x->depth() < y->depth();
    215   } else {
    216     // after solution
    217     return x->objectiveValue()+ weight_*x->numberUnsatisfied() >
    218       y->objectiveValue() + weight_*y->numberUnsatisfied();
    219   }
    220 #else
    221   if ((weight_==-1.0&&(y->depth()>7||x->depth()>7))||weight_==-3.0) {
     214      return equalityTest(x,y); // so ties will be broken in consistent manner
     215  }
     216  if (weight_==-1.0||weight_==-3.0) {
    222217    int adjust =  (weight_==-3.0) ? 10000 : 0;
    223218    // before solution
     
    238233    }
    239234  } else {
    240     // always choose *smallest* depth if <= 7
     235    // after solution
     236    double weight = CoinMax(weight_,0.0);
     237    double testX =  x->objectiveValue()+ weight*x->numberUnsatisfied();
     238    double testY = y->objectiveValue() + weight*y->numberUnsatisfied();
     239    if (testX!=testY)
     240      return testX > testY;
     241    else
     242      return equalityTest(x,y); // so ties will be broken in consistent manner
     243  }
     244#else
     245  if ((weight_==-1.0&&(y->depth()>breadthDepth_||x->depth()>breadthDepth_))||weight_==-3.0) {
     246    int adjust =  (weight_==-3.0) ? 10000 : 0;
     247    // before solution
     248    /*printf("x %d %d %g, y %d %d %g\n",
     249       x->numberUnsatisfied(),x->depth(),x->objectiveValue(),
     250       y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */
     251    if (x->numberUnsatisfied() > y->numberUnsatisfied()+adjust) {
     252      return true;
     253    } else if (x->numberUnsatisfied() < y->numberUnsatisfied()-adjust) {
     254      return false;
     255    } else {
     256      int depthX = x->depth();
     257      int depthY = y->depth();
     258      if (depthX!=depthY)
     259        return depthX < depthY;
     260      else
     261        return equalityTest(x,y); // so ties will be broken in consistent manner
     262    }
     263  } else {
     264    // always choose *greatest* depth if both <= breadthDepth_ otherwise <= breadthDepth_ if just one
    241265    int depthX = x->depth();
    242266    int depthY = y->depth();
    243     if (depthX<=7||depthY<=7) {
    244       if (depthX!=depthY) {
    245         return depthX < depthY;
     267    if (depthX<=breadthDepth_||depthY<=breadthDepth_) {
     268      if (depthX<=breadthDepth_&&depthY<=breadthDepth_) {
     269        if (depthX!=depthY) {
     270          return depthX < depthY;
     271        }
     272      } else {
     273        if (depthX!=depthY) {
     274          return depthX > depthY;
     275        }
    246276      }
    247277    }
Note: See TracChangeset for help on using the changeset viewer.