Changeset 1663 for trunk


Ignore:
Timestamp:
Jun 10, 2011 12:01:46 PM (8 years ago)
Author:
forrest
Message:

changes for bonmin

File:
1 edited

Legend:

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

    r1661 r1663  
    23962396    if (numberObjects_)
    23972397        doHeuristicsAtRoot();
     2398#ifdef COIN_HAS_BONMIN // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics)
     2399    solver_->resolve();
     2400    if(!isProvenOptimal()){
     2401      solver_->initialSolve();
     2402    }
     2403#endif
    23982404    /*
    23992405      Grepping through the code, it would appear that this is a command line
     
    70937099            << CoinMessageEol ;
    70947100        }
     7101#ifdef COIN_HAS_BONMIN  //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc-2.4)
     7102        if (solverCharacteristics_->solutionAddsCuts()&&numberViolated) {
     7103          for (i = 0;i<numberCutGenerators_;i++) {
     7104            if (generator_[i]->mustCallAgain()) {
     7105              keepGoing=true; // say must go round
     7106              break;
     7107            }
     7108          }
     7109        }
     7110        if(!keepGoing){
     7111#endif
    70957112        // Status for single pass of cut generation
    70967113        int status = 0;
     
    71157132        if (!feasible)
    71167133            violated = -2;
     7134#ifdef COIN_HAS_BONMIN  //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc-2.4)
     7135        }
     7136#endif
    71177137        //if (!feasible)
    71187138        //break;
     
    1086310883            delete [] saveLower;
    1086410884            delete [] saveUpper;
     10885            solver_->resolve();
    1086510886        }
    1086610887        //If the variables were fixed the cutting plane procedure may have believed that the node could be fathomed
     
    1256812589#endif
    1256912590    currentNode_ = newNode; // so can be used elsewhere
     12591#ifdef COIN_HAS_BONMIN // Remember number of rows to restore at the end of the loop
     12592    int saveNumberRows=solver_->getNumRows();
     12593#endif
    1257012594    /*
    1257112595      Enough preparation. Get down to the business of choosing a branching
     
    1266112685            resolve(solver_);
    1266212686            double objval = solver_->getObjValue();
    12663             int saveNumberRows=solver_->getNumRows();
     12687#ifndef COIN_HAS_BONMIN
     12688            int saveNumberRows = solver_->getNumRows();
     12689#endif
    1266412690            lastHeuristic_ = NULL;
    1266512691            setBestSolution(CBC_SOLUTION, objval,
     
    1267912705                feasible = false; // pretend infeasible
    1268012706            }
     12707#ifndef COIN_HAS_BONMIN
    1268112708            if( saveNumberRows<solver_->getNumRows()) {
    1268212709                // delete rows - but leave solution
     
    1268812715                delete [] del;
    1268912716            }
     12717#endif
    1269012718            if (feasible)
    1269112719                anyAction = -1;
     
    1272812756        }
    1272912757    }
     12758#ifdef COIN_HAS_BONMIN //A candidate has been found; restore the subproblem.
     12759    if( saveNumberRows<solver_->getNumRows()) {
     12760        // delete rows - but leave solution
     12761        int n = solver_->getNumRows();
     12762        int * del = new int [n-saveNumberRows];
     12763        for (int i=saveNumberRows;i<n;i++)
     12764            del[i-saveNumberRows]=i;
     12765        solver_->deleteRows(n-saveNumberRows,del);
     12766        delete [] del;
     12767    }
     12768#endif
    1273012769    /*
    1273112770      End main loop to choose a branching variable.
Note: See TracChangeset for help on using the changeset viewer.