Cbc  2.10.5
 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 2083 2019-01-06 19:38:09Z unxusr $ */
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 
54 };
55 
87 };
88 class CoinMpsIO;
91 
92 public:
95  CoinMpsCardReader(CoinFileInput *input, CoinMpsIO *reader);
98 
102 
122  int nextGmsField(int expectedType);
125  {
126  return section_;
127  }
129  inline void setWhichSection(COINSectionType section)
130  {
131  section_ = section;
132  }
134  inline bool freeFormat() const
135  {
136  return freeFormat_;
137  }
139  inline void setFreeFormat(bool yesNo)
140  {
141  freeFormat_ = yesNo;
142  }
145  inline COINMpsType mpsType() const
146  {
147  return mpsType_;
148  }
150  int cleanCard();
152  inline const char *rowName() const
153  {
154  return rowName_;
155  }
157  inline const char *columnName() const
158  {
159  return columnName_;
160  }
162  inline double value() const
163  {
164  return value_;
165  }
167  inline const char *valueString() const
168  {
169  return valueString_;
170  }
172  inline const char *card() const
173  {
174  return card_;
175  }
177  inline char *mutableCard()
178  {
179  return card_;
180  }
182  inline void setPosition(char *position)
183  {
184  position_ = position;
185  }
187  inline char *getPosition() const
188  {
189  return position_;
190  }
192  inline CoinBigIndex cardNumber() const
193  {
194  return cardNumber_;
195  }
197  inline CoinFileInput *fileInput() const
198  {
199  return input_;
200  }
202  inline void setStringsAllowed()
203  {
204  stringsAllowed_ = true;
205  }
207 
209 protected:
212  double value_;
217  char *position_;
219  char *eol_;
249 public:
252  double osi_strtod(char *ptr, char **output, int type);
255  static void strcpyAndCompress(char *to, const char *from);
257  static char *nextBlankOr(char *image);
259  double osi_strtod(char *ptr, char **output);
261 };
262 
263 //#############################################################################
264 #ifdef USE_SBB
265 class SbbObject;
266 class SbbModel;
267 #endif
268 class CoinSet {
270 
271 public:
274  CoinSet();
277  CoinSet(int numberEntries, const int *which);
278 
280  CoinSet(const CoinSet &);
281 
283  CoinSet &operator=(const CoinSet &rhs);
284 
286  virtual ~CoinSet();
288 
291  inline int numberEntries() const
293  {
294  return numberEntries_;
295  }
297  inline void setNumberEntries(int number)
298  {
299  numberEntries_ = number;
300  }
302  inline int setType() const
303  {
304  return setType_;
305  }
307  inline void setSetType(int type)
308  {
309  setType_ = type;
310  }
312  inline const int *which() const
313  {
314  return which_;
315  }
317  inline const double *weights() const
318  {
319  return weights_;
320  }
322  inline int *modifiableWhich() const
323  {
324  return which_;
325  }
327  inline double *modifiableWeights() const
328  {
329  return weights_;
330  }
332 
333 #ifdef USE_SBB
334 
336  virtual SbbObject *sbbObject(SbbModel *model) const
338  {
339  return NULL;
340  }
342 #endif
343 
345 protected:
348  int numberEntries_;
351  int setType_;
353  int *which_;
355  double *weights_;
357 };
358 
359 //#############################################################################
361 class CoinSosSet : public CoinSet {
362 
363 public:
366  CoinSosSet(int numberEntries, const int *which, const double *weights, int type);
368 
370  virtual ~CoinSosSet();
372 
373 #ifdef USE_SBB
374 
376  virtual SbbObject *sbbObject(SbbModel *model) const;
379 #endif
380 
382 protected:
385 
386 };
387 
388 //#############################################################################
389 
401 class CoinMpsIO {
402  friend void CoinMpsIOUnitTest(const std::string &mpsDir);
403 
404 public:
416  int getNumCols() const;
418 
420  int getNumRows() const;
421 
424 
426  const double *getColLower() const;
427 
429  const double *getColUpper() const;
430 
440  const char *getRowSense() const;
441 
453  const double *getRightHandSide() const;
454 
468  const double *getRowRange() const;
469 
471  const double *getRowLower() const;
472 
474  const double *getRowUpper() const;
475 
477  const double *getObjCoefficients() const;
478 
480  const CoinPackedMatrix *getMatrixByRow() const;
481 
483  const CoinPackedMatrix *getMatrixByCol() const;
484 
486  bool isContinuous(int colNumber) const;
487 
493  bool isInteger(int columnNumber) const;
494 
500  int isIntegerOrSemiContinuous(int columnNumber) const;
501 
507  const char *integerColumns() const;
508 
513  const char *rowName(int index) const;
514 
519  const char *columnName(int index) const;
520 
527  int rowIndex(const char *name) const;
528 
533  int columnIndex(const char *name) const;
534 
539  double objectiveOffset() const;
541  inline void setObjectiveOffset(double value)
542  {
543  objectiveOffset_ = value;
544  }
545 
547  const char *getProblemName() const;
548 
550  const char *getObjectiveName() const;
551 
553  const char *getRhsName() const;
554 
556  const char *getRangeName() const;
557 
559  const char *getBoundName() const;
561  inline int numberStringElements() const
562  {
563  return numberStringElements_;
564  }
566  inline const char *stringElement(int i) const
567  {
568  return stringElements_[i];
569  }
571 
577 
579  void setMpsData(const CoinPackedMatrix &m, const double infinity,
580  const double *collb, const double *colub,
581  const double *obj, const char *integrality,
582  const double *rowlb, const double *rowub,
583  char const *const *const colnames,
584  char const *const *const rownames);
585  void setMpsData(const CoinPackedMatrix &m, const double infinity,
586  const double *collb, const double *colub,
587  const double *obj, const char *integrality,
588  const double *rowlb, const double *rowub,
589  const std::vector< std::string > &colnames,
590  const std::vector< std::string > &rownames);
591  void setMpsData(const CoinPackedMatrix &m, const double infinity,
592  const double *collb, const double *colub,
593  const double *obj, const char *integrality,
594  const char *rowsen, const double *rowrhs,
595  const double *rowrng,
596  char const *const *const colnames,
597  char const *const *const rownames);
598  void setMpsData(const CoinPackedMatrix &m, const double infinity,
599  const double *collb, const double *colub,
600  const double *obj, const char *integrality,
601  const char *rowsen, const double *rowrhs,
602  const double *rowrng,
603  const std::vector< std::string > &colnames,
604  const std::vector< std::string > &rownames);
605 
611  void copyInIntegerInformation(const char *integerInformation);
612 
614  void setProblemName(const char *name);
615 
617  void setObjectiveName(const char *name);
618 
620 
627  void setInfinity(double value);
629 
631  double getInfinity() const;
632 
634  void setDefaultBound(int value);
635 
637  int getDefaultBound() const;
639  inline int allowStringElements() const
640  {
641  return allowStringElements_;
642  }
644  inline void setAllowStringElements(int yesNo)
645  {
646  allowStringElements_ = yesNo;
647  }
650  inline double getSmallElementValue() const
651  {
652  return smallElement_;
653  }
654  inline void setSmallElementValue(double value)
655  {
656  smallElement_ = value;
657  }
659 
678  void setFileName(const char *name);
680 
682  const char *getFileName() const;
683 
688  int readMps(const char *filename, const char *extension = "mps");
689 
695  int readMps(const char *filename, const char *extension,
696  int &numberSets, CoinSet **&sets);
697 
708  int readMps();
710  int readMps(int &numberSets, CoinSet **&sets);
720  int readBasis(const char *filename, const char *extension,
721  double *solution, unsigned char *rowStatus, unsigned char *columnStatus,
722  const std::vector< std::string > &colnames, int numberColumns,
723  const std::vector< std::string > &rownames, int numberRows);
724 
730  int readGms(const char *filename, const char *extension = "gms", bool convertObjective = false);
731 
737  int readGms(const char *filename, const char *extension,
738  int &numberSets, CoinSet **&sets);
739 
746  // Not for now int readGms();
748  int readGms(int &numberSets, CoinSet **&sets);
751  int readGMPL(const char *modelName, const char *dataName = NULL, bool keepNames = false);
752 
778  int writeMps(const char *filename, int compression = 0,
779  int formatType = 0, int numberAcross = 2,
780  CoinPackedMatrix *quadratic = NULL,
781  int numberSOS = 0, const CoinSet *setInfo = NULL) const;
782 
784  inline const CoinMpsCardReader *reader() const
785  {
786  return cardReader_;
787  }
788 
816  int readQuadraticMps(const char *filename,
817  CoinBigIndex *&columnStart, int *&column, double *&elements,
818  int checkSymmetry);
819 
839  int readConicMps(const char *filename,
840  int *&columnStart, int *&column, int *&coneType, int &numberCones);
842  inline void setConvertObjective(bool trueFalse)
843  {
844  convertObjective_ = trueFalse;
845  }
847  int copyStringElements(const CoinModel *model);
849 
852  CoinMpsIO();
854 
856  CoinMpsIO(const CoinMpsIO &);
857 
859  CoinMpsIO &operator=(const CoinMpsIO &rhs);
860 
862  ~CoinMpsIO();
864 
873 
875  void newLanguage(CoinMessages::Language language);
876 
878  inline void setLanguage(CoinMessages::Language language) { newLanguage(language); }
879 
881  inline CoinMessageHandler *messageHandler() const { return handler_; }
882 
884  inline CoinMessages messages() { return messages_; }
886  inline CoinMessages *messagesPointer() { return &messages_; }
888 
900 
902  void releaseRowInformation();
903 
906 
909 
911  void releaseRowNames();
912 
914  void releaseColumnNames();
915 
919 
920 protected:
923 
925  void
927  const CoinPackedMatrix &m, const double infinity,
928  const double *collb, const double *colub,
929  const double *obj, const char *integrality,
930  const double *rowlb, const double *rowub);
931  void
933  const std::vector< std::string > &colnames,
934  const std::vector< std::string > &rownames);
935  void
937  char const *const *const colnames,
938  char const *const *const rownames);
939 
941  void gutsOfDestructor();
942 
944  void gutsOfCopy(const CoinMpsIO &);
945 
947  void freeAll();
948 
951  inline void
952  convertBoundToSense(const double lower, const double upper,
953  char &sense, double &right, double &range) const;
956  inline void
957  convertSenseToBound(const char sense, const double right,
958  const double range,
959  double &lower, double &upper) const;
960 
973  int dealWithFileName(const char *filename, const char *extension,
974  CoinFileInput *&input);
979  void addString(int iRow, int iColumn, const char *value);
981  void decodeString(int iString, int &iRow, int &iColumn, const char *&value) const;
983 
984  // for hashing
985  typedef struct {
986  int index, next;
987  } CoinHashLink;
988 
991  void startHash(char **names, const int number, int section);
994  void startHash(int section) const;
996  void stopHash(int section);
998  int findHash(const char *name, int section) const;
1000 
1003  char *problemName_;
1005 
1008 
1010  char *rhsName_;
1011 
1013  char *rangeName_;
1014 
1016  char *boundName_;
1017 
1020 
1023 
1026 
1028  mutable char *rowsense_;
1029 
1031  mutable double *rhs_;
1032 
1036  mutable double *rowrange_;
1037 
1040 
1043 
1045  double *rowlower_;
1046 
1048  double *rowupper_;
1049 
1051  double *collower_;
1052 
1054  double *colupper_;
1055 
1057  double *objective_;
1058 
1061 
1066 
1070  char **names_[2];
1072 
1075  char *fileName_;
1077 
1079  int numberHash_[2];
1080 
1082  mutable CoinHashLink *hash_[2];
1084 
1087  int defaultBound_;
1089 
1091  double infinity_;
1094 
1118 };
1119 
1120 //#############################################################################
1128 void CoinMpsIOUnitTest(const std::string &mpsDir);
1129 // Function to return number in most efficient way
1130 // section is 0 for columns, 1 for rhs,ranges and 2 for bounds
1131 /* formatType is
1132  0 - normal and 8 character names
1133  1 - extra accuracy
1134  2 - IEEE hex - INTEL
1135  3 - IEEE hex - not INTEL
1136 */
1137 void CoinConvertDouble(int section, int formatType, double value, char outputValue[24]);
1138 
1139 #endif
1140 
1141 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
1142 */
const char * getFileName() const
Get the current file name for the CoinMpsIO object.
int * modifiableWhich() const
Returns modifiable list of variables.
Definition: CoinMpsIO.hpp:322
int isIntegerOrSemiContinuous(int columnNumber) const
Return 1 if a column is an integer variable, 2 if semi-continuous.
int ieeeFormat_
Whether IEEE - 0 no, 1 INTEL, 2 not INTEL.
Definition: CoinMpsIO.hpp:235
int numberStringElements_
Number of string elements.
Definition: CoinMpsIO.hpp:1114
static void strcpyAndCompress(char *to, const char *from)
remove blanks
double infinity_
Value to use for infinity.
Definition: CoinMpsIO.hpp:1091
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:129
const char * rowName() const
Returns row name of current field.
Definition: CoinMpsIO.hpp:152
int getDefaultBound() const
Get default upper bound for integer variables.
double * modifiableWeights() const
Returns modifiable weights.
Definition: CoinMpsIO.hpp:327
CoinSet & operator=(const CoinSet &rhs)
Assignment operator.
COINMpsType
Definition: CoinMpsIO.hpp:56
void setInfinity(double value)
Set infinity.
CoinMessages * messagesPointer()
Return the messages pointer.
Definition: CoinMpsIO.hpp:886
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:650
void releaseColumnInformation()
Release all column information (lower, upper, objective)
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:241
~CoinMpsIO()
Destructor.
CoinBigIndex cardNumber() const
Returns card number.
Definition: CoinMpsIO.hpp:192
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:182
void setSetType(int type)
Sets type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:307
int readQuadraticMps(const char *filename, CoinBigIndex *&columnStart, int *&column, double *&elements, int checkSymmetry)
Read in a quadratic objective from the given filename.
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
Definition: CoinMpsIO.hpp:1065
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:297
void setSmallElementValue(double value)
Definition: CoinMpsIO.hpp:654
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: CoinMpsIO.hpp:1028
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:292
char valueString_[COIN_MAX_FIELD_LENGTH]
Current element as characters (only if strings allowed)
Definition: CoinMpsIO.hpp:245
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:1102
CoinSet()
Default constructor.
int allowStringElements_
Whether to allow string elements.
Definition: CoinMpsIO.hpp:1110
CoinFileInput * input_
File input.
Definition: CoinMpsIO.hpp:227
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
Definition: CoinModel.hpp:181
void setConvertObjective(bool trueFalse)
Set whether to move objective from matrix.
Definition: CoinMpsIO.hpp:842
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
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:233
char * fileName_
Current file name.
Definition: CoinMpsIO.hpp:1076
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:1042
Base class for message handling.
virtual ~CoinSet()
Destructor.
const double * weights() const
Returns weights.
Definition: CoinMpsIO.hpp:317
int numberHash_[2]
Number of entries in a hash table section.
Definition: CoinMpsIO.hpp:1079
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:229
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:881
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: CoinMpsIO.hpp:1045
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:139
CoinMpsIO * reader_
MpsIO.
Definition: CoinMpsIO.hpp:239
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:1070
double * objective_
Pointer to dense vector of objective coefficients.
Definition: CoinMpsIO.hpp:1057
int copyStringElements(const CoinModel *model)
copies in strings from a CoinModel - returns number
CoinMpsCardReader * cardReader_
Card reader.
Definition: CoinMpsIO.hpp:1106
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: CoinMpsIO.hpp:1031
bool stringsAllowed_
Whether strings allowed.
Definition: CoinMpsIO.hpp:247
This is a first attempt at a message handler.
double * colupper_
Pointer to dense vector of column upper bounds.
Definition: CoinMpsIO.hpp:1054
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:1088
Very simple class for containing SOS set.
Definition: CoinMpsIO.hpp:361
void newLanguage(CoinMessages::Language language)
Set the language for messages.
CoinBigIndex numberElements_
Number of coefficients.
Definition: CoinMpsIO.hpp:1025
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:349
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:312
char * objectiveName_
Objective row name.
Definition: CoinMpsIO.hpp:1007
COINMpsType mpsType_
Current COINMpsType.
Definition: CoinMpsIO.hpp:221
#define COIN_MAX_FIELD_LENGTH
Definition: CoinMpsIO.hpp:35
int * which_
Which variables are in set.
Definition: CoinMpsIO.hpp:353
MPS IO Interface.
Definition: CoinMpsIO.hpp:401
CoinHashLink * hash_[2]
Hash tables (two sections, 0 - row names, 1 - column names)
Definition: CoinMpsIO.hpp:1082
bool convertObjective_
If .gms file should it be massaged to move objective.
Definition: CoinMpsIO.hpp:1108
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:302
int numberStringElements() const
Number of string elements.
Definition: CoinMpsIO.hpp:561
const char * getObjectiveName() const
Return the objective name.
int maximumStringElements_
Maximum number of string elements.
Definition: CoinMpsIO.hpp:1112
const CoinMpsCardReader * reader() const
Return card reader object so can see what last card was e.g. QUADOBJ.
Definition: CoinMpsIO.hpp:784
void setLanguage(CoinMessages::Language language)
Set the language for messages.
Definition: CoinMpsIO.hpp:878
char * eol_
End of card.
Definition: CoinMpsIO.hpp:219
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:162
void freeAll()
Clears problem data from the CoinMpsIO object.
char * position_
Current position within card image.
Definition: CoinMpsIO.hpp:217
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:1104
const char * getBoundName() const
Return the bound vector name.
char * getPosition() const
get position (again so gms reader will work)
Definition: CoinMpsIO.hpp:187
bool eightChar_
If all names &lt;= 8 characters then allow embedded blanks.
Definition: CoinMpsIO.hpp:237
bool isContinuous(int colNumber) const
Return true if column is a continuous variable.
bool freeFormat() const
Sees if free format.
Definition: CoinMpsIO.hpp:134
double objectiveOffset_
Constant offset for objective value (i.e., RHS value for OBJ row)
Definition: CoinMpsIO.hpp:1060
int setType_
type of set
Definition: CoinMpsIO.hpp:351
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:1051
CoinBigIndex getNumElements() const
Get number of nonzero elements.
Sparse Matrix Base Class.
Very simple code for reading MPS data.
Definition: CoinMpsIO.hpp:90
double * rowrange_
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range...
Definition: CoinMpsIO.hpp:1036
CoinFileInput * fileInput() const
Returns file input.
Definition: CoinMpsIO.hpp:197
char * rhsName_
Right-hand side vector name.
Definition: CoinMpsIO.hpp:1010
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:27
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:145
void setAllowStringElements(int yesNo)
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
Definition: CoinMpsIO.hpp:644
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:1039
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:355
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
const char * card() const
Whole card (for printing)
Definition: CoinMpsIO.hpp:172
const char * valueString() const
Returns value as string in current field.
Definition: CoinMpsIO.hpp:167
int CoinBigIndex
Abstract base class for file input classes.
Definition: CoinFileIO.hpp:40
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:177
char card_[MAX_CARD_LENGTH]
Current card image.
Definition: CoinMpsIO.hpp:215
void stopHash(int section)
Deletes hash storage.
double smallElement_
Small element value.
Definition: CoinMpsIO.hpp:1093
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:1048
char * rangeName_
Range vector name.
Definition: CoinMpsIO.hpp:1013
char rowName_[COIN_MAX_FIELD_LENGTH]
Current row name.
Definition: CoinMpsIO.hpp:223
void releaseRowInformation()
Release all row information (lower, upper)
const char * getProblemName() const
Return the problem name.
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:1096
int numberColumns_
Number of columns.
Definition: CoinMpsIO.hpp:1022
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.
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:639
void setObjectiveOffset(double value)
Set objective offset.
Definition: CoinMpsIO.hpp:541
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:213
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:202
const char * columnName() const
Returns column name of current field.
Definition: CoinMpsIO.hpp:157
CoinMessages messages()
Return the messages.
Definition: CoinMpsIO.hpp:884
char * boundName_
Bounds vector name.
Definition: CoinMpsIO.hpp:1016
void releaseColumnNames()
Release column names.
char columnName_[COIN_MAX_FIELD_LENGTH]
Current column name.
Definition: CoinMpsIO.hpp:225
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:243
int numberRows_
Number of rows.
Definition: CoinMpsIO.hpp:1019
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
const char * stringElement(int i) const
String element.
Definition: CoinMpsIO.hpp:566
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:124
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:231
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:1004
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:269
char ** stringElements_
String elements.
Definition: CoinMpsIO.hpp:1116
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.