187 void addRow(
int numberInRow,
const int *columns,
188 const double *elements,
double rowLower = -
COIN_DBL_MAX,
189 double rowUpper =
COIN_DBL_MAX,
const char *name = NULL);
191 void addColumn(
int numberInColumn,
const int *rows,
192 const double *elements,
193 double columnLower = 0.0,
194 double columnUpper =
COIN_DBL_MAX,
double objectiveValue = 0.0,
195 const char *name = NULL,
bool isInteger =
false);
197 inline void addCol(
int numberInColumn,
const int *rows,
198 const double *elements,
199 double columnLower = 0.0,
200 double columnUpper =
COIN_DBL_MAX,
double objectiveValue = 0.0,
201 const char *name = NULL,
bool isInteger =
false)
203 addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue,
209 setElement(i, j, value);
212 void setElement(
int i,
int j,
double value);
218 int getRow(
int whichRow,
int *column,
double *element);
224 int getColumn(
int whichColumn,
int *column,
double *element);
226 void setQuadraticElement(
int i,
int j,
double value);
230 setElement(i, j, value);
233 void setElement(
int i,
int j,
const char *value);
235 int associateElement(
const char *stringValue,
double value);
239 void setRowLower(
int whichRow,
double rowLower);
243 void setRowUpper(
int whichRow,
double rowUpper);
247 void setRowBounds(
int whichRow,
double rowLower,
double rowUpper);
251 void setRowName(
int whichRow,
const char *rowName);
255 void setColumnLower(
int whichColumn,
double columnLower);
259 void setColumnUpper(
int whichColumn,
double columnUpper);
263 void setColumnBounds(
int whichColumn,
double columnLower,
double columnUpper);
267 void setColumnObjective(
int whichColumn,
double columnObjective);
271 void setColumnName(
int whichColumn,
const char *columnName);
275 void setColumnIsInteger(
int whichColumn,
bool columnIsInteger);
281 setColumnObjective(whichColumn, columnObjective);
288 setColumnIsInteger(whichColumn, columnIsInteger);
295 setColumnIsInteger(whichColumn,
true);
302 setColumnIsInteger(whichColumn,
false);
309 setColumnLower(whichColumn, columnLower);
316 setColumnUpper(whichColumn, columnUpper);
321 inline void setColBounds(
int whichColumn,
double columnLower,
double columnUpper)
323 setColumnBounds(whichColumn, columnLower, columnUpper);
330 setColumnObjective(whichColumn, columnObjective);
335 inline void setColName(
int whichColumn,
const char *columnName)
337 setColumnName(whichColumn, columnName);
344 setColumnIsInteger(whichColumn, columnIsInteger);
349 void setRowLower(
int whichRow,
const char *rowLower);
353 void setRowUpper(
int whichRow,
const char *rowUpper);
357 void setColumnLower(
int whichColumn,
const char *columnLower);
361 void setColumnUpper(
int whichColumn,
const char *columnUpper);
365 void setColumnObjective(
int whichColumn,
const char *columnObjective);
369 void setColumnIsInteger(
int whichColumn,
const char *columnIsInteger);
375 setColumnObjective(whichColumn, columnObjective);
382 setColumnIsInteger(whichColumn, columnIsInteger);
386 void deleteRow(
int whichRow);
389 void deleteColumn(
int whichColumn);
394 deleteColumn(whichColumn);
399 void deleteThisElement(
int row,
int column,
CoinBigIndex position);
410 return packColumns();
420 void setObjective(
int numberColumns,
const double *objective);
423 void setColumnLower(
int numberColumns,
const double *columnLower);
426 inline void setColLower(
int numberColumns,
const double *columnLower)
428 setColumnLower(numberColumns, columnLower);
432 void setColumnUpper(
int numberColumns,
const double *columnUpper);
435 inline void setColUpper(
int numberColumns,
const double *columnUpper)
437 setColumnUpper(numberColumns, columnUpper);
441 void setRowLower(
int numberRows,
const double *rowLower);
444 void setRowUpper(
int numberRows,
const double *rowUpper);
471 int writeMps(
const char *filename,
int compression = 0,
472 int formatType = 0,
int numberAcross = 2,
bool keepStrings =
false);
478 int differentModel(
CoinModel &other,
bool ignoreNames);
491 return packedMatrix_;
510 return numberElements_;
520 return getElement(i, j);
523 double getElement(
int i,
int j)
const;
525 inline double operator()(
const char *rowName,
const char *columnName)
const 527 return getElement(rowName, columnName);
530 double getElement(
const char *rowName,
const char *columnName)
const;
532 double getQuadraticElement(
int i,
int j)
const;
537 const char *getElementAsString(
int i,
int j)
const;
541 double *pointer(
int i,
int j)
const;
585 double getRowLower(
int whichRow)
const;
588 double getRowUpper(
int whichRow)
const;
591 const char *getRowName(
int whichRow)
const;
594 return getRowLower(whichRow);
600 return getRowUpper(whichRow);
604 inline const char *
rowName(
int whichRow)
const 606 return getRowName(whichRow);
610 double getColumnLower(
int whichColumn)
const;
613 double getColumnUpper(
int whichColumn)
const;
616 double getColumnObjective(
int whichColumn)
const;
619 const char *getColumnName(
int whichColumn)
const;
622 bool getColumnIsInteger(
int whichColumn)
const;
627 return getColumnLower(whichColumn);
633 return getColumnUpper(whichColumn);
639 return getColumnObjective(whichColumn);
645 return getColumnObjective(whichColumn);
651 return getColumnName(whichColumn);
657 return getColumnIsInteger(whichColumn);
663 return getColumnIsInteger(whichColumn);
669 return getColumnLower(whichColumn);
675 return getColumnUpper(whichColumn);
681 return getColumnObjective(whichColumn);
687 return getColumnName(whichColumn);
693 return getColumnIsInteger(whichColumn);
697 const char *getRowLowerAsString(
int whichRow)
const;
700 const char *getRowUpperAsString(
int whichRow)
const;
703 return getRowLowerAsString(whichRow);
709 return getRowUpperAsString(whichRow);
713 const char *getColumnLowerAsString(
int whichColumn)
const;
716 const char *getColumnUpperAsString(
int whichColumn)
const;
719 const char *getColumnObjectiveAsString(
int whichColumn)
const;
722 const char *getColumnIsIntegerAsString(
int whichColumn)
const;
727 return getColumnLowerAsString(whichColumn);
733 return getColumnUpperAsString(whichColumn);
739 return getColumnObjectiveAsString(whichColumn);
745 return getColumnObjectiveAsString(whichColumn);
751 return getColumnIsIntegerAsString(whichColumn);
757 return getColumnIsIntegerAsString(whichColumn);
760 int row(
const char *rowName)
const;
762 int column(
const char *columnName)
const;
771 return -1.23456787654321e-97;
775 const double *associated);
782 const double *associated);
787 const double *associated);
789 int createArrays(
double *&rowLower,
double *&rowUpper,
790 double *&columnLower,
double *&columnUpper,
791 double *&objective,
int *&integerType,
792 double *&associated);
796 return string_.numberItems() != 0;
891 int whatIsSet()
const;
912 const double *collb,
const double *colub,
914 const double *rowlb,
const double *rowub);
932 const double *collb,
const double *colub,
934 const char *rowsen,
const double *rowrhs,
935 const double *rowrng);
949 void loadBlock(
const int numcols,
const int numrows,
952 const double *collb,
const double *colub,
954 const double *rowlb,
const double *rowub);
968 void loadBlock(
const int numcols,
const int numrows,
971 const double *collb,
const double *colub,
973 const char *rowsen,
const double *rowrhs,
974 const double *rowrng);
986 CoinModel(
const char *fileName,
int allowStrings = 0);
990 CoinModel(
int nonLinear,
const char *fileName,
const void *info);
992 CoinModel(
int numberRows,
int numberColumns,
994 const double *rowLower,
const double *rowUpper,
995 const double *columnLower,
const double *columnUpper,
996 const double *objective);
1014 void validateLinks()
const;
1019 void resize(
int maximumRows,
int maximumColumns,
CoinBigIndex maximumElements);
1021 void fillRows(
int which,
bool forceCreation,
bool fromAddRow =
false);
1023 void fillColumns(
int which,
bool forceCreation,
bool fromAddColumn =
false);
1030 void createList(
int type)
const;
1032 int addString(
const char *
string);
1038 void freeStringMemory(
CoinYacc &info);
1042 int computeAssociated(
double *associated);
1049 int &numberBad)
const;
1051 void replaceQuadraticRow(
int rowNumber,
const double *linear,
const CoinPackedMatrix *quadraticPart);
1056 CoinModel *reorder(
const char *mark)
const;
1067 int expandKnapsack(
int knapsackRow,
int &numberOutput,
double *buildObj,
CoinBigIndex *buildStart,
1068 int *buildRow,
double *buildElement,
int reConstruct = -1)
const;
1070 void setCutMarker(
int size,
const int *marker);
1072 void setPriorities(
int size,
const int *priorities);
1079 void setOriginalIndices(
const int *row,
const int *column);
1085 void gdb(
int nonLinear,
const char *fileName,
const void *info);
1087 int decodeBit(
char *phrase,
char *&nextPhrase,
double &coefficient,
bool ifFirst)
const;
1089 void badType()
const;
const char * isIntegerAsString(int whichColumn) const
Gets if integer (if column does not exist then false)
void zapColumnNames()
Reset column names.
const int * cutMarker() const
Returns array of 0 or nonzero if can be a cut (or returns NULL)
bool noNames_
True if no names EVER being used (for users who know what they are doing)
CoinPackedMatrix * packedMatrix_
Actual elements as CoinPackedMatrix.
CoinModelTriple * quadraticElements_
Actual quadratic elements (always linked lists)
void setColIsInteger(int whichColumn, bool columnIsInteger)
Sets integer (if column does not exist then all columns up to this are defined with default values an...
const char * columnUpperAsString(int whichColumn) const
Gets columnUpper (if column does not exist then COIN_DBL_MAX)
int sizeAssociated_
Size of associated values.
double columnLower(int whichColumn) const
Gets columnLower (if column does not exist then 0.0)
int packCols()
Packs down all columns i.e.
const CoinModelHash * stringArray() const
Return string array.
CoinMessageHandler * handler_
Message handler (Passed in)
bool getColIsInteger(int whichColumn) const
Gets if integer (if column does not exist then false)
bool isInteger(int whichColumn) const
Gets if integer (if column does not exist then false)
double optimizationDirection_
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
void setColObjective(int whichColumn, double columnObjective)
Sets columnObjective (if column does not exist then all columns up to this are defined with default v...
const char * getColName(int whichColumn) const
Gets name (if column does not exist then NULL)
CoinModelLinkedList rowList_
Linked list for rows.
const CoinModelHash * columnNames() const
Return column names array.
void deleteCol(int whichColumn)
Deletes all entries in column and bounds.
const CoinPackedMatrix * packedMatrix() const
Return a pointer to CoinPackedMatrix (or NULL)
double optimizationDirection() const
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
int numberColumns() const
Return number of columns.
void setColumnBlock(const std::string &name)
Set column block name.
int numberRows() const
Return number of rows.
int logLevel() const
Get print level 0 - off, 1 - errors, 2 - more.
double * rowLower_
Row lower.
void setColLower(int numberColumns, const double *columnLower)
Sets columnLower array.
void operator()(int i, int j, double value)
Sets value for row i and column j.
virtual CoinBigIndex numberElements() const =0
Return number of elements.
This is for various structures/classes needed by CoinModel.
int sortSize_
Size of sort arrays.
int * cut_
Nonzero if row is cut - done in one go e.g. from ampl.
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
double rowUpper(int whichRow) const
Gets rowUpper (if row does not exist then COIN_DBL_MAX)
double getColLower(int whichColumn) const
Gets columnLower (if column does not exist then 0.0)
double * rowUpperArray() const
Return rowUpper array.
int * memberSOS_
SOS members.
CoinBigIndex numberElements_
Current number of elements.
const char * columnIsIntegerAsString(int whichColumn) const
Gets if integer (if column does not exist then false)
double unsetValue() const
returns unset value
double * rowUpper_
Row upper.
CoinBigIndex maximumElements_
Maximum number of elements.
const char * rowLowerAsString(int whichRow) const
Base class for message handling.
void setIsInteger(int whichColumn, bool columnIsInteger)
Sets integer state (if column does not exist then all columns up to this are defined with default val...
double * columnLowerArray() const
Return columnLower array.
const char * columnLowerAsString(int whichColumn) const
Gets columnLower (if column does not exist then 0.0)
const char * rowUpperAsString(int whichRow) const
Gets rowUpper (if row does not exist then COIN_DBL_MAX)
double * columnUpper_
Column Upper.
CoinBigIndex maximumQuadraticElements_
Maximum number of quadratic elements.
double columnObjective(int whichColumn) const
Gets columnObjective (if column does not exist then 0.0)
int * columnType_
Column types.
double * rowLowerArray() const
Return rowLower array.
int * priority_
priorities (given for all columns (-1 if not integer)
void setOptimizationDirection(double value)
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
void operator()(int i, int j, const char *value)
Sets value for row i and column j as string.
double * objective_
Objective.
double * referenceSOS_
SOS reference.
CoinModelHash string_
Strings.
void setColName(int whichColumn, const char *columnName)
Sets name (if column does not exist then all columns up to this are defined with default values and n...
double * columnLower_
Column Lower.
double rowLower(int whichRow) const
This is a first attempt at a message handler.
const std::string & getRowBlock() const
Return the row block name.
CoinModelTriple * elements_
Actual elements.
int * integerTypeArray() const
Return integerType array.
void setContinuous(int whichColumn)
Sets continuous (if column does not exist then all columns up to this are defined with default values...
CoinModelLinkedList quadraticRowList_
Linked list for quadratic rows.
const int * priorities() const
priorities (given for all columns (-1 if not integer)
const char * columnName(int whichColumn) const
Gets name (if column does not exist then NULL)
double * associated_
Associated values.
CoinModelHash2 hashQuadraticElements_
Hash for quadratic elements.
double columnUpper(int whichColumn) const
Gets columnUpper (if column does not exist then COIN_DBL_MAX)
void setMessageHandler(CoinMessageHandler *handler)
Pass in message handler.
CoinModelLinkedList quadraticColumnList_
Linked list for quadratic columns.
CoinBaseModel()
Default Constructor.
bool columnIsInteger(int whichColumn) const
Gets if integer (if column does not exist then false)
void setIsInteger(int whichColumn, const char *columnIsInteger)
Sets integer (if column does not exist then all columns up to this are defined with default values an...
void * moreInfo() const
Return pointer to more information.
double operator()(int i, int j) const
Returns value for row i and column j.
int numberSOS_
Number of SOS - all these are done in one go e.g. from ampl.
std::string rowBlockName_
Rowblock name.
void setMoreInfo(void *info)
Set pointer to more information.
void setColUpper(int whichColumn, double columnUpper)
Sets columnUpper (if column does not exist then all columns up to this are defined with default value...
const CoinModelTriple * elements() const
Return elements as triples.
int numberColumns_
Current number of columns.
Sparse Matrix Base Class.
int type_
Type of build - -1 unset, 0 for row, 1 for column, 2 linked.
CoinModelLinkedList columnList_
Linked list for columns.
int * startSOS_
SOS starts.
double objective(int whichColumn) const
Gets columnObjective (if column does not exist then 0.0)
int * prioritySOS_
SOS priority.
void * moreInfo_
Pointer to more information.
CoinMessages messages_
Messages.
virtual CoinBaseModel * clone() const =0
Clone.
const int * originalRows() const
Return pointers to original rows (for decomposition)
void setProblemName(const char *name)
Set problem name.
double optimizationDirection() const
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
const std::string & getColumnBlock() const
Return the column block name.
bool stringsExist() const
Says if strings exist.
const char * objectiveAsString(int whichColumn) const
Gets columnObjective (if column does not exist then 0.0)
int numberRows_
Current number of rows.
double * columnUpperArray() const
Return columnUpper array.
void zapRowNames()
Reset row names.
CoinBigIndex * start_
If simple then start of each row/column.
double * sortElements_
Array for sorting elements.
double * associatedArray() const
Returns associated array.
double objectiveOffset() const
Returns the (constant) objective offset This is the RHS entry for the objective row.
void setObjective(int whichColumn, const char *columnObjective)
Sets columnObjective (if column does not exist then all columns up to this are defined with default v...
double objectiveOffset_
Objective offset to be passed on.
CoinModelHash2 hashElements_
Hash for elements.
int links_
Links present (could be tested by sizes of objects) 0 - none, 1 - row links, 2 - column links...
void setRowBlock(const std::string &name)
Set row block name.
const int * originalColumns() const
Return pointers to original columns (for decomposition)
std::string columnBlockName_
Columnblock name.
void setOptimizationDirection(double value)
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
double getDoubleFromString(CoinYacc &info, const char *string, const char *x, double xValue)
faster version
int maximumColumns_
Maximum number of columns.
const double COIN_DBL_MAX
void addCol(int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0, const char *name=NULL, bool isInteger=false)
add a column - numberInColumn may be zero */
double getColUpper(int whichColumn) const
Gets columnUpper (if column does not exist then COIN_DBL_MAX)
const char * rowName(int whichRow) const
Gets name (if row does not exist then NULL)
void setLogLevel(int value)
Set print level 0 - off, 1 - errors, 2 - more.
int * sortIndices_
Array for sorting indices.
CoinBaseModel & operator=(const CoinBaseModel &rhs)
Assignment operator.
void setColLower(int whichColumn, double columnLower)
Sets columnLower (if column does not exist then all columns up to this are defined with default value...
const CoinModelHash * rowNames() const
Return row names array.
virtual ~CoinBaseModel()
Destructor.
const char * columnObjectiveAsString(int whichColumn) const
Gets columnObjective (if column does not exist then 0.0)
int logLevel_
Print level.
void setColUpper(int numberColumns, const double *columnUpper)
Sets columnUpper array.
void setInteger(int whichColumn)
Sets integer (if column does not exist then all columns up to this are defined with default values an...
void setColBounds(int whichColumn, double columnLower, double columnUpper)
Sets columnLower and columnUpper (if column does not exist then all columns up to this are defined wi...
std::string problemName_
Problem name.
CoinModelHash columnName_
Column names.
double * objectiveArray() const
Return objective array.
double getColObjective(int whichColumn) const
Gets columnObjective (if column does not exist then 0.0)
CoinModelHash rowName_
Row names.
int * integerType_
Integer information.
Class to hold and manipulate an array of massaged messages.
double getFunctionValueFromString(const char *string, const char *x, double xValue)
Just function of single variable x.
void setObjective(int whichColumn, double columnObjective)
Sets columnObjective (if column does not exist then all columns up to this are defined with default v...
CoinBigIndex numberQuadraticElements_
Current number of quadratic elements.
void setObjectiveOffset(double value)
Set objective offset.
const char * getProblemName() const
Return the problem name.
int type() const
Returns type.
double operator()(const char *rowName, const char *columnName) const
Returns value for row rowName and column columnName.