CoinMpsIO.hpp
Go to the documentation of this file.
1 /* $Id: CoinMpsIO.hpp 1215 2009-11-05 11:03:04Z forrest $ */
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CoinMpsIO_H
5 #define CoinMpsIO_H
6 
7 #if defined(_MSC_VER)
8 // Turn off compiler warning about long names
9 # pragma warning(disable:4786)
10 #endif
11 
12 #include <vector>
13 #include <string>
14 
15 #include "CoinUtilsConfig.h"
16 #include "CoinPackedMatrix.hpp"
17 #include "CoinMessageHandler.hpp"
18 #include "CoinFileIO.hpp"
19 class CoinModel;
20 // Plus infinity
21 #ifndef COIN_DBL_MAX
22 #define COIN_DBL_MAX DBL_MAX
23 #endif
24 
29 typedef int COINColumnIndex;
30 
32 typedef int COINRowIndex;
33 
34 // We are allowing free format - but there is a limit!
35 // User can override by using CXXFLAGS += -DCOIN_MAX_FIELD_LENGTH=nnn
36 #ifndef COIN_MAX_FIELD_LENGTH
37 #define COIN_MAX_FIELD_LENGTH 160
38 #endif
39 #define MAX_CARD_LENGTH 5*COIN_MAX_FIELD_LENGTH+80
40 
47 };
48 
57 };
58 class CoinMpsIO;
61 
62 public:
63 
66  CoinMpsCardReader ( CoinFileInput *input, CoinMpsIO * reader );
69 
73 
74 
94  int nextGmsField ( int expectedType );
96  inline COINSectionType whichSection ( ) const {
97  return section_;
98  }
100  inline void setWhichSection(COINSectionType section ) {
101  section_=section;
102  }
104  inline bool freeFormat() const
105  { return freeFormat_;}
107  inline void setFreeFormat(bool yesNo)
108  { freeFormat_=yesNo;}
111  inline COINMpsType mpsType ( ) const {
112  return mpsType_;
113  }
115  int cleanCard();
117  inline const char *rowName ( ) const {
118  return rowName_;
119  }
121  inline const char *columnName ( ) const {
122  return columnName_;
123  }
125  inline double value ( ) const {
126  return value_;
127  }
129  inline const char *valueString ( ) const {
130  return valueString_;
131  }
133  inline const char *card ( ) const {
134  return card_;
135  }
137  inline char *mutableCard ( ) {
138  return card_;
139  }
141  inline void setPosition(char * position)
142  { position_=position;}
144  inline char * getPosition() const
145  { return position_;}
147  inline CoinBigIndex cardNumber ( ) const {
148  return cardNumber_;
149  }
151  inline CoinFileInput * fileInput ( ) const {
152  return input_;
153  }
155  inline void setStringsAllowed()
156  { stringsAllowed_=true;}
158 
160 protected:
161 
164  double value_;
169  char *position_;
171  char *eol_;
201 public:
204  double osi_strtod(char * ptr, char ** output, int type);
207  static void strcpyAndCompress ( char *to, const char *from );
209  static char * nextBlankOr ( char *image );
211  double osi_strtod(char * ptr, char ** output);
213 
214 };
215 
216 //#############################################################################
217 #ifdef USE_SBB
218 class SbbObject;
219 class SbbModel;
220 #endif
221 class CoinSet {
223 
224 public:
225 
228  CoinSet ( );
231  CoinSet ( int numberEntries, const int * which);
232 
234  CoinSet (const CoinSet &);
235 
237  CoinSet & operator=(const CoinSet& rhs);
238 
240  virtual ~CoinSet ( );
242 
243 
246  inline int numberEntries ( ) const
248  { return numberEntries_; }
250  inline int setType ( ) const
251  { return setType_; }
253  inline const int * which ( ) const
254  { return which_; }
256  inline const double * weights ( ) const
257  { return weights_; }
259 
260 #ifdef USE_SBB
261 
263  virtual SbbObject * sbbObject(SbbModel * model) const
265  { return NULL;}
267 #endif
268 
270 protected:
271 
274  int numberEntries_;
277  int setType_;
279  int * which_;
281  double * weights_;
283 };
284 
285 //#############################################################################
287 class CoinSosSet : public CoinSet{
288 
289 public:
290 
293  CoinSosSet ( int numberEntries, const int * which, const double * weights, int type);
295 
297  virtual ~CoinSosSet ( );
299 
300 
301 #ifdef USE_SBB
302 
304  virtual SbbObject * sbbObject(SbbModel * model) const ;
307 #endif
308 
310 protected:
311 
314 
315 };
316 
317 //#############################################################################
318 
330 class CoinMpsIO {
331  friend void CoinMpsIOUnitTest(const std::string & mpsDir);
332 
333 public:
334 
346  int getNumCols() const;
348 
350  int getNumRows() const;
351 
353  int getNumElements() const;
354 
356  const double * getColLower() const;
357 
359  const double * getColUpper() const;
360 
370  const char * getRowSense() const;
371 
383  const double * getRightHandSide() const;
384 
398  const double * getRowRange() const;
399 
401  const double * getRowLower() const;
402 
404  const double * getRowUpper() const;
405 
407  const double * getObjCoefficients() const;
408 
410  const CoinPackedMatrix * getMatrixByRow() const;
411 
413  const CoinPackedMatrix * getMatrixByCol() const;
414 
416  bool isContinuous(int colNumber) const;
417 
423  bool isInteger(int columnNumber) const;
424 
430  const char * integerColumns() const;
431 
436  const char * rowName(int index) const;
437 
442  const char * columnName(int index) const;
443 
450  int rowIndex(const char * name) const;
451 
456  int columnIndex(const char * name) const;
457 
462  double objectiveOffset() const;
464  inline void setObjectiveOffset(double value)
465  { objectiveOffset_=value;}
466 
468  const char * getProblemName() const;
469 
471  const char * getObjectiveName() const;
472 
474  const char * getRhsName() const;
475 
477  const char * getRangeName() const;
478 
480  const char * getBoundName() const;
482  inline int numberStringElements() const
483  { return numberStringElements_;}
485  inline const char * stringElement(int i) const
486  { return stringElements_[i];}
488 
489 
495 
497  void setMpsData(const CoinPackedMatrix& m, const double infinity,
498  const double* collb, const double* colub,
499  const double* obj, const char* integrality,
500  const double* rowlb, const double* rowub,
501  char const * const * const colnames,
502  char const * const * const rownames);
503  void setMpsData(const CoinPackedMatrix& m, const double infinity,
504  const double* collb, const double* colub,
505  const double* obj, const char* integrality,
506  const double* rowlb, const double* rowub,
507  const std::vector<std::string> & colnames,
508  const std::vector<std::string> & rownames);
509  void setMpsData(const CoinPackedMatrix& m, const double infinity,
510  const double* collb, const double* colub,
511  const double* obj, const char* integrality,
512  const char* rowsen, const double* rowrhs,
513  const double* rowrng,
514  char const * const * const colnames,
515  char const * const * const rownames);
516  void setMpsData(const CoinPackedMatrix& m, const double infinity,
517  const double* collb, const double* colub,
518  const double* obj, const char* integrality,
519  const char* rowsen, const double* rowrhs,
520  const double* rowrng,
521  const std::vector<std::string> & colnames,
522  const std::vector<std::string> & rownames);
523 
529  void copyInIntegerInformation(const char * integerInformation);
530 
532  void setProblemName(const char *name) ;
533 
535  void setObjectiveName(const char *name) ;
536 
538 
545  void setInfinity(double value);
547 
549  double getInfinity() const;
550 
552  void setDefaultBound(int value);
553 
555  int getDefaultBound() const;
557  inline int allowStringElements() const
558  { return allowStringElements_;}
560  inline void setAllowStringElements(int yesNo)
561  { allowStringElements_ = yesNo;}
564  inline double getSmallElementValue() const
565  { return smallElement_;}
566  inline void setSmallElementValue(double value)
567  { smallElement_=value;}
569 
570 
589  void setFileName(const char * name);
591 
593  const char * getFileName() const;
594 
599  int readMps(const char *filename, const char *extension = "mps");
600 
606  int readMps(const char *filename, const char *extension ,
607  int & numberSets, CoinSet **& sets);
608 
619  int readMps();
621  int readMps(int & numberSets, CoinSet **& sets);
631  int readBasis(const char *filename, const char *extension ,
632  double * solution, unsigned char *rowStatus, unsigned char *columnStatus,
633  const std::vector<std::string> & colnames,int numberColumns,
634  const std::vector<std::string> & rownames, int numberRows);
635 
641  int readGms(const char *filename, const char *extension = "gms",bool convertObjective=false);
642 
648  int readGms(const char *filename, const char *extension ,
649  int & numberSets, CoinSet **& sets);
650 
657  // Not for now int readGms();
659  int readGms(int & numberSets, CoinSet **& sets);
662  int readGMPL(const char *modelName, const char * dataName=NULL, bool keepNames=false);
663 
689  int writeMps(const char *filename, int compression = 0,
690  int formatType = 0, int numberAcross = 2,
691  CoinPackedMatrix * quadratic = NULL,
692  int numberSOS=0,const CoinSet * setInfo=NULL) const;
693 
695  inline const CoinMpsCardReader * reader() const
696  { return cardReader_;}
697 
725  int readQuadraticMps(const char * filename,
726  int * &columnStart, int * &column, double * &elements,
727  int checkSymmetry);
728 
746  int readConicMps(const char * filename,
747  int * &columnStart, int * &column, int & numberCones);
749  inline void setConvertObjective(bool trueFalse)
750  { convertObjective_=trueFalse;}
752  int copyStringElements(const CoinModel * model);
754 
757  CoinMpsIO();
759 
761  CoinMpsIO (const CoinMpsIO &);
762 
764  CoinMpsIO & operator=(const CoinMpsIO& rhs);
765 
767  ~CoinMpsIO ();
769 
770 
779 
781  void newLanguage(CoinMessages::Language language);
782 
784  void setLanguage(CoinMessages::Language language) {newLanguage(language);}
785 
788 
794 
795 
807 
809  void releaseRowInformation();
810 
813 
816 
818  void releaseRowNames();
819 
821  void releaseColumnNames();
822 
826 
827 protected:
828 
831 
833  void
835  const CoinPackedMatrix& m, const double infinity,
836  const double* collb, const double* colub,
837  const double* obj, const char* integrality,
838  const double* rowlb, const double* rowub);
839  void
841  const std::vector<std::string> & colnames,
842  const std::vector<std::string> & rownames);
843  void
845  char const * const * const colnames,
846  char const * const * const rownames);
847 
848 
850  void gutsOfDestructor();
851 
853  void gutsOfCopy(const CoinMpsIO &);
854 
856  void freeAll();
857 
858 
861  inline void
862  convertBoundToSense(const double lower, const double upper,
863  char& sense, double& right, double& range) const;
866  inline void
867  convertSenseToBound(const char sense, const double right,
868  const double range,
869  double& lower, double& upper) const;
870 
883  int dealWithFileName(const char * filename, const char * extension,
884  CoinFileInput * &input);
889  void addString(int iRow,int iColumn, const char * value);
891  void decodeString(int iString, int & iRow, int & iColumn, const char * & value) const;
893 
894 
895  // for hashing
896  typedef struct {
897  int index, next;
898  } CoinHashLink;
899 
902  void startHash ( char **names, const int number , int section );
905  void startHash ( int section ) const;
907  void stopHash ( int section );
909  int findHash ( const char *name , int section ) const;
911 
914  char * problemName_;
916 
919 
921  char * rhsName_;
922 
924  char * rangeName_;
925 
927  char * boundName_;
928 
931 
934 
937 
939  mutable char *rowsense_;
940 
942  mutable double *rhs_;
943 
947  mutable double *rowrange_;
948 
951 
954 
956  double * rowlower_;
957 
959  double * rowupper_;
960 
962  double * collower_;
963 
965  double * colupper_;
966 
968  double * objective_;
969 
972 
973 
977  char * integerType_;
978 
982  char **names_[2];
984 
987  char * fileName_;
989 
991  int numberHash_[2];
992 
994  mutable CoinHashLink *hash_[2];
996 
999  int defaultBound_;
1001 
1003  double infinity_;
1006 
1030 
1031 };
1032 
1033 //#############################################################################
1041 void
1042 CoinMpsIOUnitTest(const std::string & mpsDir);
1043 // Function to return number in most efficient way
1044 // section is 0 for columns, 1 for rhs,ranges and 2 for bounds
1045 /* formatType is
1046  0 - normal and 8 character names
1047  1 - extra accuracy
1048  2 - IEEE hex - INTEL
1049  3 - IEEE hex - not INTEL
1050 */
1051 void
1052 CoinConvertDouble(int section, int formatType, double value, char outputValue[24]);
1053 
1054 #endif
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:39
void stopHash(int section)
Deletes hash storage.
CoinSet()
Default constructor.
char * fileName_
Current file name.
Definition: CoinMpsIO.hpp:988
int allowStringElements() const
Whether to allow string elements.
Definition: CoinMpsIO.hpp:557
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:187
CoinMpsIO()
Default Constructor.
char * getPosition() const
get position (again so gms reader will work)
Definition: CoinMpsIO.hpp:144
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
Definition: CoinModel.hpp:149
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:193
char ** names_[2]
Row and column names Linked to hash table sections (0 - row names, 1 column names) ...
Definition: CoinMpsIO.hpp:982
COINSectionType
Definition: CoinMpsIO.hpp:41
double * collower_
Pointer to dense vector of column lower bounds.
Definition: CoinMpsIO.hpp:962
Base class for message handling.
int COINColumnIndex
The following lengths are in decreasing order (for 64 bit etc) Large enough to contain element index ...
Definition: CoinMpsIO.hpp:19
const char * getRangeName() const
Return the range vector name.
int defaultBound_
Upper bound when no bounds for integers.
Definition: CoinMpsIO.hpp:1000
int maximumStringElements_
Maximum number of string elements.
Definition: CoinMpsIO.hpp:1024
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:167
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:133
const char * integerColumns() const
Returns array[getNumCols()] specifying if a variable is integer.
int numberEntries() const
Returns number of entries.
Definition: CoinMpsIO.hpp:247
const char * stringElement(int i) const
String element.
Definition: CoinMpsIO.hpp:485
const char * getFileName() const
Get the current file name for the CoinMpsIO object.
char * objectiveName_
Objective row name.
Definition: CoinMpsIO.hpp:918
char * rhsName_
Right-hand side vector name.
Definition: CoinMpsIO.hpp:921
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:256
double * rowrange_
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range...
Definition: CoinMpsIO.hpp:947
const int * which() const
Returns list of variables.
Definition: CoinMpsIO.hpp:253
double value() const
Returns value in current field.
Definition: CoinMpsIO.hpp:125
void setAllowStringElements(int yesNo)
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
Definition: CoinMpsIO.hpp:560
bool freeFormat() const
Sees if free format.
Definition: CoinMpsIO.hpp:104
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:100
const char * rowName() const
Returns row name of current field.
Definition: CoinMpsIO.hpp:117
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:181
void setLanguage(CoinMessages::Language language)
Set the language for messages.
Definition: CoinMpsIO.hpp:784
void setObjectiveOffset(double value)
Set objective offset.
Definition: CoinMpsIO.hpp:464
Sparse Matrix Base Class.
COINSectionType whichSection() const
Returns current section type.
Definition: CoinMpsIO.hpp:96
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:175
char ** stringElements_
String elements.
Definition: CoinMpsIO.hpp:1028
int allowStringElements_
Whether to allow string elements.
Definition: CoinMpsIO.hpp:1022
CoinMessageHandler * handler_
Message handler.
Definition: CoinMpsIO.hpp:1008
COINSectionType readToNextSection()
Read to next section.
int numberRows_
Number of rows.
Definition: CoinMpsIO.hpp:930
bool defaultHandler_
Flag to say if the message handler is the default handler.
Definition: CoinMpsIO.hpp:1014
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:971
const char * columnName() const
Returns column name of current field.
Definition: CoinMpsIO.hpp:121
CoinFileInput * input_
File input.
Definition: CoinMpsIO.hpp:179
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:151
char valueString_[COIN_MAX_FIELD_LENGTH]
Current element as characters (only if strings allowed)
Definition: CoinMpsIO.hpp:197
double * weights_
Weights.
Definition: CoinMpsIO.hpp:281
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:924
COINMpsType mpsType() const
Only for first field on card otherwise BLANK_COLUMN e.g.
Definition: CoinMpsIO.hpp:111
double getInfinity() const
Get infinity.
double smallElement_
Small element value.
Definition: CoinMpsIO.hpp:1005
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: CoinMpsIO.hpp:939
int setType_
type of set
Definition: CoinMpsIO.hpp:277
#define COIN_MAX_FIELD_LENGTH
Definition: CoinMpsIO.hpp:37
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:927
int nextGmsField(int expectedType)
Gets next field for .gms file and returns type.
CoinBigIndex cardNumber() const
Returns card number.
Definition: CoinMpsIO.hpp:147
Very simple class for containing data on set.
Definition: CoinMpsIO.hpp:222
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:790
CoinBigIndex numberElements_
Number of coefficients.
Definition: CoinMpsIO.hpp:936
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:250
CoinMessageHandler * messageHandler() const
Return the message handler.
Definition: CoinMpsIO.hpp:787
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:287
void setStringsAllowed()
Sets whether strings allowed.
Definition: CoinMpsIO.hpp:155
bool isInteger(int columnNumber) const
Return true if a column is an integer variable.
CoinMpsIO * reader_
MpsIO.
Definition: CoinMpsIO.hpp:191
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:953
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
Abstract base class for file input classes.
Definition: CoinFileIO.hpp:35
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:177
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:1016
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:199
CoinMessages * messagesPointer()
Return the messages pointer.
Definition: CoinMpsIO.hpp:792
bool eightChar_
If all names <= 8 characters then allow embedded blanks.
Definition: CoinMpsIO.hpp:189
double * rowupper_
Pointer to dense vector of row upper bounds.
Definition: CoinMpsIO.hpp:959
char * mutableCard()
Whole card - so we look at it (not const so nextBlankOr will work for gms reader) ...
Definition: CoinMpsIO.hpp:137
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:977
bool convertObjective_
If .gms file should it be massaged to move objective.
Definition: CoinMpsIO.hpp:1020
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:165
int getNumRows() const
Get number of rows.
int numberStringElements_
Number of string elements.
Definition: CoinMpsIO.hpp:1026
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:942
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:933
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:141
void setFreeFormat(bool yesNo)
Sets whether free format. Mainly for blank RHS etc.
Definition: CoinMpsIO.hpp:107
CoinBigIndex cardNumber_
Card number.
Definition: CoinMpsIO.hpp:183
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler.
int readConicMps(const char *filename, int *&columnStart, int *&column, int &numberCones)
Read in a list of cones from the given filename.
CoinMessages messages_
Messages.
Definition: CoinMpsIO.hpp:195
Very simple code for reading MPS data.
Definition: CoinMpsIO.hpp:60
int * which_
Which variables are in set.
Definition: CoinMpsIO.hpp:279
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:564
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:991
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:968
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:695
CoinHashLink * hash_[2]
Hash tables (two sections, 0 - row names, 1 - column names)
Definition: CoinMpsIO.hpp:994
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:32
char * problemName_
Problem name.
Definition: CoinMpsIO.hpp:915
void decodeString(int iString, int &iRow, int &iColumn, const char *&value) const
Decode string.
double infinity_
Value to use for infinity.
Definition: CoinMpsIO.hpp:1003
void setProblemName(const char *name)
Set problem name.
void setSmallElementValue(double value)
Set infinity.
Definition: CoinMpsIO.hpp:566
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of the coefficient matrix.
int numberEntries_
Number of entries.
Definition: CoinMpsIO.hpp:275
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:49
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: CoinMpsIO.hpp:956
char * position_
Current position within card image.
Definition: CoinMpsIO.hpp:169
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'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:965
bool freeFormat_
Whether free format. Just for blank RHS etc.
Definition: CoinMpsIO.hpp:185
static char * nextBlankOr(char *image)
type - 0 normal, 1 INTEL IEEE, 2 other IEEE
char * eol_
End of card.
Definition: CoinMpsIO.hpp:171
virtual ~CoinSosSet()
Destructor.
const char * valueString() const
Returns value as string in current field.
Definition: CoinMpsIO.hpp:129
Language
Supported languages.
void releaseMatrixInformation()
Release matrix information.
int numberStringElements() const
Number of string elements.
Definition: CoinMpsIO.hpp:482
COINMpsType mpsType_
Current COINMpsType.
Definition: CoinMpsIO.hpp:173
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:1018
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:950
MPS IO Interface.
Definition: CoinMpsIO.hpp:330
void setConvertObjective(bool trueFalse)
Set whether to move objective from matrix.
Definition: CoinMpsIO.hpp:749
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.