#include <ClpModel.hpp>
Inheritance diagram for ClpModel:
Public Member Functions | |
Constructors and destructor | |
Note - copy methods copy ALL data so can chew up memory until other copy is freed | |
ClpModel () | |
Default constructor. | |
ClpModel (const ClpModel &) | |
Copy constructor. | |
ClpModel & | operator= (const ClpModel &rhs) |
Assignment operator. This copies the data. | |
ClpModel (const ClpModel *wholeModel, int numberRows, const int *whichRows, int numberColumns, const int *whichColumns, bool dropNames=true, bool dropIntegers=true) | |
~ClpModel () | |
Destructor. | |
Load model - loads some stuff and initializes others | |
void | loadProblem (const ClpMatrixBase &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL) |
void | loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL) |
void | loadProblem (const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL) |
void | loadProblem (const int numcols, const int numrows, const CoinBigIndex *start, const int *index, const double *value, const int *length, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL) |
This one is for after presolve to save memory. | |
void | loadQuadraticObjective (const int numberColumns, const CoinBigIndex *start, const int *column, const double *element) |
void | loadQuadraticObjective (const CoinPackedMatrix &matrix) |
void | deleteQuadraticObjective () |
Get rid of quadratic objective. | |
void | setRowObjective (const double *rowObjective) |
This just loads up a row objective. | |
int | readMps (const char *filename, bool keepNames=false, bool ignoreErrors=false) |
Read an mps file from the given filename. | |
void | copyInIntegerInformation (const char *information) |
Copy in integer informations. | |
void | deleteIntegerInformation () |
Drop integer informations. | |
void | resize (int newNumberRows, int newNumberColumns) |
Resizes rim part of model. | |
void | deleteRows (int number, const int *which) |
Deletes rows. | |
void | addRows (int number, const double *rowLower, const double *rowUpper, const int *rowStarts, const int *columns, const double *elements) |
Add rows. | |
void | addRows (int number, const double *rowLower, const double *rowUpper, const int *rowStarts, const int *rowLengths, const int *columns, const double *elements) |
Add rows. | |
void | addRows (int number, const double *rowLower, const double *rowUpper, const CoinPackedVectorBase *const *rows) |
void | deleteColumns (int number, const int *which) |
Deletes columns. | |
void | addColumns (int number, const double *columnLower, const double *columnUpper, const double *objective, const int *columnStarts, const int *rows, const double *elements) |
Add columns. | |
void | addColumns (int number, const double *columnLower, const double *columnUpper, const double *objective, const int *columnStarts, const int *columnLengths, const int *rows, const double *elements) |
void | addColumns (int number, const double *columnLower, const double *columnUpper, const double *objective, const CoinPackedVectorBase *const *columns) |
void | borrowModel (ClpModel &otherModel) |
void | returnModel (ClpModel &otherModel) |
void | createEmptyMatrix () |
Create empty ClpPackedMatrix. | |
void | dropNames () |
Drops names - makes lengthnames 0 and names empty. | |
void | copyNames (std::vector< std::string > &rowNames, std::vector< std::string > &columnNames) |
Copies in names. | |
gets and sets | |
int | numberRows () const |
Number of rows. | |
int | getNumRows () const |
int | getNumCols () const |
Number of columns. | |
int | numberColumns () const |
double | primalTolerance () const |
Primal tolerance to use. | |
void | setPrimalTolerance (double value) |
double | dualTolerance () const |
Dual tolerance to use. | |
void | setDualTolerance (double value) |
double | dualObjectiveLimit () const |
Dual objective limit. | |
void | setDualObjectiveLimit (double value) |
double | objectiveOffset () const |
Objective offset. | |
void | setObjectiveOffset (double value) |
std::string | problemName () const |
int | numberIterations () const |
Number of iterations. | |
int | getIterationCount () const |
void | setNumberIterations (int numberIterations) |
int | solveType () const |
Solve type - 1 simplex, 2 simplex interface. | |
void | setSolveType (int type) |
int | maximumIterations () const |
Maximum number of iterations. | |
void | setMaximumIterations (int value) |
double | maximumSeconds () const |
Maximum time in seconds (from when set called). | |
void | setMaximumSeconds (double value) |
bool | hitMaximumIterations () const |
Returns true if hit maximum iterations (or time). | |
int | status () const |
void | setProblemStatus (int problemStatus) |
Set problem status. | |
int | secondaryStatus () const |
void | setSecondaryStatus (int status) |
bool | isAbandoned () const |
Are there a numerical difficulties? | |
bool | isProvenOptimal () const |
Is optimality proven? | |
bool | isProvenPrimalInfeasible () const |
Is primal infeasiblity proven? | |
bool | isProvenDualInfeasible () const |
Is dual infeasiblity proven? | |
bool | isPrimalObjectiveLimitReached () const |
Is the given primal objective limit reached? | |
bool | isDualObjectiveLimitReached () const |
Is the given dual objective limit reached? | |
bool | isIterationLimitReached () const |
Iteration limit reached? | |
double | optimizationDirection () const |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. | |
double | getObjSense () const |
void | setOptimizationDirection (double value) |
double * | primalRowSolution () const |
Primal row solution. | |
const double * | getRowActivity () const |
double * | primalColumnSolution () const |
Primal column solution. | |
const double * | getColSolution () const |
void | setColSolution (const double *input) |
double * | dualRowSolution () const |
Dual row solution. | |
const double * | getRowPrice () const |
double * | dualColumnSolution () const |
Reduced costs. | |
const double * | getReducedCost () const |
double * | rowLower () const |
Row lower. | |
const double * | getRowLower () const |
double * | rowUpper () const |
Row upper. | |
const double * | getRowUpper () const |
double * | objective () const |
Objective. | |
double * | objective (const double *solution, double &offset, bool refresh=true) const |
const double * | getObjCoefficients () const |
double * | rowObjective () const |
Row Objective. | |
const double * | getRowObjCoefficients () const |
double * | columnLower () const |
Column Lower. | |
const double * | getColLower () const |
double * | columnUpper () const |
Column Upper. | |
const double * | getColUpper () const |
CoinPackedMatrix * | matrix () const |
Matrix (if not ClpPackedmatrix be careful about memory leak. | |
int | getNumElements () const |
Number of elements in matrix. | |
double | getSmallElementValue () const |
void | setSmallElementValue (double value) |
ClpMatrixBase * | rowCopy () const |
Row Matrix. | |
ClpMatrixBase * | clpMatrix () const |
Clp Matrix. | |
void | replaceMatrix (ClpMatrixBase *matrix) |
double | objectiveValue () const |
Objective value. | |
double | getObjValue () const |
char * | integerInformation () const |
Integer information. | |
double * | infeasibilityRay () const |
double * | unboundedRay () const |
bool | statusExists () const |
See if status array exists (partly for OsiClp). | |
unsigned char * | statusArray () const |
Return address of status array (char[numberRows+numberColumns]). | |
unsigned char * | statusCopy () const |
void | copyinStatus (const unsigned char *statusArray) |
Copy in status vector. | |
void | setUserPointer (void *pointer) |
User pointer for whatever reason. | |
void * | getUserPointer () const |
Message handling | |
void | passInMessageHandler (CoinMessageHandler *handler) |
Pass in Message handler (not deleted at end). | |
void | newLanguage (CoinMessages::Language language) |
Set language. | |
void | setLanguage (CoinMessages::Language language) |
CoinMessageHandler * | messageHandler () const |
Return handler. | |
CoinMessages | messages () const |
Return messages. | |
CoinMessages * | messagesPointer () |
Return pointer to messages. | |
void | setLogLevel (int value) |
int | logLevel () const |
int | lengthNames () const |
length of names (0 means no names0 | |
const std::vector< std::string > * | rowNames () const |
Row names. | |
const std::string & | rowName (int iRow) const |
const std::vector< std::string > * | columnNames () const |
Column names. | |
const std::string & | columnName (int iColumn) const |
ClpObjective * | objectiveAsObject () const |
Objective methods. | |
void | setObjective (ClpObjective *objective) |
void | setObjectivePointer (ClpObjective *objective) |
Parameter set/get methods | |
The set methods return true if the parameter was set to the given value, false otherwise. There can be various reasons for failure: the given parameter is not applicable for the solver (e.g., refactorization frequency for the volume algorithm), the parameter is not yet implemented for the solver or simply the value of the parameter is out of the range the solver accepts. If a parameter setting call returns false check the details of your solver. The get methods return true if the given parameter is applicable for the solver and is implemented. In this case the value of the parameter is returned in the second argument. Otherwise they return false.
once it has been decided where solver sits this may be redone | |
bool | setIntParam (ClpIntParam key, int value) |
Set an integer parameter. | |
bool | setDblParam (ClpDblParam key, double value) |
Set an double parameter. | |
bool | setStrParam (ClpStrParam key, const std::string &value) |
Set an string parameter. | |
bool | getIntParam (ClpIntParam key, int &value) const |
bool | getDblParam (ClpDblParam key, double &value) const |
bool | getStrParam (ClpStrParam key, std::string &value) const |
Protected Member Functions | |
private or protected methods | |
void | gutsOfDelete () |
Does most of deletion. | |
void | gutsOfCopy (const ClpModel &rhs, bool trueCopy=true) |
void | getRowBound (int iRow, double &lower, double &upper) const |
gets lower and upper bounds on rows | |
void | gutsOfLoadModel (int numberRows, int numberColumns, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, const double *rowObjective=NULL) |
puts in format I like - 4 array matrix - may make row copy | |
Protected Attributes | |
data | |
double | optimizationDirection_ |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. | |
double | dblParam_ [ClpLastDblParam] |
Array of double parameters. | |
double | objectiveValue_ |
Objective value. | |
double | smallElement_ |
Small element value. | |
int | numberRows_ |
Number of rows. | |
int | numberColumns_ |
Number of columns. | |
double * | rowActivity_ |
Row activities. | |
double * | columnActivity_ |
Column activities. | |
double * | dual_ |
Duals. | |
double * | reducedCost_ |
Reduced costs. | |
double * | rowLower_ |
Row lower. | |
double * | rowUpper_ |
Row upper. | |
ClpObjective * | objective_ |
Objective. | |
double * | rowObjective_ |
Row Objective (? sign) - may be NULL. | |
double * | columnLower_ |
Column Lower. | |
double * | columnUpper_ |
Column Upper. | |
ClpMatrixBase * | matrix_ |
Packed matrix. | |
ClpMatrixBase * | rowCopy_ |
Row copy if wanted. | |
double * | ray_ |
Infeasible/unbounded ray. | |
unsigned char * | status_ |
char * | integerType_ |
Integer information. | |
void * | userPointer_ |
User pointer for whatever reason. | |
int | intParam_ [ClpLastIntParam] |
Array of integer parameters. | |
int | numberIterations_ |
Number of iterations. | |
int | solveType_ |
Solve type - 1 simplex, 2 simplex interface. | |
int | problemStatus_ |
Status of problem. | |
int | secondaryStatus_ |
Secondary status of problem. | |
int | lengthNames_ |
length of names (0 means no names) | |
CoinMessageHandler * | handler_ |
Message handler. | |
bool | defaultHandler_ |
Flag to say if default handler (so delete). | |
std::vector< std::string > | rowNames_ |
Row names. | |
std::vector< std::string > | columnNames_ |
Column names. | |
CoinMessages | messages_ |
Messages. | |
std::string | strParam_ [ClpLastStrParam] |
Array of string parameters. |
I would welcome suggestions for what should be in this and how it relates to OsiSolverInterface. Some methods look very similar.
Definition at line 32 of file ClpModel.hpp.
|
Subproblem constructor. A subset of whole model is created from the row and column lists given. The new order is given by list order and duplicates are allowed. Name and integer information can be dropped Definition at line 1283 of file ClpModel.cpp. References columnActivity_, columnLower_, columnNames_, columnUpper_, dblParam_, defaultHandler_, deleteColumns(), deleteRows(), dual_, gutsOfCopy(), handler_, integerType_, intParam_, lengthNames_, matrix_, messages_, numberColumns(), numberColumns_, numberIterations_, numberRows(), numberRows_, objective_, objectiveValue_, optimizationDirection_, problemStatus_, ray_, reducedCost_, rowActivity_, rowCopy_, rowLower_, rowNames_, rowObjective_, rowUpper_, secondaryStatus_, smallElement_, solveType_, status_, strParam_, ClpMatrixBase::subsetClone(), ClpObjective::subsetClone(), and userPointer_.
01287 { 01288 #if 0 01289 // Could be recoded to be faster and take less memory 01290 // and to allow re-ordering and duplicates etc 01291 gutsOfCopy(*rhs,true); 01292 int numberRowsWhole = rhs->numberRows(); 01293 int * delRow = new int[numberRowsWhole]; 01294 memset(delRow,0,numberRowsWhole*sizeof(int)); 01295 int i; 01296 for (i=0;i<numberRows;i++) { 01297 int iRow=whichRow[i]; 01298 assert (iRow>=0&&iRow<numberRowsWhole); 01299 delRow[iRow]=1; 01300 } 01301 numberRows=0; 01302 for (i=0;i<numberRowsWhole;i++) { 01303 if (delRow[i]==0) 01304 delRow[numberRows++]=i; 01305 } 01306 deleteRows(numberRows,delRow); 01307 delete [] delRow; 01308 int numberColumnsWhole = rhs->numberColumns(); 01309 int * delColumn = new int[numberColumnsWhole]; 01310 memset(delColumn,0,numberColumnsWhole*sizeof(int)); 01311 for (i=0;i<numberColumns;i++) { 01312 int iColumn=whichColumn[i]; 01313 assert (iColumn>=0&&iColumn<numberColumnsWhole); 01314 delColumn[iColumn]=1; 01315 } 01316 numberColumns=0; 01317 for (i=0;i<numberColumnsWhole;i++) { 01318 if (delColumn[i]==0) 01319 delColumn[numberColumns++]=i; 01320 } 01321 deleteColumns(numberColumns,delColumn); 01322 delete [] delColumn; 01323 #else 01324 defaultHandler_ = rhs->defaultHandler_; 01325 if (defaultHandler_) 01326 handler_ = new CoinMessageHandler(*rhs->handler_); 01327 else 01328 handler_ = rhs->handler_; 01329 messages_ = rhs->messages_; 01330 intParam_[ClpMaxNumIteration] = rhs->intParam_[ClpMaxNumIteration]; 01331 intParam_[ClpMaxNumIterationHotStart] = 01332 rhs->intParam_[ClpMaxNumIterationHotStart]; 01333 01334 dblParam_[ClpDualObjectiveLimit] = rhs->dblParam_[ClpDualObjectiveLimit]; 01335 dblParam_[ClpPrimalObjectiveLimit] = rhs->dblParam_[ClpPrimalObjectiveLimit]; 01336 dblParam_[ClpDualTolerance] = rhs->dblParam_[ClpDualTolerance]; 01337 dblParam_[ClpPrimalTolerance] = rhs->dblParam_[ClpPrimalTolerance]; 01338 dblParam_[ClpObjOffset] = rhs->dblParam_[ClpObjOffset]; 01339 dblParam_[ClpMaxSeconds] = rhs->dblParam_[ClpMaxSeconds]; 01340 01341 strParam_[ClpProbName] = rhs->strParam_[ClpProbName]; 01342 01343 optimizationDirection_ = rhs->optimizationDirection_; 01344 objectiveValue_=rhs->objectiveValue_; 01345 smallElement_ = rhs->smallElement_; 01346 numberIterations_ = rhs->numberIterations_; 01347 solveType_ = rhs->solveType_; 01348 problemStatus_ = rhs->problemStatus_; 01349 secondaryStatus_ = rhs->secondaryStatus_; 01350 // check valid lists 01351 int numberBad=0; 01352 int i; 01353 for (i=0;i<numberRows;i++) 01354 if (whichRow[i]<0||whichRow[i]>=rhs->numberRows_) 01355 numberBad++; 01356 if (numberBad) 01357 throw CoinError("bad row list", "subproblem constructor", "ClpModel"); 01358 numberBad=0; 01359 for (i=0;i<numberColumns;i++) 01360 if (whichColumn[i]<0||whichColumn[i]>=rhs->numberColumns_) 01361 numberBad++; 01362 if (numberBad) 01363 throw CoinError("bad column list", "subproblem constructor", "ClpModel"); 01364 numberRows_ = numberRows; 01365 numberColumns_ = numberColumns; 01366 userPointer_ = rhs->userPointer_; 01367 if (!dropNames) { 01368 unsigned int maxLength=0; 01369 int iRow; 01370 rowNames_ = std::vector<std::string> (); 01371 columnNames_ = std::vector<std::string> (); 01372 rowNames_.reserve(numberRows_); 01373 for (iRow=0;iRow<numberRows_;iRow++) { 01374 rowNames_[iRow] = rhs->rowNames_[whichRow[iRow]]; 01375 maxLength = max(maxLength,(unsigned int) strlen(rowNames_[iRow].c_str())); 01376 } 01377 int iColumn; 01378 columnNames_.reserve(numberColumns_); 01379 for (iColumn=0;iColumn<numberColumns_;iColumn++) { 01380 columnNames_[iColumn] = rhs->columnNames_[whichColumn[iColumn]]; 01381 maxLength = max(maxLength,(unsigned int) strlen(columnNames_[iColumn].c_str())); 01382 } 01383 lengthNames_=(int) maxLength; 01384 } else { 01385 lengthNames_ = 0; 01386 rowNames_ = std::vector<std::string> (); 01387 columnNames_ = std::vector<std::string> (); 01388 } 01389 if (rhs->integerType_&&!dropIntegers) { 01390 integerType_ = whichChar(rhs->integerType_,numberColumns,whichColumn); 01391 } else { 01392 integerType_ = NULL; 01393 } 01394 if (rhs->rowActivity_) { 01395 rowActivity_=whichDouble(rhs->rowActivity_,numberRows,whichRow); 01396 dual_=whichDouble(rhs->dual_,numberRows,whichRow); 01397 columnActivity_=whichDouble(rhs->columnActivity_,numberColumns, 01398 whichColumn); 01399 reducedCost_=whichDouble(rhs->reducedCost_,numberColumns, 01400 whichColumn); 01401 } else { 01402 rowActivity_=NULL; 01403 columnActivity_=NULL; 01404 dual_=NULL; 01405 reducedCost_=NULL; 01406 } 01407 rowLower_=whichDouble(rhs->rowLower_,numberRows,whichRow); 01408 rowUpper_=whichDouble(rhs->rowUpper_,numberRows,whichRow); 01409 columnLower_=whichDouble(rhs->columnLower_,numberColumns,whichColumn); 01410 columnUpper_=whichDouble(rhs->columnUpper_,numberColumns,whichColumn); 01411 if (rhs->objective_) 01412 objective_ = rhs->objective_->subsetClone(numberColumns,whichColumn); 01413 else 01414 objective_ = NULL; 01415 rowObjective_=whichDouble(rhs->rowObjective_,numberRows,whichRow); 01416 // status has to be done in two stages 01417 status_ = new unsigned char[numberColumns_+numberRows_]; 01418 unsigned char * rowStatus = whichUnsignedChar(rhs->status_+rhs->numberColumns_, 01419 numberRows_,whichRow); 01420 unsigned char * columnStatus = whichUnsignedChar(rhs->status_, 01421 numberColumns_,whichColumn); 01422 memcpy(status_+numberColumns_,rowStatus,numberRows_); 01423 delete [] rowStatus; 01424 memcpy(status_,columnStatus,numberColumns_); 01425 delete [] columnStatus; 01426 ray_ = NULL; 01427 if (problemStatus_==1&&!secondaryStatus_) 01428 ray_ = whichDouble (rhs->ray_,numberRows,whichRow); 01429 else if (problemStatus_==2) 01430 ray_ = whichDouble (rhs->ray_,numberColumns,whichColumn); 01431 if (rhs->rowCopy_) { 01432 rowCopy_ = rhs->rowCopy_->subsetClone(numberRows,whichRow, 01433 numberColumns,whichColumn); 01434 } else { 01435 rowCopy_=NULL; 01436 } 01437 matrix_=NULL; 01438 if (rhs->matrix_) { 01439 matrix_ = rhs->matrix_->subsetClone(numberRows,whichRow, 01440 numberColumns,whichColumn); 01441 } 01442 #endif 01443 } |
|
Borrow model. This is so we don't have to copy large amounts of data around. It assumes a derived class wants to overwrite an empty model with a real one - while it does an algorithm Reimplemented in ClpSimplex. Definition at line 406 of file ClpModel.cpp. References defaultHandler_, gutsOfCopy(), gutsOfDelete(), handler_, numberColumns_, numberRows_, optimizationDirection_, and ray_. Referenced by ClpSimplex::borrowModel().
00407 { 00408 if (defaultHandler_) { 00409 delete handler_; 00410 handler_ = NULL; 00411 } 00412 gutsOfDelete(); 00413 optimizationDirection_ = rhs.optimizationDirection_; 00414 numberRows_ = rhs.numberRows_; 00415 numberColumns_ = rhs.numberColumns_; 00416 delete [] rhs.ray_; 00417 rhs.ray_=NULL; 00418 gutsOfCopy(rhs,false); 00419 } |
|
Small element value - elements less than this set to zero, default is 1.0e-20 Definition at line 331 of file ClpModel.hpp. References smallElement_.
00332 { return smallElement_;}; |
|
Does most of copying If trueCopy false then just points to arrays Definition at line 297 of file ClpModel.cpp. References ClpMatrixBase::clone(), ClpObjective::clone(), columnActivity_, columnLower_, columnNames_, columnUpper_, dblParam_, defaultHandler_, dual_, handler_, integerType_, intParam_, lengthNames_, matrix_, messages_, numberColumns_, numberIterations_, numberRows_, objective_, objectiveValue_, optimizationDirection_, problemStatus_, ray_, reducedCost_, rowActivity_, rowCopy_, rowLower_, rowNames_, rowObjective_, rowUpper_, secondaryStatus_, smallElement_, solveType_, status_, strParam_, and userPointer_. Referenced by borrowModel(), ClpModel(), and operator=().
00298 { 00299 defaultHandler_ = rhs.defaultHandler_; 00300 if (defaultHandler_) 00301 handler_ = new CoinMessageHandler(*rhs.handler_); 00302 else 00303 handler_ = rhs.handler_; 00304 messages_ = rhs.messages_; 00305 intParam_[ClpMaxNumIteration] = rhs.intParam_[ClpMaxNumIteration]; 00306 intParam_[ClpMaxNumIterationHotStart] = 00307 rhs.intParam_[ClpMaxNumIterationHotStart]; 00308 00309 dblParam_[ClpDualObjectiveLimit] = rhs.dblParam_[ClpDualObjectiveLimit]; 00310 dblParam_[ClpPrimalObjectiveLimit] = rhs.dblParam_[ClpPrimalObjectiveLimit]; 00311 dblParam_[ClpDualTolerance] = rhs.dblParam_[ClpDualTolerance]; 00312 dblParam_[ClpPrimalTolerance] = rhs.dblParam_[ClpPrimalTolerance]; 00313 dblParam_[ClpObjOffset] = rhs.dblParam_[ClpObjOffset]; 00314 dblParam_[ClpMaxSeconds] = rhs.dblParam_[ClpMaxSeconds]; 00315 00316 strParam_[ClpProbName] = rhs.strParam_[ClpProbName]; 00317 00318 optimizationDirection_ = rhs.optimizationDirection_; 00319 objectiveValue_=rhs.objectiveValue_; 00320 smallElement_ = rhs.smallElement_; 00321 numberIterations_ = rhs.numberIterations_; 00322 solveType_ = rhs.solveType_; 00323 problemStatus_ = rhs.problemStatus_; 00324 secondaryStatus_ = rhs.secondaryStatus_; 00325 numberRows_ = rhs.numberRows_; 00326 numberColumns_ = rhs.numberColumns_; 00327 userPointer_ = rhs.userPointer_; 00328 if (trueCopy) { 00329 lengthNames_ = rhs.lengthNames_; 00330 rowNames_ = rhs.rowNames_; 00331 columnNames_ = rhs.columnNames_; 00332 if (rhs.integerType_) { 00333 integerType_ = new char[numberColumns_]; 00334 memcpy(integerType_,rhs.integerType_,numberColumns_*sizeof(char)); 00335 } else { 00336 integerType_ = NULL; 00337 } 00338 if (rhs.rowActivity_) { 00339 rowActivity_=new double[numberRows_]; 00340 columnActivity_=new double[numberColumns_]; 00341 dual_=new double[numberRows_]; 00342 reducedCost_=new double[numberColumns_]; 00343 ClpDisjointCopyN ( rhs.rowActivity_, numberRows_ , 00344 rowActivity_); 00345 ClpDisjointCopyN ( rhs.columnActivity_, numberColumns_ , 00346 columnActivity_); 00347 ClpDisjointCopyN ( rhs.dual_, numberRows_ , 00348 dual_); 00349 ClpDisjointCopyN ( rhs.reducedCost_, numberColumns_ , 00350 reducedCost_); 00351 } else { 00352 rowActivity_=NULL; 00353 columnActivity_=NULL; 00354 dual_=NULL; 00355 reducedCost_=NULL; 00356 } 00357 rowLower_ = ClpCopyOfArray ( rhs.rowLower_, numberRows_ ); 00358 rowUpper_ = ClpCopyOfArray ( rhs.rowUpper_, numberRows_ ); 00359 columnLower_ = ClpCopyOfArray ( rhs.columnLower_, numberColumns_ ); 00360 columnUpper_ = ClpCopyOfArray ( rhs.columnUpper_, numberColumns_ ); 00361 if (rhs.objective_) 00362 objective_ = rhs.objective_->clone(); 00363 else 00364 objective_ = NULL; 00365 rowObjective_ = ClpCopyOfArray ( rhs.rowObjective_, numberRows_ ); 00366 status_ = ClpCopyOfArray( rhs.status_,numberColumns_+numberRows_); 00367 ray_ = NULL; 00368 if (problemStatus_==1&&!secondaryStatus_) 00369 ray_ = ClpCopyOfArray (rhs.ray_,numberRows_); 00370 else if (problemStatus_==2) 00371 ray_ = ClpCopyOfArray (rhs.ray_,numberColumns_); 00372 if (rhs.rowCopy_) { 00373 rowCopy_ = rhs.rowCopy_->clone(); 00374 } else { 00375 rowCopy_=NULL; 00376 } 00377 matrix_=NULL; 00378 if (rhs.matrix_) { 00379 matrix_ = rhs.matrix_->clone(); 00380 } 00381 } else { 00382 rowActivity_ = rhs.rowActivity_; 00383 columnActivity_ = rhs.columnActivity_; 00384 dual_ = rhs.dual_; 00385 reducedCost_ = rhs.reducedCost_; 00386 rowLower_ = rhs.rowLower_; 00387 rowUpper_ = rhs.rowUpper_; 00388 objective_ = rhs.objective_; 00389 rowObjective_ = rhs.rowObjective_; 00390 columnLower_ = rhs.columnLower_; 00391 columnUpper_ = rhs.columnUpper_; 00392 matrix_ = rhs.matrix_; 00393 rowCopy_ = NULL; 00394 ray_ = rhs.ray_; 00395 lengthNames_ = 0; 00396 rowNames_ = std::vector<std::string> (); 00397 columnNames_ = std::vector<std::string> (); 00398 integerType_ = NULL; 00399 status_ = rhs.status_; 00400 } 00401 } |
|
Infeasibility/unbounded ray (NULL returned if none/wrong) Up to user to use delete [] on these arrays. Definition at line 981 of file ClpModel.cpp. References numberRows_, problemStatus_, ray_, and secondaryStatus_.
00982 { 00983 double * array = NULL; 00984 if (problemStatus_==1&&!secondaryStatus_) 00985 array = ClpCopyOfArray(ray_,numberRows_); 00986 return array; 00987 } |
|
Just like the other loadProblem() method except that the matrix is given in a standard column major ordered format (without gaps). Reimplemented in ClpInterior, and ClpSimplex. Definition at line 223 of file ClpModel.cpp. References gutsOfLoadModel(), matrix(), and matrix_.
00231 { 00232 gutsOfLoadModel(numrows, numcols, 00233 collb, colub, obj, rowlb, rowub, rowObjective); 00234 CoinPackedMatrix matrix(true,numrows,numcols,start[numcols], 00235 value,index,start,NULL); 00236 matrix_ = new ClpPackedMatrix(matrix); 00237 } |
|
Loads a problem (the constraints on the rows are given by lower and upper bounds). If a pointer is 0 then the following values are the default:
Reimplemented in ClpInterior, and ClpSimplex. Definition at line 187 of file ClpModel.cpp. References ClpMatrixBase::clone(), ClpMatrixBase::getNumCols(), ClpMatrixBase::getNumRows(), ClpMatrixBase::getPackedMatrix(), gutsOfLoadModel(), ClpMatrixBase::isColOrdered(), matrix_, and ClpMatrixBase::releasePackedMatrix(). Referenced by ClpSimplex::loadProblem(), ClpInterior::loadProblem(), and readMps().
00192 { 00193 gutsOfLoadModel(matrix.getNumRows(),matrix.getNumCols(), 00194 collb, colub, obj, rowlb, rowub, rowObjective); 00195 if (matrix.isColOrdered()) { 00196 matrix_=matrix.clone(); 00197 } else { 00198 // later may want to keep as unknown class 00199 CoinPackedMatrix matrix2; 00200 matrix2.reverseOrderedCopyOf(*matrix.getPackedMatrix()); 00201 matrix.releasePackedMatrix(); 00202 matrix_=new ClpPackedMatrix(matrix2); 00203 } 00204 } |
|
Load up quadratic objective. This is stored as a CoinPackedMatrix Definition at line 1202 of file ClpModel.cpp. References ClpObjective::gradient(), numberColumns_, and objective_.
01204 { 01205 assert (numberColumns==numberColumns_); 01206 assert ((dynamic_cast< ClpLinearObjective*>(objective_))); 01207 double offset; 01208 ClpObjective * obj = new ClpQuadraticObjective(objective_->gradient(NULL,offset,false),numberColumns, 01209 start,column,element); 01210 delete objective_; 01211 objective_ = obj; 01212 01213 } |
|
Replace Clp Matrix (current is not deleted and new is used) So up to user to delete one Definition at line 1278 of file ClpModel.cpp. References matrix_.
01279 { 01280 matrix_=matrix; 01281 } |
|
Return model - nulls all arrays so can be deleted safely also updates any scalars Definition at line 422 of file ClpModel.cpp. References columnActivity_, columnLower_, columnUpper_, defaultHandler_, dual_, handler_, matrix_, numberIterations_, objective_, objectiveValue_, problemStatus_, ray_, reducedCost_, rowActivity_, rowCopy_, rowLower_, rowObjective_, rowUpper_, secondaryStatus_, and status_. Referenced by ClpSimplex::returnModel().
00423 { 00424 otherModel.objectiveValue_=objectiveValue_; 00425 otherModel.numberIterations_ = numberIterations_; 00426 otherModel.problemStatus_ = problemStatus_; 00427 otherModel.secondaryStatus_ = secondaryStatus_; 00428 rowActivity_ = NULL; 00429 columnActivity_ = NULL; 00430 dual_ = NULL; 00431 reducedCost_ = NULL; 00432 rowLower_ = NULL; 00433 rowUpper_ = NULL; 00434 objective_ = NULL; 00435 rowObjective_ = NULL; 00436 columnLower_ = NULL; 00437 columnUpper_ = NULL; 00438 matrix_ = NULL; 00439 rowCopy_ = NULL; 00440 delete [] otherModel.ray_; 00441 otherModel.ray_ = ray_; 00442 ray_ = NULL; 00443 // do status 00444 if (otherModel.status_!=status_) { 00445 delete [] otherModel.status_; 00446 otherModel.status_ = status_; 00447 } 00448 status_ = NULL; 00449 if (defaultHandler_) { 00450 delete handler_; 00451 handler_ = NULL; 00452 } 00453 } |
|
Secondary status of problem - may get extended 0 - none 1 - primal infeasible because dual limit reached 2 - scaled problem optimal - unscaled problem has primal infeasibilities 3 - scaled problem optimal - unscaled problem has dual infeasibilities 4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities Definition at line 239 of file ClpModel.hpp. References secondaryStatus_.
00239 { return secondaryStatus_; } |
|
Amount of print out: 0 - none 1 - just final 2 - just factorizations 3 - as 2 plus a bit more 4 - verbose above that 8,16,32 etc just for selective debug Definition at line 395 of file ClpModel.hpp. References handler_, and CoinMessageHandler::setLogLevel(). Referenced by ClpSimplex::initialSolve(), ClpSimplexPrimalQuadratic::makeQuadratic(), ClpSimplexPrimalQuadratic::primalSLP(), and ClpItem::setIntParameter().
00395 { handler_->setLogLevel(value); } |
|
Status of problem: 0 - optimal 1 - primal infeasible 2 - dual infeasible 3 - stopped on iterations etc 4 - stopped due to errors Definition at line 228 of file ClpModel.hpp. References problemStatus_. Referenced by ClpSimplex::initialSolve(), ClpSimplexPrimalQuadratic::primalSLP(), and readMps().
00228 { return problemStatus_; } |
|
Return copy of status array (char[numberRows+numberColumns]), use delete [] Definition at line 1183 of file ClpModel.cpp. References numberColumns_, numberRows_, and status_.
01184 {
01185 return ClpCopyOfArray(status_,numberRows_+numberColumns_);
01186 }
|
|
Status Region. I know that not all algorithms need a status array, but it made sense for things like crossover and put all permanent stuff in one place. No assumption is made about what is in status array (although it might be good to reserve bottom 3 bits (i.e. 0-7 numeric) for classic status). This is number of columns + number of rows long (in that order). Definition at line 544 of file ClpModel.hpp. Referenced by ClpModel(), ClpSimplex::ClpSimplex(), copyinStatus(), deleteColumns(), deleteRows(), gutsOfCopy(), gutsOfDelete(), ClpSimplex::originalModel(), resize(), returnModel(), statusArray(), statusCopy(), and statusExists(). |