Changeset 2442


Ignore:
Timestamp:
Apr 5, 2019 5:51:51 AM (7 weeks ago)
Author:
forrest
Message:

maximization improvement for readLp

File:
1 edited

Legend:

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

    r2439 r2442  
    58095809  setObjName(m.getObjName());
    58105810
    5811   // no errors
     5811#ifndef SWITCH_BACK_TO_MAXIMIZATION
     5812#define SWITCH_BACK_TO_MAXIMIZATION 1
     5813#endif
     5814#if SWITCH_BACK_TO_MAXIMIZATION
     5815  double * originalObj = NULL;
     5816  if (m.wasMaximization()) {
     5817    // switch back
     5818    setDblParam(OsiObjOffset, -m.objectiveOffset());
     5819    int numberColumns = m.getNumCols();
     5820    originalObj = CoinCopyOfArray(m.getObjCoefficients(),numberColumns);
     5821    for (int i=0;i < numberColumns;i++)
     5822      originalObj[i] = - originalObj[i];
     5823    modelPtr_->setOptimizationDirection(-1.0);
     5824    handler_->message(COIN_GENERAL_INFO, messages_)
     5825      << "Switching back to maximization to get correct duals etc"
     5826      << CoinMessageEol;
     5827  }
     5828  loadProblem(*m.getMatrixByRow(), m.getColLower(), m.getColUpper(),
     5829              !originalObj ? m.getObjCoefficients() : originalObj,
     5830              m.getRowLower(), m.getRowUpper());
     5831  delete [] originalObj;
     5832#else
    58125833  loadProblem(*m.getMatrixByRow(), m.getColLower(), m.getColUpper(),
    58135834    m.getObjCoefficients(), m.getRowLower(), m.getRowUpper());
     5835#endif
    58145836
    58155837  char *integer = const_cast< char * >(m.integerColumns());
Note: See TracChangeset for help on using the changeset viewer.