Changeset 1827


Ignore:
Timestamp:
Nov 28, 2011 10:45:50 PM (8 years ago)
Author:
lou
Message:

Per user request, add an overload of loadProblem that takes a ClpMatrixBase?
parameter. Really just exposes an underlying method from ClpModel?.

Location:
stable/1.14/Clp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable/1.14/Clp/src/OsiClp/OsiClpSolverInterface.cpp

    r1810 r1827  
    34993499  integerInformation_=NULL;
    35003500  modelPtr_->loadProblem(matrix, collb, colub, obj, rowlb, rowub);
     3501  linearObjective_ = modelPtr_->objective();
     3502  freeCachedResults();
     3503  basis_=CoinWarmStartBasis();
     3504  if (ws_) {
     3505     delete ws_;
     3506     ws_ = 0;
     3507  }
     3508}
     3509
     3510//-----------------------------------------------------------------------------
     3511
     3512/*
     3513  Expose the method that takes ClpMatrixBase. User request. Can't hurt, given
     3514  the number of non-OSI methods already here.
     3515*/
     3516void OsiClpSolverInterface::loadProblem (const ClpMatrixBase& matrix,
     3517                                         const double* collb,
     3518                                         const double* colub,   
     3519                                         const double* obj,
     3520                                         const double* rowlb,
     3521                                         const double* rowub)
     3522{
     3523  modelPtr_->whatsChanged_ = 0;
     3524  // Get rid of integer information (modelPtr will get rid of its copy)
     3525  delete [] integerInformation_;
     3526  integerInformation_=NULL;
     3527  modelPtr_->loadProblem(matrix,collb,colub,obj,rowlb,rowub);
    35013528  linearObjective_ = modelPtr_->objective();
    35023529  freeCachedResults();
  • stable/1.14/Clp/src/OsiClp/OsiClpSolverInterface.hpp

    r1753 r1827  
    894894 
    895895  /** Just like the other loadProblem() methods except that the matrix is
     896      given as a ClpMatrixBase. */
     897  virtual void loadProblem(const ClpMatrixBase& matrix,
     898                           const double* collb, const double* colub,
     899                           const double* obj,
     900                           const double* rowlb, const double* rowub) ;
     901
     902  /** Just like the other loadProblem() methods except that the matrix is
    896903      given in a standard column major ordered format (without gaps). */
    897904  virtual void loadProblem(const int numcols, const int numrows,
  • stable/1.14/Clp/test/OsiClpSolverInterfaceTest.cpp

    r1753 r1827  
    2121#include "CoinModel.hpp"
    2222#include "CoinIndexedVector.hpp"
     23#include "ClpPlusMinusOneMatrix.hpp"
    2324
    2425//#############################################################################
     
    586587    }
    587588  }
     589
     590  // Test ClpPlusMinusOneMatrix by way of loadProblem(ClpMatrixBase, ... )
     591  { int pos_start[4] = {0,5,9,12};
     592    int neg_start[4] = {3,7,11,12};
     593    int col[12] = {0,1,2,3,4,5,6,7,0,1,2,3};
     594    double rhs[3] = {0.0,0.0,0.0};
     595    double cost[8];
     596    double var_lb[8];
     597    double var_ub[8];
     598    for (uint i = 0 ; i < 8 ; i++) {
     599      cost[i] = 1.0;
     600      var_lb[i] = 0.0;
     601      var_ub[i] = 1.0;
     602    }
     603    ClpPlusMinusOneMatrix pmone_matrix(3,8,false,col,pos_start,neg_start);
     604    OsiClpSolverInterface clpSi;
     605    OSIUNITTEST_CATCH_ERROR(
     606        {clpSi.loadProblem(pmone_matrix,var_lb,var_ub,cost,rhs,rhs);
     607         clpSi.initialSolve();},
     608        {},"clp","loadProblem(ClpMatrixBase, ...)")
     609  }
     610
    588611
    589612  // Test add/delete columns
Note: See TracChangeset for help on using the changeset viewer.