FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Models::FMTmatrixbuild Class Reference

#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)
 
FMTmatrixbuildoperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FMTmatrixbuild() [1/2]

Models::FMTmatrixbuild::FMTmatrixbuild ( )

Default constructor of FMTmatrixbuild.

◆ FMTmatrixbuild() [2/2]

Models::FMTmatrixbuild::FMTmatrixbuild ( const FMTmatrixbuild rhs)

Copy constructor of FMTmatrixbuild.

◆ ~FMTmatrixbuild()

Models::FMTmatrixbuild::~FMTmatrixbuild ( )

Destructor of FMTmatrixbuild.

Member Function Documentation

◆ addCol()

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.

◆ addRow()

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.

◆ deleteCol()

void Models::FMTmatrixbuild::deleteCol ( const int &  colindex)

The function delete a column (colindex) from the matrix cache.

◆ deleteRow()

void Models::FMTmatrixbuild::deleteRow ( const int &  rowindex)

The function delete a row (rowindex) from the matrix cache.

◆ formatallnames()

void Models::FMTmatrixbuild::formatallnames ( bool  shortformat)

Formats names of row and column in cache.

◆ getcol()

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.

◆ getcolstosynchronize()

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.

◆ getcolumnnames()

std::vector< std::string > & Models::FMTmatrixbuild::getcolumnnames ( )
inline

Return cached column names.

◆ getdeletedconstraints()

const std::vector< int > & Models::FMTmatrixbuild::getdeletedconstraints ( ) const
inline

Returns the newly deleted rows that are in the matrix cache.

◆ getdeletedvariables()

const std::vector< int > & Models::FMTmatrixbuild::getdeletedvariables ( ) const
inline

Returns the newly deleted columns that are in the matrix cache.

◆ getrow()

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.

◆ getrownames()

std::vector< std::string > & Models::FMTmatrixbuild::getrownames ( )
inline

Return cached row names.

◆ getrowstosynchronize()

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.

◆ numbernewCols()

int Models::FMTmatrixbuild::numbernewCols ( ) const
inline

Returns the number of newly added columns that are in the matrix cache.

◆ numbernewRows()

int Models::FMTmatrixbuild::numbernewRows ( ) const
inline

Returns the number of newly added rows that are in the matrix cache.

◆ numberofdeletedCols()

int Models::FMTmatrixbuild::numberofdeletedCols ( ) const
inline

Returns the number of newly deleted columns that are in the matrix cache.

◆ numberofdeletedRows()

int Models::FMTmatrixbuild::numberofdeletedRows ( ) const
inline

Returns the number of newly deleted rows that are in the matrix cache.

◆ operator=()

FMTmatrixbuild & Models::FMTmatrixbuild::operator= ( const FMTmatrixbuild rhs)

Copy assignment of FMTmatrixbuild.

◆ setcolname()

void Models::FMTmatrixbuild::setcolname ( const std::string &  name,
const int &  columnid 
)

set column name.

◆ setrowname()

void Models::FMTmatrixbuild::setrowname ( const std::string &  name,
const int &  rowid 
)

set row name.

◆ sortandcleandeleted()

void Models::FMTmatrixbuild::sortandcleandeleted ( )

The function will remove duplicate from the deleted rows and columns elements and then sort the vector.

◆ swap()

void Models::FMTmatrixbuild::swap ( FMTmatrixbuild rhs)

Swap for FMTmatrixbuild

◆ synchronize()

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)


The documentation for this class was generated from the following file: