Osi 0.107.10

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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