Changeset 2081 for trunk/Cbc/src


Ignore:
Timestamp:
Sep 25, 2014 7:31:17 AM (5 years ago)
Author:
forrest
Message:

zerohalf thread safety plus restart with deterministic parallel

Location:
trunk/Cbc/src
Files:
3 edited

Legend:

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

    r2074 r2081  
    173173    { return maximumTries_;}
    174174
    175     /// Get switches (for debug)
     175    /// Get switches
    176176    inline int switches() const {
    177177        return switches_;
     178    }
     179    /// Set switches (for copying from virgin state)
     180    inline void setSwitches(int value) {
     181        switches_ = value;
    178182    }
    179183    /// Get whether the cut generator should be called in the normal place
  • trunk/Cbc/src/CbcModel.cpp

    r2080 r2081  
    16091609    dblParam_[CbcLargestChange] = 0.0;
    16101610    intParam_[CbcNumberBranches] = 0;
     1611    // when to check for restart
     1612    int nextCheckRestart=50;
    16111613    // Force minimization !!!!
    16121614    bool flipObjective = (solver_->getObjSense()<0.0);
     
    42034205            unlockThread();
    42044206        }
    4205         // If done 100 nodes see if worth trying reduction
    4206         if (numberNodes_ == 50 || numberNodes_ == 100) {
     4207        // If done 50/100 nodes see if worth trying reduction
     4208        if (numberNodes_ >= nextCheckRestart) {
     4209          if (nextCheckRestart<100)
     4210            nextCheckRestart=100;
     4211          else
     4212            nextCheckRestart=COIN_INT_MAX;
    42074213#ifdef COIN_HAS_CLP
    42084214            OsiClpSolverInterface * clpSolver
     
    66646670            } else {
    66656671                generator_[i] = new CbcCutGenerator(*rhs.virginGenerator_[i]);
    6666                 // But copy across maximumTries
     6672                // But copy across maximumTries and switches
    66676673                generator_[i]->setMaximumTries(rhs.generator_[i]->maximumTries());
     6674                generator_[i]->setSwitches(rhs.generator_[i]->switches());
    66686675            }
    66696676            virginGenerator_[i] = new CbcCutGenerator(*rhs.virginGenerator_[i]);
     
    1686716874            CoinCopyN(bestSolution_, numberColumns, baseModel->bestSolution_);
    1686816875            baseModel->setCutoff(getCutoff());
     16876            baseModel->handler_->message(CBC_ROUNDING, messages_)
     16877              << bestObjective_
     16878              << "heuristic"
     16879              << baseModel->numberIterations_
     16880              << baseModel->numberNodes_ << getCurrentSeconds()
     16881              << CoinMessageEol;
    1686916882        }
    1687016883        baseModel->numberSolutions_++;
  • trunk/Cbc/src/CbcThread.cpp

    r2078 r2081  
    175175    struct timespec absTime2;
    176176    my_gettime(&absTime2);
    177     double time2 = (double)absTime2.tv_sec + 1.0e-9 * (double)absTime2.tv_nsec;
     177    double time2 = absTime2.tv_sec + 1.0e-9 *
     178      static_cast<double>(absTime2.tv_nsec);
    178179    return time2;
    179180}
     
    16621663                CoinCopyN(bestSolution_, numberColumns, baseModel->bestSolution_);
    16631664                baseModel->setCutoff(getCutoff());
     1665                baseModel->handler_->message(CBC_ROUNDING, messages_)
     1666                << bestObjective_
     1667                << "heuristic"
     1668                << baseModel->numberIterations_
     1669                << baseModel->numberNodes_ << getCurrentSeconds()
     1670                << CoinMessageEol;
    16641671            }
    16651672            //stateOfSearch_
Note: See TracChangeset for help on using the changeset viewer.