Changeset 1610


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

changes for more flexibility in ClpSolve?

Location:
trunk/Clp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpEventHandler.hpp

    r1533 r1610  
    3838          solution, // for Cbc
    3939          theta, // hit in parametrics
    40           pivotRow // used to choose pivot row
     40          pivotRow, // used to choose pivot row
     41          presolveStart, // ClpSolve presolve start
     42          presolveSize, // sees if ClpSolve presolve too big or too small
     43          presolveInfeasible, // ClpSolve presolve infeasible
     44          presolveBeforeSolve, // ClpSolve presolve before solve
     45          presolveAfterFirstSolve, // ClpSolve presolve after solve
     46          presolveAfterSolve, // ClpSolve presolve after solve
     47          presolveEnd // ClpSolve presolve end
    4148     };
    42      /**@name Virtual method that the derived classe should provide.
     49     /**@name Virtual method that the derived classes should provide.
    4350      The base class instance does nothing and as event() is only useful method
    4451      it would not be very useful NOT providing one!
     
    4754     /** This can do whatever it likes.  If return code -1 then carries on
    4855         if 0 sets ClpModel::status() to 5 (stopped by event) and will return to user.
    49          At present if <-1 carries on and if >0 acts as if 0 - this may change
     56         At present if <-1 carries on and if >0 acts as if 0 - this may change.
     57         For ClpSolve 2 -> too big return status of -2 and -> too small 3
    5058     */
    5159     virtual int event(Event whichEvent);
  • 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.