CoinMpsIO.hpp
Go to the documentation of this file.
1 /* $Id: CoinMpsIO.hpp 1642 2013-10-16 00:43:14Z tkr $ */
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 int setType ( ) const
250  { return setType_; }
252  inline const int * which ( ) const
253  { return which_; }
255  inline const double * weights ( ) const
256  { return weights_; }
258 
259 #ifdef USE_SBB
260 
262  virtual SbbObject * sbbObject(SbbModel * model) const
264  { return NULL;}
266 #endif
267 
269 protected:
270 
273  int numberEntries_;
276  int setType_;
278  int * which_;
280  double * weights_;
282 };
283 
284 //#############################################################################
286 class CoinSosSet : public CoinSet{
287 
288 public:
289 
292  CoinSosSet ( int numberEntries, const int * which, const double * weights, int type);
294 
296  virtual ~CoinSosSet ( );
298 
299 
300 #ifdef USE_SBB
301 
303  virtual SbbObject * sbbObject(SbbModel * model) const ;
306 #endif
307 
309 protected:
310 
313 
314 };
315 
316 //#############################################################################
317 
329 class CoinMpsIO {
330  friend void CoinMpsIOUnitTest(const std::string & mpsDir);
331 
332 public:
333 
345  int getNumCols() const;
347 
349  int getNumRows() const;
350 
352  int getNumElements() const;
353 
355  const double * getColLower() const;
356 
358  const double * getColUpper() const;
359 
369  const char * getRowSense() const;
370 
382  const double * getRightHandSide() const;
383 
397  const double * getRowRange() const;
398 
400  const double * getRowLower() const;
401 
403  const double * getRowUpper() const;
404 
406  const double * getObjCoefficients() const;
407 
409  const CoinPackedMatrix * getMatrixByRow() const;
410 
412  const CoinPackedMatrix * getMatrixByCol() const;
413 
415  bool isContinuous(int colNumber) const;
416 
422  bool isInteger(int columnNumber) const;
423 
429  const char * integerColumns() const;
430 
435  const char * rowName(int index) const;
436 
441  const char * columnName(int index) const;
442 
449  int rowIndex(const char * name) const;
450 
455  int columnIndex(const char * name) const;
456 
461  double objectiveOffset() const;
463  inline void setObjectiveOffset(double value)
464  { objectiveOffset_=value;}
465 
467  const char * getProblemName() const;
468 
470  const char * getObjectiveName() const;
471 
473  const char * getRhsName() const;
474 
476  const char * getRangeName() const;
477 
479  const char * getBoundName() const;
481  inline int numberStringElements() const
482  { return numberStringElements_;}
484  inline const char * stringElement(int i) const
485  { return stringElements_[i];}
487 
488 
494 
496  void setMpsData(const CoinPackedMatrix& m, const double infinity,
497  const double* collb, const double* colub,
498  const double* obj, const char* integrality,
499  const double* rowlb, const double* rowub,
500  char const * const * const colnames,
501  char const * const * const rownames);
502  void setMpsData(const CoinPackedMatrix& m, const double infinity,
503  const double* collb, const double* colub,
504  const double* obj, const char* integrality,
505  const double* rowlb, const double* rowub,
506  const std::vector<std::string> & colnames,
507  const std::vector<std::string> & rownames);
508  void setMpsData(const CoinPackedMatrix& m, const double infinity,
509  const double* collb, const double* colub,
510  const double* obj, const char* integrality,
511  const char* rowsen, const double* rowrhs,
512  const double* rowrng,
513  char const * const * const colnames,
514  char const * const * const rownames);
515  void setMpsData(const CoinPackedMatrix& m, const double infinity,
516  const double* collb, const double* colub,
517  const double* obj, const char* integrality,
518  const char* rowsen, const double* rowrhs,
519  const double* rowrng,
520  const std::vector<std::string> & colnames,
521  const std::vector<std::string> & rownames);
522 
528  void copyInIntegerInformation(const char * integerInformation);
529 
531  void setProblemName(const char *name) ;
532 
534  void setObjectiveName(const char *name) ;
535 
537 
544  void setInfinity(double value);
546 
548  double getInfinity() const;
549 
551  void setDefaultBound(int value);
552 
554  int getDefaultBound() const;
556  inline int allowStringElements() const
557  { return allowStringElements_;}
559  inline void setAllowStringElements(int yesNo)
560  { allowStringElements_ = yesNo;}
563  inline double getSmallElementValue() const
564  { return smallElement_;}
565  inline void setSmallElementValue(double value)
566  { smallElement_=value;}
568 
569 
588  void setFileName(const char * name);
590 
592  const char * getFileName() const;
593 
598  int readMps(const char *filename, const char *extension = "mps");
599 
605  int readMps(const char *filename, const char *extension ,
606  int & numberSets, CoinSet **& sets);
607 
618  int readMps();
620  int readMps(int & numberSets, CoinSet **& sets);
630  int readBasis(const char *filename, const char *extension ,
631  double * solution, unsigned char *rowStatus, unsigned char *columnStatus,
632  const std::vector<std::string> & colnames,int numberColumns,
633  const std::vector<std::string> & rownames, int numberRows);
634 
640  int readGms(const char *filename, const char *extension = "gms",bool convertObjective=false);
641 
647  int readGms(const char *filename, const char *extension ,
648  int & numberSets, CoinSet **& sets);
649 
656  // Not for now int readGms();
658  int readGms(int & numberSets, CoinSet **& sets);
661  int readGMPL(const char *modelName, const char * dataName=NULL, bool keepNames=false);
662 
688  int writeMps(const char *filename, int compression = 0,
689  int formatType = 0, int numberAcross = 2,
690  CoinPackedMatrix * quadratic = NULL,
691  int numberSOS=0,const CoinSet * setInfo=NULL) const;
692 
694  inline const CoinMpsCardReader * reader() const
695  { return cardReader_;}
696 
724  int readQuadraticMps(const char * filename,
725  int * &columnStart, int * &column, double * &elements,
726  int checkSymmetry);
727 
747  int readConicMps(const char * filename,
748  int * &columnStart, int * &column, int * &coneType, int & numberCones);
750  inline void setConvertObjective(bool trueFalse)
751  { convertObjective_=trueFalse;}
753  int copyStringElements(const CoinModel * model);
755 
758  CoinMpsIO();
760 
762  CoinMpsIO (const CoinMpsIO &);
763 
765  CoinMpsIO & operator=(const CoinMpsIO& rhs);
766 
768  ~CoinMpsIO ();
770 
771 
780 
782  void newLanguage(CoinMessages::Language language);
783 
785  inline void setLanguage(CoinMessages::Language language) {newLanguage(language);}
786 
788  inline CoinMessageHandler * messageHandler() const {return handler_;}
789 
791  inline CoinMessages messages() {return messages_;}
793  inline CoinMessages * messagesPointer() {return & messages_;}
795 
796 
808 
810  void releaseRowInformation();
811 
814 
817 
819  void releaseRowNames();
820 
822  void releaseColumnNames();
823 
827 
828 protected:
829 
832 
834  void
836  const CoinPackedMatrix& m, const double infinity,
837  const double* collb, const double* colub,
838  const double* obj, const char* integrality,
839  const double* rowlb, const double* rowub);
840  void
842  const std::vector<std::string> & colnames,
843  const std::vector<std::string> & rownames);
844  void
846  char const * const * const colnames,
847  char const * const * const rownames);
848 
849 
851  void gutsOfDestructor();
852 
854  void gutsOfCopy(const CoinMpsIO &);
855 
857  void freeAll();
858 
859 
862  inline void
863  convertBoundToSense(const double lower, const double upper,
864  char& sense, double& right, double& range) const;
867  inline void
868  convertSenseToBound(const char sense, const double right,
869  const double range,
870  double& lower, double& upper) const;
871 
884  int dealWithFileName(const char * filename, const char * extension,
885  CoinFileInput * &input);
890  void addString(int iRow,int iColumn, const char * value);
892  void decodeString(int iString, int & iRow, int & iColumn, const char * & value) const;
894 
895 
896  // for hashing
897  typedef struct {
898  int index, next;
899  } CoinHashLink;
900 
903  void startHash ( char **names, const int number , int section );
906  void startHash ( int section ) const;
908  void stopHash ( int section );
910  int findHash ( const char *name , int section ) const;
912 
915  char * problemName_;
917 
920 
922  char * rhsName_;
923 
925  char * rangeName_;
926 
928  char * boundName_;
929 
932 
935 
938 
940  mutable char *rowsense_;
941 
943  mutable double *rhs_;
944 
948  mutable double *rowrange_;
949 
952 
955 
957  double * rowlower_;
958 
960  double * rowupper_;
961 
963  double * collower_;
964 
966  double * colupper_;
967 
969  double * objective_;
970 
973 
974 
978  char * integerType_;
979 
983  char **names_[2];
985 
988  char * fileName_;
990 
992  int numberHash_[2];
993 
995  mutable CoinHashLink *hash_[2];
997 
1000  int defaultBound_;
1002 
1004  double infinity_;
1007 
1031 
1032 };
1033 
1034 //#############################################################################
1042 void
1043 CoinMpsIOUnitTest(const std::string & mpsDir);
1044 // Function to return number in most efficient way
1045 // section is 0 for columns, 1 for rhs,ranges and 2 for bounds
1046 /* formatType is
1047  0 - normal and 8 character names
1048  1 - extra accuracy
1049  2 - IEEE hex - INTEL
1050  3 - IEEE hex - not INTEL
1051 */
1052 void
1053 CoinConvertDouble(int section, int formatType, double value, char outputValue[24]);
1054 
1055 #endif
1056 
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:989
int allowStringElements() const
Whether to allow string elements.
Definition: CoinMpsIO.hpp:556
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:186
CoinMpsIO()
Default Constructor.
char * getPosition() const
get position (again so gms reader will work)
Definition: CoinMpsIO.hpp:143
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 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:192
char ** names_[2]
Row and column names Linked to hash table sections (0 - row names, 1 column names) ...
Definition: CoinMpsIO.hpp:983
COINSectionType
Definition: CoinMpsIO.hpp:39
double * collower_
Pointer to dense vector of column lower bounds.
Definition: CoinMpsIO.hpp:963
Base class for message handling.
const char * getRangeName() const
Return the range vector name.
int defaultBound_
Upper bound when no bounds for integers.
Definition: CoinMpsIO.hpp:1001
int maximumStringElements_
Maximum number of string elements.
Definition: CoinMpsIO.hpp:1025
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:166
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:132
const char * integerColumns() const
Returns array[getNumCols()] specifying if a variable is integer.
int numberEntries() const
Returns number of entries.
Definition: CoinMpsIO.hpp:246
const char * stringElement(int i) const
String element.
Definition: CoinMpsIO.hpp:484
const char * getFileName() const
Get the current file name for the CoinMpsIO object.
char * objectiveName_
Objective row name.
Definition: CoinMpsIO.hpp:919
char * rhsName_
Right-hand side vector name.
Definition: CoinMpsIO.hpp:922
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:255
double * rowrange_
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range...
Definition: CoinMpsIO.hpp:948
const int * which() const
Returns list of variables.
Definition: CoinMpsIO.hpp:252
double value() const
Returns value in current field.
Definition: CoinMpsIO.hpp:124
void setAllowStringElements(int yesNo)
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
Definition: CoinMpsIO.hpp:559
bool freeFormat() const
Sees if free format.
Definition: CoinMpsIO.hpp:103
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:99
const char * rowName() const
Returns row name of current field.
Definition: CoinMpsIO.hpp:116
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:180
void setLanguage(CoinMessages::Language language)
Set the language for messages.
Definition: CoinMpsIO.hpp:785
void setObjectiveOffset(double value)
Set objective offset.
Definition: CoinMpsIO.hpp:463
Sparse Matrix Base Class.
COINSectionType whichSection() const
Returns current section type.
Definition: CoinMpsIO.hpp:95
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:174
char ** stringElements_
String elements.
Definition: CoinMpsIO.hpp:1029
int allowStringElements_
Whether to allow string elements.
Definition: CoinMpsIO.hpp:1023
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:1009
COINSectionType readToNextSection()
Read to next section.
int numberRows_
Number of rows.
Definition: CoinMpsIO.hpp:931
bool defaultHandler_
Flag to say if the message handler is the default handler.
Definition: CoinMpsIO.hpp:1015
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:972
const char * columnName() const
Returns column name of current field.
Definition: CoinMpsIO.hpp:120
CoinFileInput * input_
File input.
Definition: CoinMpsIO.hpp:178
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:150
char valueString_[COIN_MAX_FIELD_LENGTH]
Current element as characters (only if strings allowed)
Definition: CoinMpsIO.hpp:196
double * weights_
Weights.
Definition: CoinMpsIO.hpp:280
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:925
COINMpsType mpsType() const
Only for first field on card otherwise BLANK_COLUMN e.g.
Definition: CoinMpsIO.hpp:110
double getInfinity() const
Get infinity.
double smallElement_
Small element value.
Definition: CoinMpsIO.hpp:1006
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: CoinMpsIO.hpp:940
int setType_
type of set
Definition: CoinMpsIO.hpp:276
#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:928
int nextGmsField(int expectedType)
Gets next field for .gms file and returns type.
CoinBigIndex cardNumber() const
Returns card number.
Definition: CoinMpsIO.hpp:146
Very simple class for containing data on set.
Definition: CoinMpsIO.hpp:221
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:791
CoinBigIndex numberElements_
Number of coefficients.
Definition: CoinMpsIO.hpp:937
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:249
CoinMessageHandler * messageHandler() const
Return the message handler.
Definition: CoinMpsIO.hpp:788
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:286
void setStringsAllowed()
Sets whether strings allowed.
Definition: CoinMpsIO.hpp:154
bool isInteger(int columnNumber) const
Return true if a column is an integer variable.
CoinMpsIO * reader_
MpsIO.
Definition: CoinMpsIO.hpp:190
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:954
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
Abstract base class for file input classes.
Definition: CoinFileIO.hpp:37
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:176
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:1017
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:198
CoinMessages * messagesPointer()
Return the messages pointer.
Definition: CoinMpsIO.hpp:793
bool eightChar_
If all names &lt;= 8 characters then allow embedded blanks.
Definition: CoinMpsIO.hpp:188
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: CoinMpsIO.hpp:960
char * mutableCard()
Whole card - so we look at it (not const so nextBlankOr will work for gms reader) ...
Definition: CoinMpsIO.hpp:136
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:978
bool convertObjective_
If .gms file should it be massaged to move objective.
Definition: CoinMpsIO.hpp:1021
int readQuadraticMps(const char *filename, int *&columnStart, int *&column, double *&elements, int checkSymmetry)
Read in a quadratic objective from the given filename.
double value_
Current value.
Definition: CoinMpsIO.hpp:164
int getNumRows() const
Get number of rows.
int numberStringElements_
Number of string elements.
Definition: CoinMpsIO.hpp:1027
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:943
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:934
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:140
void setFreeFormat(bool yesNo)
Sets whether free format. Mainly for blank RHS etc.
Definition: CoinMpsIO.hpp:106
CoinBigIndex cardNumber_
Card number.
Definition: CoinMpsIO.hpp:182
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler.
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:194
Very simple code for reading MPS data.
Definition: CoinMpsIO.hpp:59
int * which_
Which variables are in set.
Definition: CoinMpsIO.hpp:278
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:563
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:992
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:969
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:694
CoinHashLink * hash_[2]
Hash tables (two sections, 0 - row names, 1 - column names)
Definition: CoinMpsIO.hpp:995
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:916
int COINColumnIndex
Definition: CoinLpIO.hpp:26
void decodeString(int iString, int &iRow, int &iColumn, const char *&value) const
Decode string.
double infinity_
Value to use for infinity.
Definition: CoinMpsIO.hpp:1004
void setProblemName(const char *name)
Set problem name.
void setSmallElementValue(double value)
Set infinity.
Definition: CoinMpsIO.hpp:565
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of the coefficient matrix.
int numberEntries_
Number of entries.
Definition: CoinMpsIO.hpp:274
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:47
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: CoinMpsIO.hpp:957
char * position_
Current position within card image.
Definition: CoinMpsIO.hpp:168
virtual ~CoinSet()
Destructor.
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:966
bool freeFormat_
Whether free format. Just for blank RHS etc.
Definition: CoinMpsIO.hpp:184
static char * nextBlankOr(char *image)
type - 0 normal, 1 INTEL IEEE, 2 other IEEE
char * eol_
End of card.
Definition: CoinMpsIO.hpp:170
virtual ~CoinSosSet()
Destructor.
const char * valueString() const
Returns value as string in current field.
Definition: CoinMpsIO.hpp:128
Language
Supported languages.
void releaseMatrixInformation()
Release matrix information.
int numberStringElements() const
Number of string elements.
Definition: CoinMpsIO.hpp:481
COINMpsType mpsType_
Current COINMpsType.
Definition: CoinMpsIO.hpp:172
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 getNumElements() const
Get number of nonzero elements.
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:1019
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:951
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:329
void setConvertObjective(bool trueFalse)
Set whether to move objective from matrix.
Definition: CoinMpsIO.hpp:750
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.