![]() |
FMT 1.2.0
Forest management tools for forest planning
|
Helper caching rows and columns to add to a solver matrix in batch for efficiency. More...
#include <FMTMatrixBuild.h>
Public Member Functions | |
| void | swap (FMTMatrixBuild &rhs) |
| Swap this FMTMatrixBuild with another. | |
| std::vector< std::string > & | getColumnNames () |
| Return the cached column names. | |
| std::vector< std::string > & | getRowNames () |
| Return the cached row names. | |
| void | formatAllNames (bool shortformat) |
| Format the cached row and column names. | |
| void | setColName (const std::string &name, const int &columnid) |
| Set a column name. | |
| void | setRowName (const std::string &name, const int &rowid) |
| Set a row name. | |
| void | synchronize (std::shared_ptr< OsiSolverInterface > solver) |
| Synchronize the cached columns and rows with the solver matrix. | |
| FMTMatrixBuild () | |
| Default constructor for FMTMatrixBuild. | |
| FMTMatrixBuild (const FMTMatrixBuild &rhs) | |
| Copy constructor for FMTMatrixBuild. | |
| FMTMatrixBuild & | operator= (const FMTMatrixBuild &rhs) |
| Copy assignment operator for FMTMatrixBuild. | |
| ~FMTMatrixBuild () | |
| Destructor for FMTMatrixBuild. | |
| void | addCol (int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=std::numeric_limits< double >::max(), double objectiveValue=0.0) |
| Add a column to the cache to potentially synchronize it later. | |
| void | addRow (int numberInRow, const int *columns, const double *elements, double rowLower=-std::numeric_limits< double >::max(), double rowUpper=std::numeric_limits< double >::max()) |
| Add a row to the cache to potentially synchronize it later. | |
| void | deleteRow (const int &rowindex) |
| Delete a row from the matrix cache. | |
| void | deleteCol (const int &colindex) |
| Delete a column from the matrix cache. | |
| int | numberNewRows () const |
| Return the number of newly added rows in the matrix cache. | |
| int | numberNewCols () const |
| Return the number of newly added columns in the matrix cache. | |
| int | numberOfDeletedRows () const |
| Return the number of newly deleted rows in the matrix cache. | |
| int | numberOfDeletedCols () const |
| Return the number of newly deleted columns in the matrix cache. | |
| const std::vector< int > & | getDeletedConstraints () const |
| Return the newly deleted rows in the matrix cache. | |
| const std::vector< int > & | getDeletedVariables () const |
| Return the newly deleted columns in the matrix cache. | |
| void | sortAndCleanDeleted () |
| Remove duplicates from the deleted rows and columns and sort them. | |
| std::string | getRowsToSynchronize () const |
| Return a string of all the rows in the matrix cache, mainly for debugging. | |
| std::string | getColsToSynchronize () const |
| Return a string of all the columns in the matrix cache, mainly for debugging. | |
| int | getRow (int whichRow, double &rowLower, double &rowUpper, std::vector< int > &indices, std::vector< double > &elements) const |
| Fill up the bounds, indices and elements of a given row present in the cache. | |
| int | getCol (int whichCol, double &colLower, double &colUpper, double &objectiveValue, std::vector< int > &indices, std::vector< double > &elements) const |
| Fill up the bounds, objective, indices and elements of a given column present in the cache. | |
Helper caching rows and columns to add to a solver matrix in batch for efficiency.
CoinBuild lets the user add rows or columns and then synchronize them with the matrix. This class keeps track of the last added columns and rows to let the user virtually add more to the matrix.
| Models::FMTMatrixBuild::FMTMatrixBuild | ( | ) |
Default constructor for FMTMatrixBuild.
| Models::FMTMatrixBuild::FMTMatrixBuild | ( | const FMTMatrixBuild & | rhs | ) |
Copy constructor for FMTMatrixBuild.
| [in] | rhs | the FMTMatrixBuild to copy. |
| Models::FMTMatrixBuild::~FMTMatrixBuild | ( | ) |
Destructor for FMTMatrixBuild.
| void Models::FMTMatrixBuild::addCol | ( | int | numberInColumn, |
| const int * | rows, | ||
| const double * | elements, | ||
| double | columnLower = 0.0, |
||
| double | columnUpper = std::numeric_limits< double >::max(), |
||
| double | objectiveValue = 0.0 |
||
| ) |
Add a column to the cache to potentially synchronize it later.
| [in] | numberInColumn | the number of elements in the column. |
| [in] | rows | the row indices. |
| [in] | elements | the elements. |
| [in] | columnLower | the column lower bound. |
| [in] | columnUpper | the column upper bound. |
| [in] | objectiveValue | the objective value. |
| void Models::FMTMatrixBuild::addRow | ( | int | numberInRow, |
| const int * | columns, | ||
| const double * | elements, | ||
| double | rowLower = -std::numeric_limits< double >::max(), |
||
| double | rowUpper = std::numeric_limits< double >::max() |
||
| ) |
Add a row to the cache to potentially synchronize it later.
| [in] | numberInRow | the number of elements in the row. |
| [in] | columns | the column indices. |
| [in] | elements | the elements. |
| [in] | rowLower | the row lower bound. |
| [in] | rowUpper | the row upper bound. |
| void Models::FMTMatrixBuild::deleteCol | ( | const int & | colindex | ) |
Delete a column from the matrix cache.
| [in] | colindex | the index of the column to delete. |
| void Models::FMTMatrixBuild::deleteRow | ( | const int & | rowindex | ) |
Delete a row from the matrix cache.
| [in] | rowindex | the index of the row to delete. |
| void Models::FMTMatrixBuild::formatAllNames | ( | bool | shortformat | ) |
Format the cached row and column names.
| [in] | shortformat | if true uses a short format. |
| int Models::FMTMatrixBuild::getCol | ( | int | whichCol, |
| double & | colLower, | ||
| double & | colUpper, | ||
| double & | objectiveValue, | ||
| std::vector< int > & | indices, | ||
| std::vector< double > & | elements | ||
| ) | const |
Fill up the bounds, objective, indices and elements of a given column present in the cache.
| [in] | whichCol | the column index. |
| [out] | colLower | the column lower bound. |
| [out] | colUpper | the column upper bound. |
| [out] | objectiveValue | the objective value. |
| [out] | indices | the column indices. |
| [out] | elements | the column elements. |
| std::string Models::FMTMatrixBuild::getColsToSynchronize | ( | ) | const |
Return a string of all the columns in the matrix cache, mainly for debugging.
|
inline |
Return the cached column names.
|
inline |
Return the newly deleted rows in the matrix cache.
|
inline |
Return the newly deleted columns in the matrix cache.
| int Models::FMTMatrixBuild::getRow | ( | int | whichRow, |
| double & | rowLower, | ||
| double & | rowUpper, | ||
| std::vector< int > & | indices, | ||
| std::vector< double > & | elements | ||
| ) | const |
Fill up the bounds, indices and elements of a given row present in the cache.
| [in] | whichRow | the row index. |
| [out] | rowLower | the row lower bound. |
| [out] | rowUpper | the row upper bound. |
| [out] | indices | the row indices. |
| [out] | elements | the row elements. |
|
inline |
Return the cached row names.
| std::string Models::FMTMatrixBuild::getRowsToSynchronize | ( | ) | const |
Return a string of all the rows in the matrix cache, mainly for debugging.
|
inline |
Return the number of newly added columns in the matrix cache.
|
inline |
Return the number of newly added rows in the matrix cache.
|
inline |
Return the number of newly deleted columns in the matrix cache.
|
inline |
Return the number of newly deleted rows in the matrix cache.
| FMTMatrixBuild & Models::FMTMatrixBuild::operator= | ( | const FMTMatrixBuild & | rhs | ) |
Copy assignment operator for FMTMatrixBuild.
| [in] | rhs | the FMTMatrixBuild to copy. |
| void Models::FMTMatrixBuild::setColName | ( | const std::string & | name, |
| const int & | columnid | ||
| ) |
Set a column name.
| [in] | name | the name to set. |
| [in] | columnid | the column id. |
| void Models::FMTMatrixBuild::setRowName | ( | const std::string & | name, |
| const int & | rowid | ||
| ) |
Set a row name.
| [in] | name | the name to set. |
| [in] | rowid | the row id. |
| void Models::FMTMatrixBuild::sortAndCleanDeleted | ( | ) |
Remove duplicates from the deleted rows and columns and sort them.
| void Models::FMTMatrixBuild::swap | ( | FMTMatrixBuild & | rhs | ) |
Swap this FMTMatrixBuild with another.
| [in,out] | rhs | the FMTMatrixBuild to swap with. |
| void Models::FMTMatrixBuild::synchronize | ( | std::shared_ptr< OsiSolverInterface > | solver | ) |
Synchronize the cached columns and rows with the solver matrix.
| [in] | solver | the solver interface. |