Changeset 2150


Ignore:
Timestamp:
Jun 26, 2015 10:38:27 AM (3 years ago)
Author:
forrest
Message:

changes to allow PE in Cbc

Location:
trunk/Clp/src
Files:
7 edited

Legend:

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

    r2149 r2150  
    472472{
    473473  // See if we need to initialize ClpPESimplex
    474   if (!modelPE_||model!=modelPE_->clpModel()) {
     474  if (!modelPE_||model!=modelPE_->clpModel()||
     475      !modelPE_->checkSize()) {
    475476    delete modelPE_;
    476477    modelPE_ = new ClpPESimplex(model);
  • trunk/Clp/src/ClpPEDualRowSteepest.hpp

    r2149 r2150  
    7272     //@}
    7373
    74 
     74     // Psi
     75     inline double psi() const
     76     { return psi_;}
    7577
    7678     //---------------------------------------------------------------------------
  • trunk/Clp/src/ClpPEPrimalColumnSteepest.cpp

    r2149 r2150  
    3131ClpPEPrimalColumnSteepest::ClpPEPrimalColumnSteepest (double psi, int mode)
    3232: ClpPrimalColumnSteepest(mode), modelPE_(NULL), psi_(psi),
    33 iCurrent_(0), iInterval_(100), updateCompatibles_(true),
    34 coDegenCompatibles_(0), coConsecutiveCompatibles_(0)
     33iCurrent_(0), iInterval_(100),
     34  coDegenCompatibles_(0), coConsecutiveCompatibles_(0),
     35updateCompatibles_(true)
    3536{
    3637}
     
    594595{
    595596  // See if we need to initialize ClpPESimplex
    596   if (!modelPE_||model!=modelPE_->clpModel()) {
     597  if (!modelPE_||model!=modelPE_->clpModel()||
     598      !modelPE_->checkSize()) {
    597599    delete modelPE_;
    598600    modelPE_ = new ClpPESimplex(model);
  • trunk/Clp/src/ClpPEPrimalColumnSteepest.hpp

    r2149 r2150  
    8383     virtual void updateWeights(CoinIndexedVector * input);
    8484     //---------------------------------------------------------------------------
     85     // Psi
     86     inline double psi() const
     87     { return psi_;}
    8588
    8689private:
  • trunk/Clp/src/ClpPESimplex.cpp

    r2149 r2150  
    682682  return isCompatible;
    683683}
     684// checks size
     685bool
     686ClpPESimplex::checkSize()
     687{
     688  return (numberRows_==model_->numberRows()&&
     689          numberColumns_==model_->numberColumns());
     690}
    684691/* Update the dual compatible rows */
    685692void
  • trunk/Clp/src/ClpPESimplex.hpp

    r2149 r2150  
    6060
    6161    inline bool isCompatibleCol(int sequence) {return isCompatibleCol_[sequence];}
    62     inline bool isCompatibleRow(int row) {return isCompatibleRow_[row];}
     62    inline bool isCompatibleRow(int row) {
     63      assert (row>=0&&row<numberRows_);
     64      return isCompatibleRow_[row];}
    6365
    6466    inline ClpSimplex* clpModel() {return model_;}
    65 
     67    // check seems to be same model - returns false if size changed
     68    bool checkSize();
    6669/** PUBLIC METHODS RELATED TO COMPATIBILITY */
    6770public:
  • trunk/Clp/src/ClpSimplex.cpp

    r2149 r2150  
    2424#include "ClpPrimalColumnDantzig.hpp"
    2525#include "ClpPrimalColumnSteepest.hpp"
     26#include "ClpPEDualRowSteepest.hpp"
     27#include "ClpPEPrimalColumnSteepest.hpp"
    2628#include "ClpNonLinearCost.hpp"
    2729#include "ClpMessage.hpp"
     
    410412     //factorization_ = new ClpFactorization(*rhs->factorization_,
    411413     //                         rhs->factorization_->goDenseThreshold());
    412      ClpDualRowDantzig * pivot =
    413           dynamic_cast< ClpDualRowDantzig*>(rhs->dualRowPivot_);
    414      // say Steepest pricing
    415      if (!pivot)
    416           dualRowPivot_ = new ClpDualRowSteepest();
    417      else
    418           dualRowPivot_ = new ClpDualRowDantzig();
    419      // say Steepest pricing
    420      primalColumnPivot_ = new ClpPrimalColumnSteepest();
     414     ClpPEDualRowSteepest * pivotDualPE =
     415          dynamic_cast< ClpPEDualRowSteepest*>(rhs->dualRowPivot_);
     416     if (pivotDualPE) {
     417       dualRowPivot_ = new ClpPEDualRowSteepest(pivotDualPE->psi());
     418     } else {
     419       ClpDualRowDantzig * pivot =
     420         dynamic_cast< ClpDualRowDantzig*>(rhs->dualRowPivot_);
     421       // say Steepest pricing
     422       if (!pivot)
     423         dualRowPivot_ = new ClpDualRowSteepest();
     424       else
     425         dualRowPivot_ = new ClpDualRowDantzig();
     426     }
     427     ClpPEPrimalColumnSteepest * pivotPrimalPE =
     428          dynamic_cast< ClpPEPrimalColumnSteepest*>(rhs->primalColumnPivot_);
     429     if (pivotPrimalPE) {
     430       primalColumnPivot_ = new ClpPEPrimalColumnSteepest(pivotPrimalPE->psi());
     431     } else {
     432       // say Steepest pricing
     433       primalColumnPivot_ = new ClpPrimalColumnSteepest();
     434     }
    421435     solveType_ = 1; // say simplex based life form
    422436     if (fixOthers) {
Note: See TracChangeset for help on using the changeset viewer.