Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SmiSmpsIO Class Reference

#include <SmiSmpsIO.hpp>

Inheritance diagram for SmiSmpsIO:
Inheritance graph
[legend]
Collaboration diagram for SmiSmpsIO:
Collaboration graph
[legend]

Public Member Functions

SmiCoreDatareadTimeFile (SmiScnModel *smi, const char *c, const char *ext="time")
 
int readStochFile (SmiScnModel *smi, SmiCoreData *core, const char *c, const char *ext="stoch")
 
void setCoreCombineRule (SmiCoreCombineRule *r)
 
SmiCoreCombineRulegetCoreCombineRule ()
 
int getNumStages ()
 
int * getColumnStages ()
 
int * getRowStages ()
 
void setSolverInfinity (double solverInf)
 
double getSolverInfinity () const
 
void writeSmps (const char *filename, bool winFileExtensions=false, bool strictFormat=true)
 
 SmiSmpsIO ()
 
 SmiSmpsIO (SmiCoreData *core, SmiScenarioTree< SmiScnNode * > *smiTree)
 
 ~SmiSmpsIO ()
 
- Public Member Functions inherited from CoinMpsIO
int getNumCols () const
 Get number of columns. More...
 
int getNumRows () const
 Get number of rows. More...
 
CoinBigIndex getNumElements () const
 Get number of nonzero elements. More...
 
const double * getColLower () const
 Get pointer to array[getNumCols()] of column lower bounds. More...
 
const double * getColUpper () const
 Get pointer to array[getNumCols()] of column upper bounds. More...
 
const char * getRowSense () const
 Get pointer to array[getNumRows()] of constraint senses. More...
 
const double * getRightHandSide () const
 Get pointer to array[getNumRows()] of constraint right-hand sides. More...
 
const double * getRowRange () const
 Get pointer to array[getNumRows()] of row ranges. More...
 
const double * getRowLower () const
 Get pointer to array[getNumRows()] of row lower bounds. More...
 
const double * getRowUpper () const
 Get pointer to array[getNumRows()] of row upper bounds. More...
 
const double * getObjCoefficients () const
 Get pointer to array[getNumCols()] of objective function coefficients. More...
 
const CoinPackedMatrixgetMatrixByRow () const
 Get pointer to row-wise copy of the coefficient matrix. More...
 
const CoinPackedMatrixgetMatrixByCol () const
 Get pointer to column-wise copy of the coefficient matrix. More...
 
bool isContinuous (int colNumber) const
 Return true if column is a continuous variable. More...
 
bool isInteger (int columnNumber) const
 Return true if a column is an integer variable. More...
 
int isIntegerOrSemiContinuous (int columnNumber) const
 Return 1 if a column is an integer variable, 2 if semi-continuous. More...
 
const char * integerColumns () const
 Returns array[getNumCols()] specifying if a variable is integer. More...
 
const char * rowName (int index) const
 Returns the row name for the specified index. More...
 
const char * columnName (int index) const
 Returns the column name for the specified index. More...
 
int rowIndex (const char *name) const
 Returns the index for the specified row name. More...
 
int columnIndex (const char *name) const
 Returns the index for the specified column name. More...
 
double objectiveOffset () const
 Returns the (constant) objective offset. More...
 
void setObjectiveOffset (double value)
 Set objective offset. More...
 
const char * getProblemName () const
 Return the problem name. More...
 
const char * getObjectiveName () const
 Return the objective name. More...
 
const char * getRhsName () const
 Return the RHS vector name. More...
 
const char * getRangeName () const
 Return the range vector name. More...
 
const char * getBoundName () const
 Return the bound vector name. More...
 
int numberStringElements () const
 Number of string elements. More...
 
const char * stringElement (int i) const
 String element. More...
 
void setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const double *rowlb, const double *rowub, char const *const *const colnames, char const *const *const rownames)
 Set the problem data. More...
 
void setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const double *rowlb, const double *rowub, const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
 Set the problem data. More...
 
void setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const char *rowsen, const double *rowrhs, const double *rowrng, char const *const *const colnames, char const *const *const rownames)
 Set the problem data. More...
 
void setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const char *rowsen, const double *rowrhs, const double *rowrng, const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
 Set the problem data. More...
 
void copyInIntegerInformation (const char *integerInformation)
 Pass in an array[getNumCols()] specifying if a variable is integer. More...
 
void setProblemName (const char *name)
 Set problem name. More...
 
void setObjectiveName (const char *name)
 Set objective name. More...
 
void setInfinity (double value)
 Set infinity. More...
 
double getInfinity () const
 Get infinity. More...
 
void setDefaultBound (int value)
 Set default upper bound for integer variables. More...
 
int getDefaultBound () const
 Get default upper bound for integer variables. More...
 
int allowStringElements () const
 Whether to allow string elements. More...
 
void setAllowStringElements (int yesNo)
 Whether to allow string elements (0 no, 1 yes, 2 yes and try flip) More...
 
double getSmallElementValue () const
 Small element value - elements less than this set to zero on input default is 1.0e-14. More...
 
void setSmallElementValue (double value)
 Set infinity. More...
 
void setFileName (const char *name)
 Set the current file name for the CoinMpsIO object. More...
 
const char * getFileName () const
 Get the current file name for the CoinMpsIO object. More...
 
int readMps (const char *filename, const char *extension="mps")
 Read a problem in MPS format from the given filename. More...
 
