Ignore:
Timestamp:
Sep 23, 2010 11:11:23 AM (11 years ago)
Author:
forrest
Message:

changes for more flexibility in ClpSolve?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpSolve.cpp

    r1525 r1610  
    2525#include "ClpNetworkMatrix.hpp"
    2626#endif
     27#include "ClpEventHandler.hpp"
    2728#include "ClpLinearObjective.hpp"
    2829#include "ClpSolve.hpp"
     
    435436     double timeIdiot = 0.0;
    436437     double timeCore = 0.0;
     438     eventHandler()->event(ClpEventHandler::presolveStart);
    437439     int savePerturbation = perturbation_;
    438440     int saveScaling = scalingFlag_;
     
    489491                         << CoinMessageEol;
    490492               model2 = this;
     493               eventHandler()->event(ClpEventHandler::presolveStart);
    491494               problemStatus_ = 1; // may be unbounded but who cares
    492495               if (options.infeasibleReturn() || (moreSpecialOptions_ & 1) != 0) {
     
    494497               }
    495498               presolve = ClpSolve::presolveOff;
    496           }
     499          } else {
     500              model2->eventHandler()->setSimplex(model2);
     501              int rcode=model2->eventHandler()->event(ClpEventHandler::presolveSize);
     502              // see if too big or small
     503              if (rcode==2) {
     504                  delete model2;
     505                  return -2;
     506              } else if (rcode==3) {
     507                  delete model2;
     508                  return -3;
     509              }
     510          }
     511          model2->eventHandler()->setSimplex(model2);
    497512          // We may be better off using original (but if dual leave because of bounds)
    498513          if (presolve != ClpSolve::presolveOff &&
     
    516531     int doSlp = 0;
    517532     int primalStartup = 1;
     533     model2->eventHandler()->event(ClpEventHandler::presolveBeforeSolve);
    518534     bool tryItSave = false;
    519535     // switch to primal from automatic if just one cost entry
     
    24672483          // checkSolution(); already done by postSolve
    24682484          setLogLevel(saveLevel);
    2469           if (finalStatus != 3 && (finalStatus || status() == -1)) {
     2485          setProblemStatus(finalStatus);
     2486          setSecondaryStatus(finalSecondaryStatus);
     2487          int rcode=eventHandler()->event(ClpEventHandler::presolveAfterFirstSolve);
     2488          if (finalStatus != 3 && rcode < 0 && (finalStatus || status() == -1)) {
    24702489               int savePerturbation = perturbation();
    24712490               if (!finalStatus || (moreSpecialOptions_ & 2) == 0) {
     
    24962515                         << CoinMessageEol;
    24972516               timeX = time2;
    2498           } else {
     2517          } else if (rcode >= 0) {
     2518              primal(1);
     2519          } else {
    24992520               secondaryStatus_ = finalSecondaryStatus;
    25002521          }
     
    25542575          finalStatus = status();
    25552576     }
     2577     eventHandler()->event(ClpEventHandler::presolveEnd);
    25562578     return finalStatus;
    25572579}
Note: See TracChangeset for help on using the changeset viewer.