Ignore:
Timestamp:
Dec 9, 2009 4:46:30 PM (10 years ago)
Author:
lou
Message:

This commit removes remaining code associated with NEW_STYLE_SOLVER. See the notes in CbcLinkedUtils? for why the remaining code remains.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcModel.cpp

    r1377 r1387  
    17041704                if (debugger)
    17051705                    debugger->redoSolution(numberColumns, originalColumns);
     1706                // User-provided solution might have been best. Synchronise.
    17061707                if (bestSolution_) {
    17071708                    // need to redo - in case no better found in BAB
     
    18501851#ifdef CLIQUE_ANALYSIS
    18511852    // set up for probing
     1853    // If we're doing clever stuff with cliques, additional info here.
    18521854    if (!parentModel_)
    18531855        probingInfo_ = new CglTreeProbingInfo(solver_);
     
    18731875    // See if hot start wanted
    18741876    CbcCompareBase * saveCompare = NULL;
     1877    // User supplied hotstart. Adapt for preprocessing.
    18751878    if (hotstartSolution_) {
    18761879        if (strategy_ && strategy_->preProcessState() > 0) {
     
    19251928    if (numberBeforeTrust_)
    19261929        convertToDynamic();
    1927     // Set up char array to say if integer
     1930    // Set up char array to say if integer (speed)
    19281931    delete [] integerInfo_;
    19291932    {
     
    21192122        branchingMethod_->chooseMethod()->setSolver(solver_);
    21202123    }
    2121     // take off heuristics if have to
     2124    // take off heuristics if have to (some do not work with SOS, for example)
     2125    // object should know what's safe.
    21222126    {
    21232127        int numberOdd = 0;
     
    23622366            // tighten and set best solution
    23632367            // A) tight bounds on integer variables
     2368            /*
     2369              storedRowCuts_ are coming in from outside, probably for nonlinear.
     2370              John was unsure about origin.
     2371            */
    23642372            const double * lower = solver_->getColLower();
    23652373            const double * upper = solver_->getColUpper();
     
    24072415  debugging hook.  There's no obvious place in the code where this is set to
    24082416  a negative value.
     2417
     2418  User hook, says John.
    24092419*/
    24102420    if ( intParam_[CbcMaxNumNode] < 0)
     
    25912601        feasible = false;
    25922602#if defined(COIN_HAS_CLP)&&defined(COIN_HAS_CPX)
     2603/*
     2604  This is the notion of using Cbc stuff to get going, then calling cplex to
     2605  finish off.
     2606*/
    25932607    if (feasible && (specialOptions_&16384) != 0 && fastNodeDepth_ == -2 && !parentModel_) {
    25942608        // Use Cplex to do search!
     
    27042718    }
    27052719#endif
     2720/*
     2721  A hook to use clp to quickly explore some part of the tree.
     2722*/
    27062723    if (fastNodeDepth_ == 1000 &&/*!parentModel_*/(specialOptions_&2048) == 0) {
    27072724        fastNodeDepth_ = -1;
     
    31463163            CglTreeProbingInfo info(*probingInfo_);
    31473164#if 0
     3165/*
     3166  Marginal idea. Further exploration probably good. Build some extra
     3167  cliques from probing info. Not quite worth the effort?
     3168*/
    31483169            OsiSolverInterface * fake = info.analyze(*solver_, 1);
    31493170            if (fake) {
     
    31613182                printf("%d implications on %d 0-1\n", toZero[number01], number01);
    31623183#endif
     3184                // Create a cut generator that remembers implications discovered at root.
    31633185                CglImplication implication(probingInfo_);
    31643186                addCutGenerator(&implication, 1, "ImplicationCuts", true, false, false, -200);
     
    36253647            }
    36263648#endif
     3649/*
     3650  Decide if we want to do a restart.
     3651*/
    36273652            if (saveSolver) {
    36283653                bool tryNewSearch = solverCharacteristics_->reducedCostsAccurate() &&
     
    37233748                    double * newSolution = new double[numberColumns];
    37243749                    double objectiveValue = checkCutoffForRestart;
     3750                    // Save the best solution so far.
    37253751                    CbcSerendipity heuristic(*this);
    37263752                    if (bestSolution_)
    37273753                        heuristic.setInputSolution(bestSolution_, bestObjective_);
     3754                    // Magic number
    37283755                    heuristic.setFractionSmall(0.8);
     3756                    // `pumpTune' to stand-alone solver for explanations.
    37293757                    heuristic.setFeasibilityPumpOptions(1008013);
    37303758                    // Use numberNodes to say how many are original rows
     
    37463774                        delete [] newSolution;
    37473775                    } else {
     3776                        // 1 for sol'n, 2 for finished, 3 for both
    37483777                        if ((returnCode&1) != 0) {
    37493778                            // increment number of solutions so other heuristics can test
     
    37793808        assert(!solverCharacteristics_->solutionAddsCuts() || solverCharacteristics_->mipFeasible());
    37803809#endif
     3810// Sets percentage of time when we try diving. Diving requires a bit of heap reorganisation, because
     3811// we need to replace the comparison function to dive, and that requires reordering to retain the
     3812// heap property.
    37813813#define DIVE_WHEN 1000
    37823814#define DIVE_STOP 2000
     
    37873819                    CbcCompareDefault * compare = dynamic_cast<CbcCompareDefault *>
    37883820                                                  (nodeCompare_);
     3821                    // Don't interfere if user has replaced the compare function.
    37893822                    if (compare) {
    37903823                        //printf("Redoing tree\n");
     
    37953828            }
    37963829        }
     3830        // replace current cutoff?
    37973831        if (cutoff > getCutoff()) {
    37983832            double newCutoff = getCutoff();
     
    38303864            if (parallelMode() > 0)
    38313865                lockThread();
    3832             // Do from deepest
     3866            // Do from deepest (clean tree w.r.t. new solution)
    38333867            tree_->cleanTree(this, newCutoff, bestPossibleObjective_) ;
    38343868            nodeCompare_->newSolution(this) ;
    38353869            nodeCompare_->newSolution(this, continuousObjective_,
    38363870                                      continuousInfeasibilities_) ;
     3871            // side effect: redo heap
    38373872            tree_->setComparison(*nodeCompare_) ;
    38383873            if (tree_->empty()) {
     
    38913926            verifyCutSize (tree_, *this);
    38923927#endif
    3893             // redo tree if wanted
     3928            // redo tree if requested
    38943929            if (redoTree)
    38953930                tree_->setComparison(*nodeCompare_) ;
     
    38973932                unlockThread();
    38983933        }
     3934        // Had hotstart before, now switched off
    38993935        if (saveCompare && !hotstartSolution_) {
    39003936            // hotstart switched off
     
    39834019            node = tree_->bestNode(cutoff) ;
    39844020            // Possible one on tree worse than cutoff
     4021            // Wierd comparison function can leave ineligible nodes on tree
    39854022            if (!node || node->objectiveValue() > cutoff)
    39864023                continue;
     
    46824719    }
    46834720    delete saveSolver;
     4721    // Undo preprocessing performed during BaB.
    46844722    if (strategy_ && strategy_->preProcessState() > 0) {
    46854723        // undo preprocessing
     
    69877025  case we'll create an array of empty CbcModels (!). Solvers will be cloned
    69887026  later.
     7027
     7028  Don't start up threads here if we're already threaded.
    69897029*/
    69907030    CbcModel ** threadModel = NULL;
     
    71737213#endif
    71747214            update.objectNumber_ = iObject;
     7215            // Care! We must be careful not to update the same variable in parallel threads.
    71757216            addUpdateInformation(update);
    71767217            //#define TIGHTEN_BOUNDS
     
    73387379    if (numberTries < 0) {
    73397380        numberTries = -numberTries ;
    7340         minimumDrop *= 1.0e-5 ;
    7341         if (numberTries >= -1000000) {
     7381        // minimumDrop *= 1.0e-5 ;
     7382        // if (numberTries >= -1000000) {
    73427383            //numberTries=100;
    73437384            minimumDrop = -1.0;
    7344         }
     7385        // }
    73457386        //numberTries=CoinMax(numberTries,100);
    73467387        allowZeroIterations = true;
     
    73627403
    73637404    currentPassNumber_ = 0 ;
     7405    // Really primalIntegerTolerance; relates to an illposed problem with various
     7406    // integer solutions depending on integer tolerance.
    73647407    double primalTolerance = 1.0e-7 ;
    73657408    // We may need to keep going on
     
    73937436        numberTries-- ;
    73947437        if (numberTries < 0 && keepGoing) {
    7395             // switch off all normal ones
     7438            // switch off all normal generators (by the generator's opinion of normal)
     7439            // Intended for situations where the primal problem really isn't complete,
     7440            // and there are `not normal' cut generators that will augment.
    73967441            for (int i = 0; i < numberCutGenerators_; i++) {
    73977442                if (!generator_[i]->mustCallAgain())
     
    74777522            if (clpSolver) {
    74787523                save = clpSolver->specialOptions();
    7479                 clpSolver->setSpecialOptions(save | 2048/*4096*/);
     7524                clpSolver->setSpecialOptions(save | 2048/*4096*/); // Bonmin <something>
    74807525            }
    74817526#endif
     
    75897634                        keepGoing = true; // say must go round
    75907635                    // Check last cut to see if infeasible
     7636                    /*
     7637                      The convention is that if the generator proves infeasibility, it should
     7638                      return as its last cut something with lb > ub.
     7639                    */
    75917640                    if (numberRowCutsBefore < numberRowCutsAfter) {
    75927641                        const OsiRowCut * thisCut = theseCuts.rowCutPtr(numberRowCutsAfter - 1) ;
     
    76797728                int j ;
    76807729
     7730                /*
     7731                  Look for numerically unacceptable cuts.
     7732                */
    76817733                bool dodgyCuts = false;
    76827734                for (j = numberRowCutsBefore; j < numberRowCutsAfter; j++) {
     
    77657817                //double averagePerRow = static_cast<double>(nElsNow)/
    77667818                //static_cast<double>(numberRows);
     7819
     7820                // Check in CbcCutGenerator for similar code.
    77677821                int nAdd;
    77687822                int nAdd2;
     
    81558209                           lastHeuristic_->heuristicName(), whereFrom);
    81568210#endif
     8211                    // CBC_ROUNDING is symbolic; just says found by heuristic
    81578212                    setBestSolution(CBC_ROUNDING, heuristicValue, newSolution) ;
    81588213                    whereFrom |= 8; // say solution found
     
    84268481                if (minimumDrop > 0.0) {
    84278482                    if (increaseDrop) {
    8428                         // slowly increase minimumDrop
     8483                        // slowly increase minimumDrop; breakpoints are rule-of-thumb
    84298484                        if (currentPassNumber_ == 13)
    84308485                            minimumDrop = CoinMax(1.5 * minimumDrop, 1.0e-5 * fabs(thisObj));
     
    84358490                    }
    84368491                    int nBadPasses = 0;
     8492                    // The standard way of determining escape
    84378493                    if (!experimentBreak) {
    84388494                        double test = 0.01 * minimumDrop;
     
    84518507                            badObj = false; // carry on
    84528508                    } else {
     8509                        // Experimental escape calculations
    84538510                        //if (currentPassNumber_==13||currentPassNumber_>50)
    84548511                        //minimumDrop = CoinMax(1.5*minimumDrop,1.0e-5*fabs(thisObj));
     
    84818538                    }
    84828539                }
     8540                // magic numbers, they seemed reasonable; there's a possibility here of going more than
     8541                // nominal number of passes if we're doing really well.
    84838542                if (numberTries == 1 && currentDepth_ < 12 && currentPassNumber_ < 10) {
    84848543                    double drop[12] = {1.0, 2.0, 3.0, 10.0, 10.0, 10.0, 10.0, 20.0, 100.0, 100.0, 1000.0, 1000.0};
     
    85678626        }
    85688627        testSolution_ = save;
     8628        // Consider the possibility that some alternatives here only make sense in context
     8629        // of bonmin.
    85698630        if (integerFeasible) { //update
    85708631            double objValue = solver_->getObjValue();
Note: See TracChangeset for help on using the changeset viewer.