FMT 0.9.8
Forest management tools for forest planning
|
#include <FMTmatrixbuild.hpp>
Public Member Functions | |
void | swap (FMTmatrixbuild &rhs) |
std::vector< std::string > & | getcolumnnames () |
std::vector< std::string > & | getrownames () |
void | formatallnames (bool shortformat) |
void | setcolname (const std::string &name, const int &columnid) |
void | setrowname (const std::string &name, const int &rowid) |
void | synchronize (std::shared_ptr< OsiSolverInterface > solver) |
FMTmatrixbuild () | |
FMTmatrixbuild (const FMTmatrixbuild &rhs) | |
FMTmatrixbuild & | operator= (const FMTmatrixbuild &rhs) |
~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) |
void | addRow (int numberInRow, const int *columns, const double *elements, double rowLower=-std::numeric_limits< double >::max(), double rowUpper=std::numeric_limits< double >::max()) |
void | deleteRow (const int &rowindex) |
void | deleteCol (const int &colindex) |
int | numbernewRows () const |
int | numbernewCols () const |
int | numberofdeletedRows () const |
int | numberofdeletedCols () const |
const std::vector< int > & | getdeletedconstraints () const |
const std::vector< int > & | getdeletedvariables () const |
void | sortandcleandeleted () |
std::string | getrowstosynchronize () const |
std::string | getcolstosynchronize () const |
int | getrow (int whichRow, double &rowLower, double &rowUpper, std::vector< int > &indices, std::vector< double > &elements) const |
int | getcol (int whichCol, double &colLower, double &colUpper, double &objectiveValue, std::vector< int > &indices, std::vector< double > &elements) const |
Sometime adding constraints and/or variables one at a time to the matrix using osisolverinterface can be slow. CoinBuild object lets the user add row or variable to that class and then synchronize it with the matrix. This class keeps track of the last added columns and last added row to let the user virtualy add more stuff to the matrix (row and/or columns). This class is made for efficiency.
Models::FMTmatrixbuild::FMTmatrixbuild | ( | ) |
Default constructor of FMTmatrixbuild.
Models::FMTmatrixbuild::FMTmatrixbuild | ( | const FMTmatrixbuild & | rhs | ) |
Copy constructor of FMTmatrixbuild.
Models::FMTmatrixbuild::~FMTmatrixbuild | ( | ) |
Destructor of 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 colsbuild to potentialy synchronize it with the synchronize function.
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 rowbuild to potentialy synchronize it with the synchronize function.
void Models::FMTmatrixbuild::deleteCol | ( | const int & | colindex | ) |
The function delete a column (colindex) from the matrix cache.
void Models::FMTmatrixbuild::deleteRow | ( | const int & | rowindex | ) |
The function delete a row (rowindex) from the matrix cache.
void Models::FMTmatrixbuild::formatallnames | ( | bool | shortformat | ) |
Formats names of row and column in cache.
int Models::FMTmatrixbuild::getcol | ( | int | whichCol, |
double & | colLower, | ||
double & | colUpper, | ||
double & | objectiveValue, | ||
std::vector< int > & | indices, | ||
std::vector< double > & | elements | ||
) | const |
Given a col (whichCol) the function will fill up the column lower bound (colLower), the column upper bound (colUpper), the column's objective (objectiveValue), the column's (indicies) and the column's elements present in the cache.
std::string Models::FMTmatrixbuild::getcolstosynchronize | ( | ) | const |
The function is mainly for debugging it returns a string of all the columns that are in the matrix cache.
|
inline |
Return cached column names.
|
inline |
Returns the newly deleted rows that are in the matrix cache.
|
inline |
Returns the newly deleted columns that are in the matrix cache.
int Models::FMTmatrixbuild::getrow | ( | int | whichRow, |
double & | rowLower, | ||
double & | rowUpper, | ||
std::vector< int > & | indices, | ||
std::vector< double > & | elements | ||
) | const |
Given a given row (whichRow) the function will fill up the row lower bound (rowLower), the row upper bound (rowUpper), the row's (indicies) and the row's elements present in the cache.
|
inline |
Return cached row names.
std::string Models::FMTmatrixbuild::getrowstosynchronize | ( | ) | const |
The function is mainly for debugging it returns a string of all the rows that are in the matrix cache.
|
inline |
Returns the number of newly added columns that are in the matrix cache.
|
inline |
Returns the number of newly added rows that are in the matrix cache.
|
inline |
Returns the number of newly deleted columns that are in the matrix cache.
|
inline |
Returns the number of newly deleted rows that are in the matrix cache.
FMTmatrixbuild & Models::FMTmatrixbuild::operator= | ( | const FMTmatrixbuild & | rhs | ) |
Copy assignment of FMTmatrixbuild.
void Models::FMTmatrixbuild::setcolname | ( | const std::string & | name, |
const int & | columnid | ||
) |
set column name.
void Models::FMTmatrixbuild::setrowname | ( | const std::string & | name, |
const int & | rowid | ||
) |
set row name.
void Models::FMTmatrixbuild::sortandcleandeleted | ( | ) |
The function will remove duplicate from the deleted rows and columns elements and then sort the vector.
void Models::FMTmatrixbuild::swap | ( | FMTmatrixbuild & | rhs | ) |
Swap for FMTmatrixbuild
void Models::FMTmatrixbuild::synchronize | ( | std::shared_ptr< OsiSolverInterface > | solver | ) |
This function synchronize the cols from colsbuild and the row of rowbuild with the Osisolverinterface matrix (solver)