Changeset 2128


Ignore:
Timestamp:
Feb 2, 2015 6:33:00 AM (4 years ago)
Author:
forrest
Message:

fix sos before integers in dive

Location:
trunk/Cbc/src
Files:
2 edited

Legend:

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

    r2101 r2128  
    217217  smallObjective_=0.0;
    218218  const double * objective = model_->solver()->getObjCoefficients();
    219   for (int i = 0; i < numberIntegers; i++) {
     219  int numberObjects = model_->numberObjects();
     220  for (int i = 0; i < numberObjects; i++) {
    220221    OsiObject * object = model_->modifiableObject(i);
    221222    const CbcSimpleInteger * thisOne = dynamic_cast <const CbcSimpleInteger *> (object);
    222     assert (thisOne);
     223    if (!thisOne)
     224      continue; // Not integer
    223225    int iColumn = thisOne->columnNumber();
    224226    smallObjective_ += objective[iColumn];
     
    232234  if (gotPriorities || priority1>priority2) {
    233235    priority_ = new PriorityType [numberIntegers];
    234     for (int i = 0; i < numberIntegers; i++) {
     236    for (int i = 0; i < numberObjects; i++) {
    235237      OsiObject * object = model_->modifiableObject(i);
    236238      const CbcSimpleInteger * thisOne = dynamic_cast <const CbcSimpleInteger *> (object);
     239      if (!thisOne)
     240        continue; // Not integer
    237241      int level=thisOne->priority()-priority2;
    238242      assert (level<(1<<29));
  • trunk/Cbc/src/CbcModel.cpp

    r2106 r2128  
    78147814        feasible = false; // pretend infeasible
    78157815    }
     7816    //#define CHECK_KNOWN_SOLUTION
     7817#ifdef CHECK_KNOWN_SOLUTION
     7818    if (onOptimalPath && (solver_->isDualObjectiveLimitReached()||
     7819                          !feasible)) {
     7820      printf("help 1\n");
     7821    }
     7822#endif
    78167823    /*
    78177824      NEW_UPDATE_OBJECT is defined to 0 when unthreaded (CBC_THREAD undefined), 2
     
    91869193        }
    91879194        // add in any active cuts if at root node (for multiple solvers)
     9195#ifdef CHECK_KNOWN_SOLUTION
     9196    if (onOptimalPath && (solver_->isDualObjectiveLimitReached()||
     9197                          !feasible)) {
     9198      printf("help 2\n");
     9199    }
     9200#endif
    91889201        if (!numberNodes_) {
    91899202          for (i = 0; i < numberCutGenerators_; i++)
     
    95879600    }
    95889601#endif
     9602#ifdef CHECK_KNOWN_SOLUTION
     9603    if (onOptimalPath && (solver_->isDualObjectiveLimitReached()||
     9604                          !feasible)) {
     9605      printf("help\n");
     9606    }
     9607#endif
    95899608#ifdef CBC_DEBUG
    95909609    if (onOptimalPath && !solver_->isDualObjectiveLimitReached())
     
    99459964    const CoinWarmStartBasis* ws ;
    99469965    CoinWarmStartBasis::Status status ;
     9966    //#define COIN_HAS_CLP_KEEP_STATUS
     9967#ifdef COIN_HAS_CLP_KEEP_STATUS
     9968    int problemStatus=-1;
     9969    OsiClpSolverInterface * clpSolver
     9970      = dynamic_cast<OsiClpSolverInterface *> (solver_);
     9971    if (clpSolver)
     9972      problemStatus=clpSolver->getModelPtr()->status();
     9973#endif
    99479974    bool needPurge = true ;
    99489975    /*
     
    1009810125    }
    1009910126   
     10127#ifdef COIN_HAS_CLP_KEEP_STATUS
     10128    // need to check further that only zero duals dropped
     10129    if (clpSolver) // status may have got to -1
     10130      clpSolver->getModelPtr()->setProblemStatus(problemStatus);
     10131#endif
    1010010132    /*
    1010110133      Clean up and return.
     
    1427514307            }
    1427614308        }
     14309#ifdef CHECK_KNOWN_SOLUTION
     14310        bool onOptimalPath = false;
     14311        if ((specialOptions_&1) != 0) {
     14312          const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ;
     14313          if (debugger) {
     14314            onOptimalPath = true;
     14315            printf("On optimal path before resolve\n") ;
     14316          }
     14317        }
     14318#endif
    1427714319        clpSolver->resolve();
     14320#ifdef CHECK_KNOWN_SOLUTION
     14321        if ((specialOptions_&1) != 0&&onOptimalPath) {
     14322          const OsiRowCutDebugger *debugger = solver_->getRowCutDebugger() ;
     14323          if (debugger) {
     14324            printf("On optimal path after resolve\n") ;
     14325          } else {
     14326            solver_->writeMpsNative("badSolve.mps", NULL, NULL, 2);
     14327            printf("NOT on optimal path after resolve\n") ;
     14328          }
     14329        }
     14330#endif
    1427814331        if (!numberNodes_) {
    1427914332            double error = CoinMax(clpSimplex->largestDualError(),
Note: See TracChangeset for help on using the changeset viewer.