Cgl  0.59.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinMpsIO.hpp
Go to the documentation of this file.
1 /* $Id: CoinMpsIO.hpp 1993 2018-01-02 11:30:06Z forrest $ */
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CoinMpsIO_H
7 #define CoinMpsIO_H
8 
9 #if defined(_MSC_VER)
10 // Turn off compiler warning about long names
11 # pragma warning(disable:4786)
12 #endif
13 
14 #include <vector>
15 #include <string>
16 
17 #include "CoinUtilsConfig.h"
18 #include "CoinPackedMatrix.hpp"
19 #include "CoinMessageHandler.hpp"
20 #include "CoinFileIO.hpp"
21 class CoinModel;
22 
27 typedef int COINColumnIndex;
28 
30 typedef int COINRowIndex;
31 
32 // We are allowing free format - but there is a limit!
33 // User can override by using CXXFLAGS += -DCOIN_MAX_FIELD_LENGTH=nnn
34 #ifndef COIN_MAX_FIELD_LENGTH
35 #define COIN_MAX_FIELD_LENGTH 160
36 #endif
37 #define MAX_CARD_LENGTH 5*COIN_MAX_FIELD_LENGTH+80
38 
45 };
46 
56 };
57 class CoinMpsIO;
60 
61 public:
62 
65  CoinMpsCardReader ( CoinFileInput *input, CoinMpsIO * reader );
68 
72 
73 
93  int nextGmsField ( int expectedType );
95  inline COINSectionType whichSection ( ) const {
96  return section_;
97  }
99  inline void setWhichSection(COINSectionType section ) {
100  section_=section;
101  }
103  inline bool freeFormat() const
104  { return freeFormat_;}
106  inline void setFreeFormat(bool yesNo)
107  { freeFormat_=yesNo;}
110  inline COINMpsType mpsType ( ) const {
111  return mpsType_;
112  }
114  int cleanCard();
116  inline const char *rowName ( ) const {
117  return rowName_;
118  }
120  inline const char *columnName ( ) const {
121  return columnName_;
122  }
124  inline double value ( ) const {
125  return value_;
126  }
128  inline const char *valueString ( ) const {
129  return valueString_;
130  }
132  inline const char *card ( ) const {
133  return card_;
134  }
136  inline char *mutableCard ( ) {
137  return card_;
138  }
140  inline void setPosition(char * position)
141  { position_=position;}
143  inline char * getPosition() const
144  { return position_;}
146  inline CoinBigIndex cardNumber ( ) const {
147  return cardNumber_;
148  }
150  inline CoinFileInput * fileInput ( ) const {
151  return input_;
152  }
154  inline void setStringsAllowed()
155  { stringsAllowed_=true;}
157 
159 protected:
160 
163  double value_;
168  char *position_;
170  char *eol_;
200 public:
203  double osi_strtod(char * ptr, char ** output, int type);
206  static void strcpyAndCompress ( char *to, const char *from );
208  static char * nextBlankOr ( char *image );
210  double osi_strtod(char * ptr, char ** output);
212 
213 };
214 
215 //#############################################################################
216 #ifdef USE_SBB
217 class SbbObject;
218 class SbbModel;
219 #endif
220 class CoinSet {
222 
223 public:
224 
227  CoinSet ( );
230  CoinSet ( int numberEntries, const int * which);
231 
233  CoinSet (const CoinSet &);
234 
236  CoinSet & operator=(const CoinSet& rhs);
237 
239  virtual ~CoinSet ( );
241 
242 
245  inline int numberEntries ( ) const
247  { return numberEntries_; }
249  inline void setNumberEntries (int number)
250  { numberEntries_ = number; }
252  inline int setType ( ) const
253  { return setType_; }
255  inline const int * which ( ) const
256  { return which_; }
258  inline const double * weights ( ) const
259  { return weights_; }
261  inline int * modifiableWhich ( ) const
262  { return which_; }
264  inline double * modifiableWeights ( ) const
265  { return weights_; }
267 
268 #ifdef USE_SBB
269 
271  virtual SbbObject * sbbObject(SbbModel * model) const
273  { return NULL;}
275 #endif
276 
278 protected:
279 
282  int numberEntries_;
285  int setType_;
287  int * which_;
289  double * weights_;
291 };
292 
293 //#############################################################################
295 class CoinSosSet : public CoinSet{
296 
297 public:
298 
301  CoinSosSet ( int numberEntries, const int * which, const double * weights, int type);
303 
305  virtual ~CoinSosSet ( );
307 
308 
309 #ifdef USE_SBB
310 
312  virtual SbbObject * sbbObject(SbbModel * model) const ;
315 #endif
316 
318 protected:
319 
322 
323 };
324 
325 //#############################################################################
326 
338 class CoinMpsIO {
339  friend void CoinMpsIOUnitTest(const std::string & mpsDir);
340 
341 public:
342 
354  int getNumCols() const;
356 
358  int getNumRows() const;
359 
361  int getNumElements() const;
362 
364  const double * getColLower() const;
365 
367  const double * getColUpper() const;
368 
378  const char * getRowSense() const;
379 
391  const double * getRightHandSide() const;
392 
406  const double * getRowRange() const;
407 
409  const double * getRowLower() const;
410 
412  const double * getRowUpper() const;
413 
415  const double * getObjCoefficients() const;
416 
418  const CoinPackedMatrix * getMatrixByRow() const;
419 
421  const CoinPackedMatrix * getMatrixByCol() const;
422 
424  bool isContinuous(int colNumber) const;
425 
431  bool isInteger(int columnNumber) const;
432 
438  const char * integerColumns() const;
439 
444  const char * rowName(int index) const;
445 
450  const char * columnName(int index) const;
451 
458  int rowIndex(const char * name) const;
459 
464  int columnIndex(const char * name) const;
465 
470  double objectiveOffset() const;
472  inline void setObjectiveOffset(double value)
473  { objectiveOffset_=value;}
474 
476  const char * getProblemName() const;
477 
479  const char * getObjectiveName() const;
480 
482  const char * getRhsName() const;
483 
485  const char * getRangeName() const;
486 
488  const char * getBoundName() const;
490  inline int numberStringElements() const
491  { return numberStringElements_;}
493  inline const char * stringElement(int i) const
494  { return stringElements_[i];}
496 
497 
503 
505  void setMpsData(const CoinPackedMatrix& m, const double infinity,
506  const double* collb, const double* colub,
507  const double* obj, const char* integrality,
508  const double* rowlb, const double* rowub,
509  char const * const * const colnames,
510  char const * const * const rownames);
511  void setMpsData(const CoinPackedMatrix& m, const double infinity,
512  const double* collb, const double* colub,
513  const double* obj, const char* integrality,
514  const double* rowlb, const double* rowub,
515  const std::vector<std::string> & colnames,
516  const std::vector<std::string> & rownames);
517  void setMpsData(const CoinPackedMatrix& m, const double infinity,
518  const double* collb, const double* colub,
519  const double* obj, const char* integrality,
520  const char* rowsen, const double* rowrhs,
521  const double* rowrng,
522  char const * const * const colnames,
523  char const * const * const rownames);
524  void setMpsData(const CoinPackedMatrix& m, const double infinity,
525  const double* collb, const double* colub,
526  const double* obj, const char* integrality,
527  const char* rowsen, const double* rowrhs,
528  const double* rowrng,
529  const std::vector<std::string> & colnames,
530  const std::vector<std::string> & rownames);
531 
537  void copyInIntegerInformation(const char * integerInformation);
538 
540  void setProblemName(const char *name) ;
541 
543  void setObjectiveName(const char *name) ;
544 
546 
553  void setInfinity(double value);
555 
557  double getInfinity() const;
558 
560  void setDefaultBound(int value);
561 
563  int getDefaultBound() const;
565  inline int allowStringElements() const
566  { return allowStringElements_;}
568  inline void setAllowStringElements(int yesNo)
569  { allowStringElements_ = yesNo;}
572  inline double getSmallElementValue() const
573  { return smallElement_;}
574  inline void setSmallElementValue(double value)
575  { smallElement_=value;}
577 
578 
597  void setFileName(const char * name);
599 
601  const char * getFileName() const;
602 
607  int readMps(const char *filename, const char *extension = "mps");
608 
614  int readMps(const char *filename, const char *extension ,
615  int & numberSets, CoinSet **& sets);
616 
627  int readMps();
629  int readMps(int & numberSets, CoinSet **& sets);
639  int readBasis(const char *filename, const char *extension ,
640  double * solution, unsigned char *rowStatus, unsigned char *columnStatus,
641  const std::vector<std::string> & colnames,int numberColumns,
642  const std::vector<std::string> & rownames, int numberRows);
643 
649  int readGms(const char *filename, const char *extension = "gms",bool convertObjective=false);
650 
656  int readGms(const char *filename, const char *extension ,
657  int & numberSets, CoinSet **& sets);
658 
665  // Not for now int readGms();
667  int readGms(int & numberSets, CoinSet **& sets);
670  int readGMPL(const char *modelName, const char * dataName=NULL, bool keepNames=false);
671 
697  int writeMps(const char *filename, int compression = 0,
698  int formatType = 0, int numberAcross = 2,
699  CoinPackedMatrix * quadratic = NULL,
700  int numberSOS=0,const CoinSet * setInfo=NULL) const;
701 
703  inline const CoinMpsCardReader * reader() const
704  { return cardReader_;}
705 
733  int readQuadraticMps(const char * filename,
734  int * &columnStart, int * &column, double * &elements,
735  int checkSymmetry);
736 
756  int readConicMps(const char * filename,
757  int * &columnStart, int * &column, int * &coneType, int & numberCones);
759  inline void setConvertObjective(bool trueFalse)
760  { convertObjective_=trueFalse;}
762  int copyStringElements(const CoinModel * model);
764 
767  CoinMpsIO();
769 
771  CoinMpsIO (const CoinMpsIO &);
772 
774  CoinMpsIO & operator=(const CoinMpsIO& rhs);
775 
777  ~CoinMpsIO ();
779 
780 
789 
791  void newLanguage(CoinMessages::Language language);
792 
794  inline void setLanguage(CoinMessages::Language language) {newLanguage(language);}
795 
797  inline CoinMessageHandler * messageHandler() const {return handler_;}
798 
800  inline CoinMessages messages() {return messages_;}
802  inline CoinMessages * messagesPointer() {return & messages_;}
804 
805 
817 
819  void releaseRowInformation();
820 
823 
826 
828  void releaseRowNames();
829 
831  void releaseColumnNames();
832 
836 
837 protected:
838 
841 
843  void
845  const CoinPackedMatrix& m, const double infinity,
846  const double* collb, const double* colub,
847  const double* obj, const char* integrality,
848  const double* rowlb, const double* rowub);
849  void
851  const std::vector<std::string> & colnames,
852  const std::vector<std::string> & rownames);
853  void
855  char const * const * const colnames,
856  char const * const * const rownames);
857 
858 
860  void gutsOfDestructor();
861 
863  void gutsOfCopy(const CoinMpsIO &);
864 
866  void freeAll();
867 
868 
871  inline void
872  convertBoundToSense(const double lower, const double upper,
873  char& sense, double& right, double& range) const;
876  inline void
877  convertSenseToBound(const char sense, const double right,
878  const double range,
879  double& lower, double& upper) const;
880 
893  int dealWithFileName(const char * filename, const char * extension,
894  CoinFileInput * &input);
899  void addString(int iRow,int iColumn, const char * value);
901  void decodeString(int iString, int & iRow, int & iColumn, const char * & value) const;
903 
904 
905  // for hashing
906  typedef struct {
907  int index, next;
908  } CoinHashLink;
909 
912  void startHash ( char **names, const int number , int section );
915  void startHash ( int section ) const;
917  void stopHash ( int section );
919  int findHash ( const char *name , int section ) const;
921 
924  char * problemName_;
926 
929 
931  char * rhsName_;
932 
934  char * rangeName_;
935 
937  char * boundName_;
938 
941 
944 
947 
949  mutable char *rowsense_;
950 
952  mutable double *rhs_;
953 
957  mutable double *rowrange_;
958 
961 
964 
966  double * rowlower_;
967 
969  double * rowupper_;
970 
972  double * collower_;
973 
975  double * colupper_;
976 
978  double * objective_;
979 
982 
983 
987  char * integerType_;
988 
992  char **names_[2];
994 
997  char * fileName_;
999 
1001  int numberHash_[2];
1002 
1004  mutable CoinHashLink *hash_[2];
1006 
1009  int defaultBound_;
1011 
1013  double infinity_;
1016 
1040 
1041 };
1042 
1043 //#############################################################################
1051 void
1052 CoinMpsIOUnitTest(const std::string & mpsDir);
1053 // Function to return number in most efficient way
1054 // section is 0 for columns, 1 for rhs,ranges and 2 for bounds
1055 /* formatType is
1056  0 - normal and 8 character names
1057  1 - extra accuracy
1058  2 - IEEE hex - INTEL
1059  3 - IEEE hex - not INTEL
1060 */
1061 void
1062 CoinConvertDouble(int section, int formatType, double value, char outputValue[24]);
1063 
1064 #endif
1065 
const char * getFileName() const
Get the current file name for the CoinMpsIO object.
int * modifiableWhich() const
Returns modifiable list of variables.
Definition: CoinMpsIO.hpp:261
int ieeeFormat_
Whether IEEE - 0 no, 1 INTEL, 2 not INTEL.
Definition: CoinMpsIO.hpp:186
int numberStringElements_
Number of string elements.
Definition: CoinMpsIO.hpp:1036
static void strcpyAndCompress(char *to, const char *from)
remove blanks
double infinity_
Value to use for infinity.
Definition: CoinMpsIO.hpp:1013
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of constraint right-hand sides.
void setWhichSection(COINSectionType section)
Sets current section type.
Definition: CoinMpsIO.hpp:99
const char * rowName() const
Returns row name of current field.
Definition: CoinMpsIO.hpp:116
int getDefaultBound() const
Get default upper bound for integer variables.
double * modifiableWeights() const
Returns modifiable weights.
Definition: CoinMpsIO.hpp:264
CoinSet & operator=(const CoinSet &rhs)
Assignment operator.
COINMpsType
Definition: CoinMpsIO.hpp:47
void setInfinity(double value)
Set infinity.
CoinMessages * messagesPointer()
Return the messages pointer.
Definition: CoinMpsIO.hpp:802
int readConicMps(const char *filename, int *&columnStart, int *&column, int *&coneType, int &numberCones)
Read in a list of cones from the given filename.
void releaseIntegerInformation()
Release integer information.
double getSmallElementValue() const
Small element value - elements less than this set to zero on input default is 1.0e-14.
Definition: CoinMpsIO.hpp:572
void releaseColumnInformation()
Release all column information (lower, upper, objective)
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:192
~CoinMpsIO()
Destructor.
CoinBigIndex cardNumber() const
Returns card number.
Definition: CoinMpsIO.hpp:146
void gutsOfDestructor()
Does the heavy lifting for destruct and assignment.
void setPosition(char *position)
set position (again so gms reader will work)
Definition: CoinMpsIO.hpp:140
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
Definition: CoinMpsIO.hpp:987
const char * getRangeName() const
Return the range vector name.
void gutsOfCopy(const CoinMpsIO &)
Does the heavy lifting for copy and assignment.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
int getNumCols() const
Get number of columns.
int readGms(const char *filename, const char *extension="gms", bool convertObjective=false)
Read a problem in GAMS format from the given filename.
void CoinConvertDouble(int section, int formatType, double value, char outputValue[24])
void setNumberEntries(int number)
Sets number of entries.
Definition: CoinMpsIO.hpp:249
void setSmallElementValue(double value)
Definition: CoinMpsIO.hpp:574
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: CoinMpsIO.hpp:949
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.
int numberEntries() const
Returns number of entries.
Definition: CoinMpsIO.hpp:246
char valueString_[COIN_MAX_FIELD_LENGTH]
Current element as characters (only if strings allowed)
Definition: CoinMpsIO.hpp:196
int readMps()
Read a problem in MPS format from a previously opened file.
bool defaultHandler_
Flag to say if the message handler is the default handler.
Definition: CoinMpsIO.hpp:1024
CoinSet()
Default constructor.
int allowStringElements_
Whether to allow string elements.
Definition: CoinMpsIO.hpp:1032
CoinFileInput * input_
File input.
Definition: CoinMpsIO.hpp:178
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
Definition: CoinModel.hpp:161
void setConvertObjective(bool trueFalse)
Set whether to move objective from matrix.
Definition: CoinMpsIO.hpp:759
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
int readQuadraticMps(const char *filename, int *&columnStart, int *&column, double *&elements, int checkSymmetry)
Read in a quadratic objective from the given filename.
void releaseMatrixInformation()
Release matrix information.
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...
CoinMpsCardReader(CoinFileInput *input, CoinMpsIO *reader)
Constructor expects file to be open This one takes gzFile if fp null.
void setMpsDataColAndRowNames(const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
COINSectionType
Definition: CoinMpsIO.hpp:39
bool freeFormat_
Whether free format. Just for blank RHS etc.
Definition: CoinMpsIO.hpp:184
char * fileName_
Current file name.
Definition: CoinMpsIO.hpp:998
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:963
Base class for message handling.
virtual ~CoinSet()
Destructor.
const double * weights() const
Returns weights.
Definition: CoinMpsIO.hpp:258
int numberHash_[2]
Number of entries in a hash table section.
Definition: CoinMpsIO.hpp:1001
void copyInIntegerInformation(const char *integerInformation)
Pass in an array[getNumCols()] specifying if a variable is integer.
CoinMpsIO()
Default Constructor.
COINSectionType section_
Which section we think we are in.
Definition: CoinMpsIO.hpp:180
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
#define MAX_CARD_LENGTH
Definition: CoinMpsIO.hpp:37
CoinSosSet(int numberEntries, const int *which, const double *weights, int type)
Constructor.
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.
CoinMessageHandler * messageHandler() const
Return the message handler.
Definition: CoinMpsIO.hpp:797
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: CoinMpsIO.hpp:966
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
void setFreeFormat(bool yesNo)
Sets whether free format. Mainly for blank RHS etc.
Definition: CoinMpsIO.hpp:106
CoinMpsIO * reader_
MpsIO.
Definition: CoinMpsIO.hpp:190
void releaseRedundantInformation()
Release all information which can be re-calculated.
char ** names_[2]
Row and column names Linked to hash table sections (0 - row names, 1 column names) ...
Definition: CoinMpsIO.hpp:992
double * objective_
Pointer to dense vector of objective coefficients.
Definition: CoinMpsIO.hpp:978
int copyStringElements(const CoinModel *model)
copies in strings from a CoinModel - returns number
CoinMpsCardReader * cardReader_
Card reader.
Definition: CoinMpsIO.hpp:1028
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: CoinMpsIO.hpp:952
bool stringsAllowed_
Whether strings allowed.
Definition: CoinMpsIO.hpp:198
This is a first attempt at a message handler.
double * colupper_
Pointer to dense vector of column upper bounds.
Definition: CoinMpsIO.hpp:975
double osi_strtod(char *ptr, char **output, int type)
type - 0 normal, 1 INTEL IEEE, 2 other IEEE
int defaultBound_
Upper bound when no bounds for integers.
Definition: CoinMpsIO.hpp:1010
Very simple class for containing SOS set.
Definition: CoinMpsIO.hpp:295
void newLanguage(CoinMessages::Language language)
Set the language for messages.
CoinBigIndex numberElements_
Number of coefficients.
Definition: CoinMpsIO.hpp:946
const char * rowName(int index) const
Returns the row name for the specified index.
friend void CoinMpsIOUnitTest(const std::string &mpsDir)
A function that tests the methods in the CoinMpsIO class.
int numberEntries_
Number of entries.
Definition: CoinMpsIO.hpp:283
virtual ~CoinSosSet()
Destructor.
const char * getRowSense() const
Get pointer to array[getNumRows()] of constraint senses.
const int * which() const
Returns list of variables.
Definition: CoinMpsIO.hpp:255
char * objectiveName_
Objective row name.
Definition: CoinMpsIO.hpp:928
COINMpsType mpsType_
Current COINMpsType.
Definition: CoinMpsIO.hpp:172
#define COIN_MAX_FIELD_LENGTH
Definition: CoinMpsIO.hpp:35
int * which_
Which variables are in set.
Definition: CoinMpsIO.hpp:287
MPS IO Interface.
Definition: CoinMpsIO.hpp:338
CoinHashLink * hash_[2]
Hash tables (two sections, 0 - row names, 1 - column names)
Definition: CoinMpsIO.hpp:1004
bool convertObjective_
If .gms file should it be massaged to move objective.
Definition: CoinMpsIO.hpp:1030
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:252
int numberStringElements() const
Number of string elements.
Definition: CoinMpsIO.hpp:490
const char * getObjectiveName() const
Return the objective name.
int maximumStringElements_
Maximum number of string elements.
Definition: CoinMpsIO.hpp:1034
const CoinMpsCardReader * reader() const
Return card reader object so can see what last card was e.g. QUADOBJ.
Definition: CoinMpsIO.hpp:703
void setLanguage(CoinMessages::Language language)
Set the language for messages.
Definition: CoinMpsIO.hpp:794
char * eol_
End of card.
Definition: CoinMpsIO.hpp:170
int dealWithFileName(const char *filename, const char *extension, CoinFileInput *&input)
Deal with a filename.
void CoinMpsIOUnitTest(const std::string &mpsDir)
A function that tests the methods in the CoinMpsIO class.
double value() const
Returns value in current field.
Definition: CoinMpsIO.hpp:124
void freeAll()
Clears problem data from the CoinMpsIO object.
char * position_
Current position within card image.
Definition: CoinMpsIO.hpp:168
int columnIndex(const char *name) const
Returns the index for the specified column name.
int cleanCard()
Reads and cleans card - taking out trailing blanks - return 1 if EOF.
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:1026
const char * getBoundName() const
Return the bound vector name.
char * getPosition() const
get position (again so gms reader will work)
Definition: CoinMpsIO.hpp:143
bool eightChar_
If all names &lt;= 8 characters then allow embedded blanks.
Definition: CoinMpsIO.hpp:188
bool isContinuous(int colNumber) const
Return true if column is a continuous variable.
bool freeFormat() const
Sees if free format.
Definition: CoinMpsIO.hpp:103
double objectiveOffset_
Constant offset for objective value (i.e., RHS value for OBJ row)
Definition: CoinMpsIO.hpp:981
int setType_
type of set
Definition: CoinMpsIO.hpp:285
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.
double * collower_
Pointer to dense vector of column lower bounds.
Definition: CoinMpsIO.hpp:972
Sparse Matrix Base Class.
Very simple code for reading MPS data.
Definition: CoinMpsIO.hpp:59
double * rowrange_
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range...
Definition: CoinMpsIO.hpp:957
CoinFileInput * fileInput() const
Returns file input.
Definition: CoinMpsIO.hpp:150
char * rhsName_
Right-hand side vector name.
Definition: CoinMpsIO.hpp:931
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&#39;t co...
int COINColumnIndex
Definition: CoinLpIO.hpp:26
int nextGmsField(int expectedType)
Gets next field for .gms file and returns type.
COINMpsType mpsType() const
Only for first field on card otherwise BLANK_COLUMN e.g.
Definition: CoinMpsIO.hpp:110
void setAllowStringElements(int yesNo)
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
Definition: CoinMpsIO.hpp:568
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:960
int COINRowIndex
Large enough to contain row index (or basis)
Definition: CoinMpsIO.hpp:30
const char * columnName(int index) const
Returns the column name for the specified index.
Language
Supported languages.
double * weights_
Weights.
Definition: CoinMpsIO.hpp:289
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
const char * card() const
Whole card (for printing)
Definition: CoinMpsIO.hpp:132
const char * valueString() const
Returns value as string in current field.
Definition: CoinMpsIO.hpp:128
int CoinBigIndex
Abstract base class for file input classes.
Definition: CoinFileIO.hpp:37
COINSectionType readToNextSection()
Read to next section.
char * mutableCard()
Whole card - so we look at it (not const so nextBlankOr will work for gms reader) ...
Definition: CoinMpsIO.hpp:136
char card_[MAX_CARD_LENGTH]
Current card image.
Definition: CoinMpsIO.hpp:166
void stopHash(int section)
Deletes hash storage.
double smallElement_
Small element value.
Definition: CoinMpsIO.hpp:1015
bool isInteger(int columnNumber) const
Return true if a column is an integer variable.
const char * getRhsName() const
Return the RHS vector name.
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: CoinMpsIO.hpp:969
char * rangeName_
Range vector name.
Definition: CoinMpsIO.hpp:934
char rowName_[COIN_MAX_FIELD_LENGTH]
Current row name.
Definition: CoinMpsIO.hpp:174
void releaseRowInformation()
Release all row information (lower, upper)
const char * getProblemName() const
Return the problem name.
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:1018
int numberColumns_
Number of columns.
Definition: CoinMpsIO.hpp:943
void setFileName(const char *name)
Set the current file name for the CoinMpsIO object.
int findHash(const char *name, int section) const
Finds match using hash, -1 not found.
int getNumElements() const
Get number of nonzero elements.
COINSectionType nextField()
Gets next field and returns section type e.g. COIN_COLUMN_SECTION.
int allowStringElements() const
Whether to allow string elements.
Definition: CoinMpsIO.hpp:565
void setObjectiveOffset(double value)
Set objective offset.
Definition: CoinMpsIO.hpp:472
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of the coefficient matrix.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler.
double value_
Current value.
Definition: CoinMpsIO.hpp:164
double getInfinity() const
Get infinity.
void startHash(char **names, const int number, int section)
Creates hash list for names (section = 0 for rows, 1 columns)
static char * nextBlankOr(char *image)
int getNumRows() const
Get number of rows.
void setStringsAllowed()
Sets whether strings allowed.
Definition: CoinMpsIO.hpp:154
const char * columnName() const
Returns column name of current field.
Definition: CoinMpsIO.hpp:120
CoinMessages messages()
Return the messages.
Definition: CoinMpsIO.hpp:800
char * boundName_
Bounds vector name.
Definition: CoinMpsIO.hpp:937
void releaseColumnNames()
Release column names.
char columnName_[COIN_MAX_FIELD_LENGTH]
Current column name.
Definition: CoinMpsIO.hpp:176
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:194
int numberRows_
Number of rows.
Definition: CoinMpsIO.hpp:940
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
const char * stringElement(int i) const
String element.
Definition: CoinMpsIO.hpp:493
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.
COINSectionType whichSection() const
Returns current section type.
Definition: CoinMpsIO.hpp:95
const char * integerColumns() const
Returns array[getNumCols()] specifying if a variable is integer.
void releaseRowNames()
Release row names.
CoinBigIndex cardNumber_
Card number.
Definition: CoinMpsIO.hpp:182
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...
~CoinMpsCardReader()
Destructor.
int rowIndex(const char *name) const
Returns the index for the specified row name.
char * problemName_
Problem name.
Definition: CoinMpsIO.hpp:925
Class to hold and manipulate an array of massaged messages.
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.
void setObjectiveName(const char *name)
Set objective name.
void setDefaultBound(int value)
Set default upper bound for integer variables.
Very simple class for containing data on set.
Definition: CoinMpsIO.hpp:221
char ** stringElements_
String elements.
Definition: CoinMpsIO.hpp:1038
void setProblemName(const char *name)
Set problem name.
double objectiveOffset() const
Returns the (constant) objective offset.
void decodeString(int iString, int &iRow, int &iColumn, const char *&value) const
Decode string.
CoinMpsIO & operator=(const CoinMpsIO &rhs)
Assignment operator.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.