10#ifndef FMTmatrixbuild_Hm_included
11#define FMTmatrixbuild_Hm_included
19class OsiSolverInterface;
70 void setColName(
const std::string& name,
const int& columnid);
77 void setRowName(
const std::string& name,
const int& rowid);
117 void addCol(
int numberInColumn,
const int * rows,
const double * elements,
double columnLower = 0.0,
118 double columnUpper = std::numeric_limits<double>::max(),
double objectiveValue = 0.0);
128 void addRow(
int numberInRow,
const int * columns,
const double * elements,
129 double rowLower = -std::numeric_limits<double>::max(),
double rowUpper = std::numeric_limits<double>::max());
167 return static_cast<int>(m_deletedconstraints.size());
176 return static_cast<int>(m_deletedvariables.size());
185 return m_deletedconstraints;
194 return m_deletedvariables;
223 int getRow(
int whichRow,
double &rowLower,
double &rowUpper,
224 std::vector<int>& indices, std::vector<double>&elements)
const;
236 int getCol(
int whichCol,
double &colLower,
double &colUpper,
double &objectiveValue,
237 std::vector<int>& indices, std::vector<double>&elements)
const;
249 std::unique_ptr<CoinBuild>m_colsbuild;
252 std::unique_ptr<CoinBuild>m_rowsbuild;
255 std::vector<int>m_deletedconstraints;
258 std::vector<int>m_deletedvariables;
261 std::vector<std::string>m_columnnames;
264 std::vector<std::string>m_rownames;
270 void _sortElementsAndClean(std::vector<int>& elements)
const;
278 std::string _formatForMatrixName(std::string name,
bool shortformat)
const;
#define FMTEXPORT
Definition: FMTutility.h:125
Helper caching rows and columns to add to a solver matrix in batch for efficiency.
Definition: FMTMatrixBuild.h:32
void synchronize(std::shared_ptr< OsiSolverInterface > solver)
Synchronize the cached columns and rows with the solver matrix.
void formatAllNames(bool shortformat)
Format the cached row and column names.
FMTMatrixBuild(const FMTMatrixBuild &rhs)
Copy constructor for FMTMatrixBuild.
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.
void deleteCol(const int &colindex)
Delete a column from the matrix cache.
void swap(FMTMatrixBuild &rhs)
Swap this FMTMatrixBuild with another.
int numberOfDeletedRows() const
Return the number of newly deleted rows in the matrix cache.
Definition: FMTMatrixBuild.h:165
~FMTMatrixBuild()
Destructor for FMTMatrixBuild.
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 numberNewCols() const
Return the number of newly added columns in the matrix cache.
Definition: FMTMatrixBuild.h:156
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 sortAndCleanDeleted()
Remove duplicates from the deleted rows and columns and sort them.
int numberNewRows() const
Return the number of newly added rows in the matrix cache.
Definition: FMTMatrixBuild.h:147
void deleteRow(const int &rowindex)
Delete a row from the matrix cache.
const std::vector< int > & getDeletedConstraints() const
Return the newly deleted rows in the matrix cache.
Definition: FMTMatrixBuild.h:183
FMTMatrixBuild()
Default constructor for FMTMatrixBuild.
std::vector< std::string > & getRowNames()
Return the cached row names.
Definition: FMTMatrixBuild.h:54
std::string getRowsToSynchronize() const
Return a string of all the rows in the matrix cache, mainly for debugging.
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.
const std::vector< int > & getDeletedVariables() const
Return the newly deleted columns in the matrix cache.
Definition: FMTMatrixBuild.h:192
std::vector< std::string > & getColumnNames()
Return the cached column names.
Definition: FMTMatrixBuild.h:45
int numberOfDeletedCols() const
Return the number of newly deleted columns in the matrix cache.
Definition: FMTMatrixBuild.h:174
void setRowName(const std::string &name, const int &rowid)
Set a row name.
void setColName(const std::string &name, const int &columnid)
Set a column name.
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTAreaParser.h:54