Changeset 1387 for branches/sandbox


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.

Location:
branches/sandbox/Cbc/src
Files:
1 added
2 deleted
5 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();
  • branches/sandbox/Cbc/src/CbcStrategy.cpp

    r1361 r1387  
    476476        solver->setHintParam(OsiDoInBranchAndCut, true, OsiHintDo) ;
    477477        // Default set of cut generators
     478        // Limited set that could reduce problem size (drop rows / fix values)
    478479        CglProbing generator1;
    479480        generator1.setUsingObjective(true);
     
    527528                   and that final solver will also be kept.
    528529                   This is for post-processing
     530
     531                   Keep in mind when examining this that linear presolve does not
     532                   understand SOS.
    529533                */
    530534                OsiSolverInterface * solver3 = solver2->clone();
  • branches/sandbox/Cbc/src/CoinSolve.cpp

    r1361 r1387  
    9999#include <iostream>
    100100
    101 /*
    102   The subtleties are unclear, but the gross action is that CBC_OTHER_SOLVER
    103   will overrule NEW_STYLE_SOLVER. NEW_STYLE_SOLVER undefined or 0 seems to
    104   mean `old style solver'.
    105 */
    106 #ifndef NEW_STYLE_SOLVER
    107  #define NEW_STYLE_SOLVER 0
    108 #endif
    109 #ifdef CBC_OTHER_SOLVER
    110  #undef NEW_STYLE_SOLVER
    111  #define NEW_STYLE_SOLVER 0
    112 #endif
    113 
    114 
    115 
    116 #if NEW_STYLE_SOLVER == 0
     101
    117102// define TEST_MESSAGE_HANDLER to check works on all messages
    118103// #define TEST_MESSAGE_HANDLER
     
    380365}
    381366
    382 
    383 
    384 #else   /* NEW_STYLE_SOLVER */
    385 
    386 /*
    387   As best I can see, this is not yet fully functional. NEW_STYLE_SOLVER is
    388   normally undefined or forced to 0. See CbcSolver.hpp for jjf's thoughts on
    389   where this is going (a good direction, in my opinion [lh]).
    390 */
    391 
    392 #include "CbcSolver.hpp"
    393 
    394 /*
    395   ClpAmplStuff.cpp
    396 */
    397 void addAmplToCbc(CbcSolver *);
    398 
    399 int main (int argc, const char *argv[])
    400 {
    401     int returnCode;
    402 
    403     /*
    404       // Only active if malloc switched on in CbcSolver.cpp
    405 
    406       Magic value 0 initialises the package. Anything else dumps statistics.
    407     */
    408 #ifdef CLP_DEBUG_MALLOC
    409     clp_memory(0);
    410 #endif
    411 
    412     // Open a block to ease memory leak checks.
    413     {
    414         OsiClpSolverInterface solver1;
    415         CbcSolver control(solver1);
    416         // initialize
    417         control.fillValuesInSolver();
    418 
    419 #ifdef COIN_HAS_ASL
    420         addAmplToCbc(&control);
    421 #endif
    422 
    423         returnCode = control.solve (argc, argv, 1);
    424     }
    425 #ifdef CLP_DEBUG_MALLOC
    426     clp_memory(1);
    427 #endif
    428     return returnCode;
    429 }
    430 
    431 #endif  /* NEW_STYLE_SOLVER */
    432367
    433368
  • branches/sandbox/Cbc/src/Makefile.am

    r1385 r1387  
    8181        CbcPartialNodeInfo.cpp CbcPartialNodeInfo.hpp \
    8282        CbcSimpleInteger.cpp CbcSimpleInteger.hpp \
    83         CbcSimpleIntegerDynamicPseudoCost.cpp CbcSimpleIntegerDynamicPseudoCost.hpp \
    84         CbcSimpleIntegerPseudoCost.cpp CbcSimpleIntegerPseudoCost.hpp \
     83        CbcSimpleIntegerDynamicPseudoCost.cpp \
     84        CbcSimpleIntegerDynamicPseudoCost.hpp \
     85        CbcSimpleIntegerPseudoCost.cpp \
     86        CbcSimpleIntegerPseudoCost.hpp \
    8587        CbcSOS.cpp CbcSOS.hpp \
    8688        CbcStatistics.cpp CbcStatistics.hpp \
     
    9092        CbcTreeLocal.cpp CbcTreeLocal.hpp
    9193
     94
    9295libCbcSolver_la_SOURCES = \
    9396        CbcCbcParam.cpp \
    9497        Cbc_ampl.cpp Cbc_ampl.h \
    95         ClpConstraintAmpl.hpp ClpAmplObjective.hpp ClpAmplStuff.cpp \
    96         CbcLinked.cpp CbcLinked.hpp \
     98        CbcLinked.cpp CbcLinked.hpp CbcLinkedUtils.cpp \
    9799        unitTestClp.cpp CbcSolver.cpp \
    98100        CbcSolverHeuristics.cpp CbcSolverHeuristics.hpp
  • branches/sandbox/Cbc/src/Makefile.in

    r1385 r1387  
    187187libCbc_la_OBJECTS = $(am_libCbc_la_OBJECTS)
    188188libCbcSolver_la_LIBADD =
    189 am_libCbcSolver_la_OBJECTS = CbcCbcParam.lo Cbc_ampl.lo \
    190         ClpAmplStuff.lo CbcLinked.lo unitTestClp.lo CbcSolver.lo \
     189am_libCbcSolver_la_OBJECTS = CbcCbcParam.lo Cbc_ampl.lo CbcLinked.lo \
     190        CbcLinkedUtils.lo unitTestClp.lo CbcSolver.lo \
    191191        CbcSolverHeuristics.lo
    192192libCbcSolver_la_OBJECTS = $(am_libCbcSolver_la_OBJECTS)
     
    579579        CbcPartialNodeInfo.cpp CbcPartialNodeInfo.hpp \
    580580        CbcSimpleInteger.cpp CbcSimpleInteger.hpp \
    581         CbcSimpleIntegerDynamicPseudoCost.cpp CbcSimpleIntegerDynamicPseudoCost.hpp \
    582         CbcSimpleIntegerPseudoCost.cpp CbcSimpleIntegerPseudoCost.hpp \
     581        CbcSimpleIntegerDynamicPseudoCost.cpp \
     582        CbcSimpleIntegerDynamicPseudoCost.hpp \
     583        CbcSimpleIntegerPseudoCost.cpp \
     584        CbcSimpleIntegerPseudoCost.hpp \
    583585        CbcSOS.cpp CbcSOS.hpp \
    584586        CbcStatistics.cpp CbcStatistics.hpp \
     
    591593        CbcCbcParam.cpp \
    592594        Cbc_ampl.cpp Cbc_ampl.h \
    593         ClpConstraintAmpl.hpp ClpAmplObjective.hpp ClpAmplStuff.cpp \
    594         CbcLinked.cpp CbcLinked.hpp \
     595        CbcLinked.cpp CbcLinked.hpp CbcLinkedUtils.cpp \
    595596        unitTestClp.cpp CbcSolver.cpp \
    596597        CbcSolverHeuristics.cpp CbcSolverHeuristics.hpp
     
    943944@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcHeuristicVND.Plo@am__quote@
    944945@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcLinked.Plo@am__quote@
     946@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcLinkedUtils.Plo@am__quote@
    945947@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcMessage.Plo@am__quote@
    946948@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CbcModel.Plo@am__quote@
     
    964966@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cbc_C_Interface.Plo@am__quote@
    965967@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cbc_ampl.Plo@am__quote@
    966 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClpAmplStuff.Plo@am__quote@
    967968@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoinSolve.Po@am__quote@
    968969@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitTestClp.Plo@am__quote@
Note: See TracChangeset for help on using the changeset viewer.