Changeset 2992


Ignore:
Timestamp:
Apr 15, 2020 4:56:03 AM (7 months ago)
Author:
forrest
Message:

so linked ordered sets work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/CbcBranchDynamic.cpp

    r2467 r2992  
    513513    // Get current number of infeasibilities, cutoff and current objective
    514514    CbcNode *node = model->currentNode();
    515     int numberUnsatisfied = node->numberUnsatisfied();
     515    int numberUnsatisfied = node ? node->numberUnsatisfied() : 1;
    516516    double cutoff = model->getCutoff();
    517     double objectiveValue = node->objectiveValue();
     517    double objectiveValue = node ? node->objectiveValue() : 0.0;
    518518#endif
    519519    // got a solution
     
    521521    double maxValue = CoinMax(changeDown, changeUp);
    522522    // Reduce
    523 #ifdef TRY_STUFF
    524     //maxValue = CoinMin(maxValue,minValue*4.0);
    525 #else
    526     //maxValue = CoinMin(maxValue,minValue*2.0);
    527 #endif
    528523#ifndef WEIGHT_PRODUCT
    529524    value = WEIGHT_AFTER * minValue + (1.0 - WEIGHT_AFTER) * maxValue;
     
    536531    double useBest = bestCriterion_;
    537532#if TRY_STUFF > 1
    538     int thisNumber = CoinMin(numInfUp, numInfDown);
    539     int bestNumber = CoinMin(bestNumberUp_, bestNumberDown_);
    540     double distance = cutoff - objectiveValue;
    541     assert(distance >= 0.0);
    542     if (useValue + 0.1 * distance > useBest && useValue * 1.1 > useBest && useBest + 0.1 * distance > useValue && useBest * 1.1 > useValue) {
    543       // not much in it - look at unsatisfied
    544       if (thisNumber < numberUnsatisfied || bestNumber < numberUnsatisfied) {
    545         double perInteger = distance / (static_cast< double >(numberUnsatisfied));
    546         useValue += thisNumber * perInteger;
    547         useBest += bestNumber * perInteger;
     533    if (node) {
     534      int thisNumber = CoinMin(numInfUp, numInfDown);
     535      int bestNumber = CoinMin(bestNumberUp_, bestNumberDown_);
     536      double distance = cutoff - objectiveValue;
     537      assert(distance >= 0.0);
     538      if (useValue + 0.1 * distance > useBest && useValue * 1.1 > useBest && useBest + 0.1 * distance > useValue && useBest * 1.1 > useValue) {
     539        // not much in it - look at unsatisfied
     540        if (thisNumber < numberUnsatisfied || bestNumber < numberUnsatisfied) {
     541          double perInteger = distance / (static_cast< double >(numberUnsatisfied));
     542          useValue += thisNumber * perInteger;
     543          useBest += bestNumber * perInteger;
     544        }
    548545      }
    549546    }
Note: See TracChangeset for help on using the changeset viewer.