Ignore:
Timestamp:
Jan 21, 2011 1:01:03 PM (10 years ago)
Author:
forrest
Message:

gub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/OsiClp/OsiClpSolverInterface.cpp

    r1664 r1677  
    5757  }
    5858#endif
     59  if ((specialOptions_&2097152)!=0) {
     60    resolveGub((9*modelPtr_->numberRows())/10);
     61    return;
     62  }
    5963  bool deleteSolver;
    6064  ClpSimplex * solver;
     
    783787    return;
    784788  }
     789  if ((specialOptions_&2097152)!=0) {
     790    resolveGub((9*modelPtr_->numberRows())/10);
     791    return;
     792  }
    785793  //void pclp(char *);
    786794  //pclp("res");
     
    12691277    modelPtr_->whatsChanged_ &= ~0xffff;
    12701278  modelPtr_->whatsChanged_ |= 0x30000;
     1279}
     1280#include "ClpSimplexOther.hpp"
     1281// Resolve an LP relaxation after problem modification (try GUB)
     1282void
     1283OsiClpSolverInterface::resolveGub(int needed)
     1284{
     1285  bool takeHint;
     1286  OsiHintStrength strength;
     1287  // Switch off printing if asked to
     1288  bool gotHint = (getHintParam(OsiDoReducePrint,takeHint,strength));
     1289  assert (gotHint);
     1290  int saveMessageLevel=modelPtr_->logLevel();
     1291  if (strength!=OsiHintIgnore&&takeHint) {
     1292    int messageLevel=messageHandler()->logLevel();
     1293    if (messageLevel>0)
     1294      modelPtr_->messageHandler()->setLogLevel(messageLevel-1);
     1295    else
     1296      modelPtr_->messageHandler()->setLogLevel(0);
     1297  }
     1298  setBasis(basis_,modelPtr_);
     1299  // find gub
     1300  int numberRows = modelPtr_->numberRows();
     1301  int * which = new int[numberRows];
     1302  int numberColumns = modelPtr_->numberColumns();
     1303  int * whichC = new int[numberColumns+numberRows];
     1304  ClpSimplex * model2 =
     1305    static_cast<ClpSimplexOther *> (modelPtr_)->gubVersion(which,whichC,
     1306                                                           needed);
     1307  if (model2) {
     1308    // move in solution
     1309    static_cast<ClpSimplexOther *> (model2)->setGubBasis(*modelPtr_,
     1310                                                         which,whichC);
     1311    model2->setLogLevel(CoinMin(1,model2->logLevel()));
     1312    ClpPrimalColumnSteepest steepest(5);
     1313    model2->setPrimalColumnPivotAlgorithm(steepest);
     1314    double time1 = CoinCpuTime();
     1315    model2->primal();
     1316    //printf("Primal took %g seconds\n",CoinCpuTime()-time1);
     1317    static_cast<ClpSimplexOther *> (model2)->getGubBasis(*modelPtr_,
     1318                                                         which,whichC);
     1319    int totalIterations = model2->numberIterations();
     1320    //modelPtr_->setLogLevel(63);
     1321    modelPtr_->primal(1);
     1322    modelPtr_->setNumberIterations(totalIterations+modelPtr_->numberIterations());
     1323  } else {
     1324    modelPtr_->dual();
     1325  }
     1326  basis_ = getBasis(modelPtr_);
     1327  modelPtr_->messageHandler()->setLogLevel(saveMessageLevel);
    12711328}
    12721329// Sort of lexicographic resolve
     
    62766333      }
    62776334      // set normal
    6278       specialOptions_ &= (2047+3*8192+15*65536);
     6335      specialOptions_ &= (2047|3*8192|15*65536|2097152);
    62796336      if (otherInformation!=NULL) {
    62806337        int * array = static_cast<int *> (otherInformation);
Note: See TracChangeset for help on using the changeset viewer.