coin-Bcp
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:
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 */
void startHash(char **names, const int number, int section)
Creates hash list for names (section = 0 for rows, 1 columns)
int CoinBigIndex
#define MAX_CARD_LENGTH
Definition: CoinMpsIO.hpp:37
void stopHash(int section)
Deletes hash storage.
CoinSet()
Default constructor.
char * fileName_
Current file name.
Definition: CoinMpsIO.hpp:1076
int allowStringElements() const
Whether to allow string elements.
Definition: CoinMpsIO.hpp:639
void CoinMpsIOUnitTest(const std::string &mpsDir)
A function that tests the methods in the CoinMpsIO class.
int ieeeFormat_
Whether IEEE - 0 no, 1 INTEL, 2 not INTEL.
Definition: CoinMpsIO.hpp:235
CoinMpsIO()
Default Constructor.
char * getPosition() const
get position (again so gms reader will work)
Definition: CoinMpsIO.hpp:187
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 releaseRedundantInformation()
Release all information which can be re-calculated.
void setDefaultBound(int value)
Set default upper bound for integer variables.
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:241
char ** names_[2]
Row and column names Linked to hash table sections (0 - row names, 1 column names) ...
Definition: CoinMpsIO.hpp:1070
COINSectionType
Definition: CoinMpsIO.hpp:39
double * collower_
Pointer to dense vector of column lower bounds.
Definition: CoinMpsIO.hpp:1051
Base class for message handling.
void setSetType(int type)
Sets type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:307
int reader(const LP_parms &lp_par, VOL_lp *lp_pb)
const char * getRangeName() const
Return the range vector name.
int defaultBound_
Upper bound when no bounds for integers.
Definition: CoinMpsIO.hpp:1088
void setNumberEntries(int number)
Sets number of entries.
Definition: CoinMpsIO.hpp:297
int maximumStringElements_
Maximum number of string elements.
Definition: CoinMpsIO.hpp:1112
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.
~CoinMpsIO()
Destructor.
int readMps()
Read a problem in MPS format from a previously opened file.
char card_[MAX_CARD_LENGTH]
Current card image.
Definition: CoinMpsIO.hpp:215
const char * getProblemName() const
Return the problem name.
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.
const char * rowName(int index) const
Returns the row name for the specified index.
const char * card() const
Whole card (for printing)
Definition: CoinMpsIO.hpp:172
const char * integerColumns() const
Returns array[getNumCols()] specifying if a variable is integer.
int numberEntries() const
Returns number of entries.
Definition: CoinMpsIO.hpp:292
const char * stringElement(int i) const
String element.
Definition: CoinMpsIO.hpp:566
const char * getFileName() const
Get the current file name for the CoinMpsIO object.
char * objectiveName_
Objective row name.
Definition: CoinMpsIO.hpp:1007
char * rhsName_
Right-hand side vector name.
Definition: CoinMpsIO.hpp:1010
int dealWithFileName(const char *filename, const char *extension, CoinFileInput *&input)
Deal with a filename.
int getNumCols() const
Get number of columns.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of constraint right-hand sides.
const double * weights() const
Returns weights.
Definition: CoinMpsIO.hpp:317
double * rowrange_
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range...
Definition: CoinMpsIO.hpp:1036
const int * which() const
Returns list of variables.
Definition: CoinMpsIO.hpp:312
double value() const
Returns value in current field.
Definition: CoinMpsIO.hpp:162
void setAllowStringElements(int yesNo)
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
Definition: CoinMpsIO.hpp:644
bool freeFormat() const
Sees if free format.
Definition: CoinMpsIO.hpp:134
CoinBigIndex getNumElements() const
Get number of nonzero elements.
void setObjectiveName(const char *name)
Set objective name.
void setFileName(const char *name)
Set the current file name for the CoinMpsIO object.
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 findHash(const char *name, int section) const
Finds match using hash, -1 not found.
COINSectionType section_
Which section we think we are in.
Definition: CoinMpsIO.hpp:229
void setLanguage(CoinMessages::Language language)
Set the language for messages.
Definition: CoinMpsIO.hpp:878
void setObjectiveOffset(double value)
Set objective offset.
Definition: CoinMpsIO.hpp:541
Sparse Matrix Base Class.
COINSectionType whichSection() const
Returns current section type.
Definition: CoinMpsIO.hpp:124
void freeAll()
Clears problem data from the CoinMpsIO object.
void releaseColumnInformation()
Release all column information (lower, upper, objective)
void gutsOfDestructor()
Does the heavy lifting for destruct and assignment.
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.
char rowName_[COIN_MAX_FIELD_LENGTH]
Current row name.
Definition: CoinMpsIO.hpp:223
char ** stringElements_
String elements.
Definition: CoinMpsIO.hpp:1116
int allowStringElements_
Whether to allow string elements.
Definition: CoinMpsIO.hpp:1110
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:1096
COINSectionType readToNextSection()
Read to next section.
int numberRows_
Number of rows.
Definition: CoinMpsIO.hpp:1019
bool defaultHandler_
Flag to say if the message handler is the default handler.
Definition: CoinMpsIO.hpp:1102
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
double objectiveOffset_
Constant offset for objective value (i.e., RHS value for OBJ row)
Definition: CoinMpsIO.hpp:1060
const char * columnName() const
Returns column name of current field.
Definition: CoinMpsIO.hpp:157
CoinFileInput * input_
File input.
Definition: CoinMpsIO.hpp:227
const char * getBoundName() const
Return the bound vector name.
int copyStringElements(const CoinModel *model)
copies in strings from a CoinModel - returns number
int rowIndex(const char *name) const
Returns the index for the specified row name.
void CoinConvertDouble(int section, int formatType, double value, char outputValue[24])
CoinFileInput * fileInput() const
Returns file input.
Definition: CoinMpsIO.hpp:197
char valueString_[COIN_MAX_FIELD_LENGTH]
Current element as characters (only if strings allowed)
Definition: CoinMpsIO.hpp:245
double * weights_
Weights.
Definition: CoinMpsIO.hpp:355
void releaseIntegerInformation()
Release integer information.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
char * rangeName_
Range vector name.
Definition: CoinMpsIO.hpp:1013
COINMpsType mpsType() const
Only for first field on card otherwise BLANK_COLUMN e.g.
Definition: CoinMpsIO.hpp:145
double getInfinity() const
Get infinity.
double smallElement_
Small element value.
Definition: CoinMpsIO.hpp:1093
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: CoinMpsIO.hpp:1028
int setType_
type of set
Definition: CoinMpsIO.hpp:351
#define COIN_MAX_FIELD_LENGTH
Definition: CoinMpsIO.hpp:35
const char * getObjectiveName() const
Return the objective name.
bool isContinuous(int colNumber) const
Return true if column is a continuous variable.
int cleanCard()
Reads and cleans card - taking out trailing blanks - return 1 if EOF.
char * boundName_
Bounds vector name.
Definition: CoinMpsIO.hpp:1016
int nextGmsField(int expectedType)
Gets next field for .gms file and returns type.
CoinBigIndex cardNumber() const
Returns card number.
Definition: CoinMpsIO.hpp:192
Very simple class for containing data on set.
Definition: CoinMpsIO.hpp:269
int columnIndex(const char *name) const
Returns the index for the specified column name.
const char * columnName(int index) const
Returns the column name for the specified index.
CoinMessages messages()
Return the messages.
Definition: CoinMpsIO.hpp:884
CoinBigIndex numberElements_
Number of coefficients.
Definition: CoinMpsIO.hpp:1025
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:302
int readQuadraticMps(const char *filename, CoinBigIndex *&columnStart, int *&column, double *&elements, int checkSymmetry)
Read in a quadratic objective from the given filename.
CoinMessageHandler * messageHandler() const
Return the message handler.
Definition: CoinMpsIO.hpp:881
void releaseRowInformation()
Release all row information (lower, upper)
static void strcpyAndCompress(char *to, const char *from)
remove blanks
Very simple class for containing SOS set.
Definition: CoinMpsIO.hpp:361
void setStringsAllowed()
Sets whether strings allowed.
Definition: CoinMpsIO.hpp:202
bool isInteger(int columnNumber) const
Return true if a column is an integer variable.
CoinMpsIO * reader_
MpsIO.
Definition: CoinMpsIO.hpp:239
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:1042
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
Abstract base class for file input classes.
Definition: CoinFileIO.hpp:40
void setMpsDataColAndRowNames(const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
Utility method used several times to implement public methods.
This is a first attempt at a message handler.
char columnName_[COIN_MAX_FIELD_LENGTH]
Current column name.
Definition: CoinMpsIO.hpp:225
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:1104
double objectiveOffset() const
Returns the (constant) objective offset.
int getDefaultBound() const
Get default upper bound for integer variables.
double osi_strtod(char *ptr, char **output, int type)
type - 0 normal, 1 INTEL IEEE, 2 other IEEE
int readGms(const char *filename, const char *extension="gms", bool convertObjective=false)
Read a problem in GAMS format from the given filename.
bool stringsAllowed_
Whether strings allowed.
Definition: CoinMpsIO.hpp:247
CoinMessages * messagesPointer()
Return the messages pointer.
Definition: CoinMpsIO.hpp:886
bool eightChar_
If all names &lt;= 8 characters then allow embedded blanks.
Definition: CoinMpsIO.hpp:237
double * modifiableWeights() const
Returns modifiable weights.
Definition: CoinMpsIO.hpp:327
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: CoinMpsIO.hpp:1048
char * mutableCard()
Whole card - so we look at it (not const so nextBlankOr will work for gms reader) ...
Definition: CoinMpsIO.hpp:177
CoinMpsCardReader(CoinFileInput *input, CoinMpsIO *reader)
Constructor expects file to be open This one takes gzFile if fp null.
~CoinMpsCardReader()
Destructor.
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
Definition: CoinMpsIO.hpp:1065
bool convertObjective_
If .gms file should it be massaged to move objective.
Definition: CoinMpsIO.hpp:1108
double value_
Current value.
Definition: CoinMpsIO.hpp:213
int getNumRows() const
Get number of rows.
int numberStringElements_
Number of string elements.
Definition: CoinMpsIO.hpp:1114
const char * getRhsName() const
Return the RHS vector name.
void releaseColumnNames()
Release column names.
Class to hold and manipulate an array of massaged messages.
CoinSet & operator=(const CoinSet &rhs)
Assignment operator.
void setInfinity(double value)
Set infinity.
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: CoinMpsIO.hpp:1031
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...
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
int numberColumns_
Number of columns.
Definition: CoinMpsIO.hpp:1022
void newLanguage(CoinMessages::Language language)
Set the language for messages.
void setPosition(char *position)
set position (again so gms reader will work)
Definition: CoinMpsIO.hpp:182
void setFreeFormat(bool yesNo)
Sets whether free format. Mainly for blank RHS etc.
Definition: CoinMpsIO.hpp:139
CoinBigIndex cardNumber_
Card number.
Definition: CoinMpsIO.hpp:231
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler.
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:243
Very simple code for reading MPS data.
Definition: CoinMpsIO.hpp:90
int * which_
Which variables are in set.
Definition: CoinMpsIO.hpp:353
CoinMpsIO & operator=(const CoinMpsIO &rhs)
Assignment operator.
double getSmallElementValue() const
Small element value - elements less than this set to zero on input default is 1.0e-14.
Definition: CoinMpsIO.hpp:650
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
int numberHash_[2]
Number of entries in a hash table section.
Definition: CoinMpsIO.hpp:1079
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
double * objective_
Pointer to dense vector of objective coefficients.
Definition: CoinMpsIO.hpp:1057
void releaseRowNames()
Release row names.
const CoinMpsCardReader * reader() const
Return card reader object so can see what last card was e.g. QUADOBJ.
Definition: CoinMpsIO.hpp:784
CoinHashLink * hash_[2]
Hash tables (two sections, 0 - row names, 1 - column names)
Definition: CoinMpsIO.hpp:1082
void gutsOfCopy(const CoinMpsIO &)
Does the heavy lifting for copy and assignment.
CoinSosSet(int numberEntries, const int *which, const double *weights, int type)
Constructor.
int COINRowIndex
Large enough to contain row index (or basis)
Definition: CoinMpsIO.hpp:30
char * problemName_
Problem name.
Definition: CoinMpsIO.hpp:1004
int COINColumnIndex
Definition: CoinLpIO.hpp:27
void decodeString(int iString, int &iRow, int &iColumn, const char *&value) const
Decode string.
double infinity_
Value to use for infinity.
Definition: CoinMpsIO.hpp:1091
void setProblemName(const char *name)
Set problem name.
void setSmallElementValue(double value)
Set infinity.
Definition: CoinMpsIO.hpp:654
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of the coefficient matrix.
int numberEntries_
Number of entries.
Definition: CoinMpsIO.hpp:349
COINSectionType nextField()
Gets next field and returns section type e.g. COIN_COLUMN_SECTION.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
friend void CoinMpsIOUnitTest(const std::string &mpsDir)
A function that tests the methods in the CoinMpsIO class.
COINMpsType
Definition: CoinMpsIO.hpp:56
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: CoinMpsIO.hpp:1045
char * position_
Current position within card image.
Definition: CoinMpsIO.hpp:217
virtual ~CoinSet()
Destructor.
int * modifiableWhich() const
Returns modifiable list of variables.
Definition: CoinMpsIO.hpp:322
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...
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.
double * colupper_
Pointer to dense vector of column upper bounds.
Definition: CoinMpsIO.hpp:1054
int isIntegerOrSemiContinuous(int columnNumber) const
Return 1 if a column is an integer variable, 2 if semi-continuous.
bool freeFormat_
Whether free format. Just for blank RHS etc.
Definition: CoinMpsIO.hpp:233
static char * nextBlankOr(char *image)
type - 0 normal, 1 INTEL IEEE, 2 other IEEE
char * eol_
End of card.
Definition: CoinMpsIO.hpp:219
virtual ~CoinSosSet()
Destructor.
const char * valueString() const
Returns value as string in current field.
Definition: CoinMpsIO.hpp:167
Language
Supported languages.
void releaseMatrixInformation()
Release matrix information.
int numberStringElements() const
Number of string elements.
Definition: CoinMpsIO.hpp:561
COINMpsType mpsType_
Current COINMpsType.
Definition: CoinMpsIO.hpp:221
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.
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 * cardReader_
Card reader.
Definition: CoinMpsIO.hpp:1106
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:1039
int readConicMps(const char *filename, int *&columnStart, int *&column, int *&coneType, int &numberCones)
Read in a list of cones from the given filename.
MPS IO Interface.
Definition: CoinMpsIO.hpp:401
void setConvertObjective(bool trueFalse)
Set whether to move objective from matrix.
Definition: CoinMpsIO.hpp:842
const char * getRowSense() const
Get pointer to array[getNumRows()] of constraint senses.
void copyInIntegerInformation(const char *integerInformation)
Pass in an array[getNumCols()] specifying if a variable is integer.