Ignore:
Timestamp:
Mar 16, 2009 6:30:25 AM (10 years ago)
Author:
forrest
Message:

chnages to try and make faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcCompareActual.cpp

    r1121 r1132  
    142142    weight_(-1.0),
    143143    saveWeight_(0.0),
     144    cutoff_(COIN_DBL_MAX),
     145    bestPossible_(-COIN_DBL_MAX),
    144146    numberSolutions_(0),
    145147    treeSize_(0),
     
    154156    weight_(weight) ,
    155157    saveWeight_(0.0),
     158    cutoff_(COIN_DBL_MAX),
     159    bestPossible_(-COIN_DBL_MAX),
    156160    numberSolutions_(0),
    157161    treeSize_(0),
     
    169173  weight_=rhs.weight_;
    170174  saveWeight_ = rhs.saveWeight_;
     175  cutoff_ = rhs.cutoff_;
     176  bestPossible_ = rhs.bestPossible_;
    171177  numberSolutions_=rhs.numberSolutions_;
    172178  treeSize_ = rhs.treeSize_;
     
    189195    weight_=rhs.weight_;
    190196    saveWeight_ = rhs.saveWeight_;
     197    cutoff_ = rhs.cutoff_;
     198    bestPossible_ = rhs.bestPossible_;
    191199    numberSolutions_=rhs.numberSolutions_;
    192200    treeSize_ = rhs.treeSize_;
     
    244252  }
    245253#else
     254  //weight_=0.0;
    246255  if ((weight_==-1.0&&(y->depth()>breadthDepth_&&x->depth()>breadthDepth_))||weight_==-3.0||weight_==-2.0) {
    247256    int adjust =  (weight_==-3.0) ? 10000 : 0;
     
    280289    }
    281290    // after solution
     291    assert (cutoff_<1.0e40);
     292#define THRESH2 0.999
     293#define TRY_THIS 0
     294#if TRY_THIS==0
    282295    double weight = CoinMax(weight_,0.0);
    283296    double testX =  x->objectiveValue()+ weight*x->numberUnsatisfied();
    284297    double testY = y->objectiveValue() + weight*y->numberUnsatisfied();
    285     if (testX!=testY)
     298#elif TRY_THIS==1
     299    /* compute what weight would have to be to hit target
     300       then reverse sign as large weight good */
     301    double target = (1.0-THRESH2)*bestPossible_ + THRESH2*cutoff_;
     302    double weight;
     303    weight = (target-x->objectiveValue())/
     304      static_cast<double>(x->numberUnsatisfied());
     305    double testX = - weight;
     306    weight = (target-y->objectiveValue())/
     307      static_cast<double>(y->numberUnsatisfied());
     308    double testY = - weight;
     309#elif TRY_THIS==2
     310    // Use estimates
     311    double testX = x->guessedObjectiveValue();
     312    double testY = y->guessedObjectiveValue();
     313#elif THY_THIS==3
     314#define THRESH 0.95
     315    if (x->objectiveValue()-bestPossible_>THRESH*(cutoff_-bestPossible_))
     316      testX *= 2.0; // make worse
     317    if (y->objectiveValue()-bestPossible_>THRESH*(cutoff_-bestPossible_))
     318      testY *= 2.0; // make worse
     319#endif
     320    if (testX!=testY)
    286321      return testX > testY;
    287322    else
     
    309344  if (numberSolutions_>5)
    310345    weight_ =0.0; // this searches on objective
     346  cutoff_ = model->getCutoff();
    311347}
    312348// This allows method to change behavior
Note: See TracChangeset for help on using the changeset viewer.