int readMps (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
 Read a problem in MPS format from the given filename. More...
 
int readMps ()
 Read a problem in MPS format from a previously opened file. More...
 
int readMps (int &numberSets, CoinSet **&sets)
 and More...
 
int readBasis (const char *filename, const char *extension, double *solution, unsigned char *rowStatus, unsigned char *columnStatus, const std::vector< std::string > &colnames, int numberColumns, const std::vector< std::string > &rownames, int numberRows)
 Read a basis in MPS format from the given filename. More...
 
int readGms (const char *filename, const char *extension="gms", bool convertObjective=false)
 Read a problem in GAMS format from the given filename. More...
 
int readGms (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
 Read a problem in GAMS format from the given filename. More...
 
int readGms (int &numberSets, CoinSet **&sets)
 Read a problem in GAMS format from a previously opened file. More...
 
int readGMPL (const char *modelName, const char *dataName=NULL, bool keepNames=false)
 Read a problem in GMPL (subset of AMPL) format from the given filenames. More...
 
int writeMps (const char *filename, int compression=0, int formatType=0, int numberAcross=2, CoinPackedMatrix *quadratic=NULL, int numberSOS=0, const CoinSet *setInfo=NULL) const
 Write the problem in MPS format to a file with the given filename. More...
 
const CoinMpsCardReaderreader () const
 Return card reader object so can see what last card was e.g. QUADOBJ. More...
 
int readQuadraticMps (const char *filename, CoinBigIndex *&columnStart, int *&column, double *&elements, int checkSymmetry)
 Read in a quadratic objective from the given filename. More...
 
int readConicMps (const char *filename, int *&columnStart, int *&column, int *&coneType, int &numberCones)
 Read in a list of cones from the given filename. More...
 
void setConvertObjective (bool trueFalse)
 Set whether to move objective from matrix. More...
 
int copyStringElements (const CoinModel *model)
 copies in strings from a CoinModel - returns number More...
 
 CoinMpsIO ()
 Default Constructor. More...
 
 CoinMpsIO (const CoinMpsIO &)
 Copy constructor. More...
 
CoinMpsIOoperator= (const CoinMpsIO &rhs)
 Assignment operator. More...
 
 ~CoinMpsIO ()
 Destructor. More...
 
void passInMessageHandler (CoinMessageHandler *handler)
 Pass in Message handler. More...
 
void newLanguage (CoinMessages::Language language)
 Set the language for messages. More...
 
void setLanguage (CoinMessages::Language language)
 Set the language for messages. More...
 
CoinMessageHandlermessageHandler () const
 Return the message handler. More...
 
CoinMessages messages ()
 Return the messages. More...
 
CoinMessagesmessagesPointer ()
 Return the messages pointer. More...
 
void releaseRedundantInformation ()
 Release all information which can be re-calculated. More...
 
void releaseRowInformation ()
 Release all row information (lower, upper) More...
 
void releaseColumnInformation ()
 Release all column information (lower, upper, objective) More...
 
void releaseIntegerInformation ()
 Release integer information. More...
 
void releaseRowNames ()
 Release row names. More...
 
void releaseColumnNames ()
 Release column names. More...
 
void releaseMatrixInformation ()
 Release matrix information. More...
 

Private Types

typedef std::map< string, int > StringIntMap
 

Private Member Functions

void writeCoreFile (const char *filename, const char *extension, const bool strictFormat)
 This method writes the core file for the current model by invoking writeMPS() from CoinMpsIO. More...
 
void writeTimeFile (const char *filename, const char *extension, const bool strictFormat)
 Writes the time file for the current model, containing the assignments from rows and columns to stages. More...
 
void writeStochFile (const char *filename, const char *extension, const bool strictFormat)
 Writes the stoch file for the current model, containing the stochastic data. More...
 
void writeScenarioToStochFile (std::ostringstream &stream, SmiTreeNode< SmiScnNode * > *node, int scenario, bool strictFormat)
 Writes the stochastic informations for the given scenario into the stream. More...
 
std::string getModProblemName ()
 

Private Attributes

int nstag_
 
int * cstag_
 
int * rstag_
 
double solverInf_
 
bool iftime
 
bool ifstoch
 
SmiSmpsCardReadersmpsCardReader_
 
SmiCoreCombineRulecombineRule_
 
bool combineRuleSet
 
SmiCoreDatacore
 
SmiScenarioTree< SmiScnNode * > * tree
 
StringIntMap periodMap_
 
StringIntMap scenarioMap_
 

Additional Inherited Members

- Protected Member Functions inherited from CoinMpsIO
void setMpsDataWithoutRowAndColNames (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const double *rowlb, const double *rowub)
 Utility method used several times to implement public methods. More...
 
void setMpsDataColAndRowNames (const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
 Utility method used several times to implement public methods. More...
 
void setMpsDataColAndRowNames (char const *const *const colnames, char const *const *const rownames)
 Utility method used several times to implement public methods. More...
 
void gutsOfDestructor ()
 Does the heavy lifting for destruct and assignment. More...
 
void gutsOfCopy (const CoinMpsIO &)
 Does the heavy lifting for copy and assignment. More...
 
void freeAll ()
 Clears problem data from the CoinMpsIO object. More...
 
void convertBoundToSense (const double lower, const double upper, char &sense, double &right, double &range) const
 A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style. More...
 
void convertSenseToBound (const char sense, const double right, const double range, double &lower, double &upper) const
 A quick inlined function to convert from sense/rhs/range stryle constraint definition to lb/ub style. More...
 
int dealWithFileName (const char *filename, const char *extension, CoinFileInput *&input)
 Deal with a filename. More...
 
void addString (int iRow, int iColumn, const char *value)
 Add string to list iRow==numberRows is objective, nr+1 is lo, nr+2 is up iColumn==nc is rhs (can't cope with ranges at present) More...
 
void decodeString (int iString, int &iRow, int &iColumn, const char *&value) const
 Decode string. More...
 
void startHash (char **names, const int number, int section)
 Creates hash list for names (section = 0 for rows, 1 columns) More...
 
void startHash (int section) const
 This one does it when names are already in. More...
 
void stopHash (int section)
 Deletes hash storage. More...
 
int findHash (const char *name, int section) const
 Finds match using hash, -1 not found. More...
 
- Protected Attributes inherited from CoinMpsIO
char * problemName_
 Problem name. More...
 
char * objectiveName_
 Objective row name. More...
 
char * rhsName_
 Right-hand side vector name. More...
 
char * rangeName_
 Range vector name. More...
 
char * boundName_
 Bounds vector name. More...
 
int numberRows_
 Number of rows. More...
 
int numberColumns_
 Number of columns. More...
 
CoinBigIndex numberElements_
 Number of coefficients. More...
 
char * rowsense_
 Pointer to dense vector of row sense indicators. More...
 
double * rhs_
 Pointer to dense vector of row right-hand side values. More...
 
double * rowrange_
 Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range rows) More...
 
CoinPackedMatrixmatrixByRow_
 Pointer to row-wise copy of problem matrix coefficients. More...
 
CoinPackedMatrixmatrixByColumn_
 Pointer to column-wise copy of problem matrix coefficients. More...
 
double * rowlower_
 Pointer to dense vector of row lower bounds. More...
 
double * rowupper_
 Pointer to dense vector of row upper bounds. More...
 
double * collower_
 Pointer to dense vector of column lower bounds. More...
 
double * colupper_
 Pointer to dense vector of column upper bounds. More...
 
double * objective_
 Pointer to dense vector of objective coefficients. More...
 
double objectiveOffset_
 Constant offset for objective value (i.e., RHS value for OBJ row) More...
 
char * integerType_
 Pointer to dense vector specifying if a variable is continuous (0) or integer (1). More...
 
char ** names_ [2]
 Row and column names Linked to hash table sections (0 - row names, 1 column names) More...
 
char * fileName_
 Current file name. More...
 
int numberHash_ [2]
 Number of entries in a hash table section. More...
 
CoinHashLinkhash_ [2]
 Hash tables (two sections, 0 - row names, 1 - column names) More...
 
int defaultBound_
 Upper bound when no bounds for integers. More...
 
double infinity_
 Value to use for infinity. More...
 
double smallElement_
 Small element value. More...
 
CoinMessageHandlerhandler_
 Message handler. More...
 
bool defaultHandler_
 Flag to say if the message handler is the default handler. More...
 
CoinMessages messages_
 Messages. More...
 
CoinMpsCardReadercardReader_
 Card reader. More...
 
bool convertObjective_
 If .gms file should it be massaged to move objective. More...
 
int allowStringElements_
 Whether to allow string elements. More...
 
int maximumStringElements_
 Maximum number of string elements. More...
 
int numberStringElements_
 Number of string elements. More...
 
char ** stringElements_
 String elements. More...
 

Detailed Description

Definition at line 76 of file SmiSmpsIO.hpp.

Member Typedef Documentation

typedef std::map<string,int> SmiSmpsIO::StringIntMap
private

Definition at line 148 of file SmiSmpsIO.hpp.

Constructor & Destructor Documentation

SmiSmpsIO::SmiSmpsIO ( )
inline

Definition at line 94 of file SmiSmpsIO.hpp.

SmiSmpsIO::SmiSmpsIO ( SmiCoreData core,
SmiScenarioTree< SmiScnNode * > *  smiTree 
)
inline

Definition at line 95 of file SmiSmpsIO.hpp.

SmiSmpsIO::~SmiSmpsIO ( )
inline

Definition at line 97 of file SmiSmpsIO.hpp.

Member Function Documentation

SmiCoreData* SmiSmpsIO::readTimeFile ( SmiScnModel smi,
const char *  c,
const char *  ext = "time" 
)
int SmiSmpsIO::readStochFile ( SmiScnModel smi,
SmiCoreData core,
const char *  c,
const char *  ext = "stoch" 
)
void SmiSmpsIO::setCoreCombineRule ( SmiCoreCombineRule r)
inline

Definition at line 83 of file SmiSmpsIO.hpp.

SmiCoreCombineRule* SmiSmpsIO::getCoreCombineRule ( )
inline

Definition at line 84 of file SmiSmpsIO.hpp.

int SmiSmpsIO::getNumStages ( )
inline

Definition at line 85 of file SmiSmpsIO.hpp.

int* SmiSmpsIO::getColumnStages ( )
inline

Definition at line 86 of file SmiSmpsIO.hpp.

int* SmiSmpsIO::getRowStages ( )
inline

Definition at line 87 of file SmiSmpsIO.hpp.

void SmiSmpsIO::setSolverInfinity ( double  solverInf)
inline

Definition at line 89 of file SmiSmpsIO.hpp.

double SmiSmpsIO::getSolverInfinity ( ) const
inline

Definition at line 90 of file SmiSmpsIO.hpp.

void SmiSmpsIO::writeSmps ( const char *  filename,
bool  winFileExtensions = false,
bool  strictFormat = true 
)
void SmiSmpsIO::writeCoreFile ( const char *  filename,
const char *  extension,
const bool  strictFormat 
)
private

This method writes the core file for the current model by invoking writeMPS() from CoinMpsIO.

Parameters
filenameThe filename.
extensionThe file extension.
strictFormatWhether a strict format should be used or not.
void SmiSmpsIO::writeTimeFile ( const char *  filename,
const char *  extension,
const bool  strictFormat 
)
private

Writes the time file for the current model, containing the assignments from rows and columns to stages.

Parameters
filenameThe filename.
extensionThe file extension.
strictFormatWhether a strict format should be used or not.
void SmiSmpsIO::writeStochFile ( const char *  filename,
const char *  extension,
const bool  strictFormat 
)
private

Writes the stoch file for the current model, containing the stochastic data.

Parameters
filenameThe filename.
extensionThe file extension.
strictFormatWhether a strict format should be used or not.
void SmiSmpsIO::writeScenarioToStochFile ( std::ostringstream &  stream,
SmiTreeNode< SmiScnNode * > *  node,
int  scenario,
bool  strictFormat 
)
private

Writes the stochastic informations for the given scenario into the stream.

std::string SmiSmpsIO::getModProblemName ( )
private

Member Data Documentation

int SmiSmpsIO::nstag_
private

Definition at line 135 of file SmiSmpsIO.hpp.

int* SmiSmpsIO::cstag_
private

Definition at line 136 of file SmiSmpsIO.hpp.

int* SmiSmpsIO::rstag_
private

Definition at line 137 of file SmiSmpsIO.hpp.

double SmiSmpsIO::solverInf_
private

Definition at line 138 of file SmiSmpsIO.hpp.

bool SmiSmpsIO::iftime
private

Definition at line 140 of file SmiSmpsIO.hpp.

bool SmiSmpsIO::ifstoch
private

Definition at line 140 of file SmiSmpsIO.hpp.

SmiSmpsCardReader* SmiSmpsIO::smpsCardReader_
private

Definition at line 141 of file SmiSmpsIO.hpp.

SmiCoreCombineRule* SmiSmpsIO::combineRule_
private

Definition at line 142 of file SmiSmpsIO.hpp.

bool SmiSmpsIO::combineRuleSet
private

Definition at line 143 of file SmiSmpsIO.hpp.

SmiCoreData* SmiSmpsIO::core
private

Definition at line 145 of file SmiSmpsIO.hpp.

SmiScenarioTree<SmiScnNode *>* SmiSmpsIO::tree
private

Definition at line 146 of file SmiSmpsIO.hpp.

StringIntMap SmiSmpsIO::periodMap_
private

Definition at line 149 of file SmiSmpsIO.hpp.

StringIntMap SmiSmpsIO::scenarioMap_
private

Definition at line 150 of file SmiSmpsIO.hpp.


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