Osi 0.107.7

- 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 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
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 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
779 void passInMessageHandler(CoinMessageHandler * handler);
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
807 void releaseRedundantInformation();
808
810 void releaseRowInformation();
811
813 void releaseColumnInformation();
814
816 void releaseIntegerInformation();
817
819 void releaseRowNames();
820
822 void releaseColumnNames();
823
825 void releaseMatrixInformation();
827
828 protected:
829
832
834 void
835 setMpsDataWithoutRowAndColNames(
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
841 setMpsDataColAndRowNames(
842 const std::vector<std::string> & colnames,
843 const std::vector<std::string> & rownames);
844 void
845 setMpsDataColAndRowNames(
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
919 char * objectiveName_;
920
922 char * rhsName_;
923
925 char * rangeName_;
926
928 char * boundName_;
929
931 int numberRows_;
932
934 int numberColumns_;
935
937 CoinBigIndex numberElements_;
938
940 mutable char *rowsense_;
941
943 mutable double *rhs_;
944
948 mutable double *rowrange_;
949
951 mutable CoinPackedMatrix *matrixByRow_;
952
954 CoinPackedMatrix *matrixByColumn_;
955
957 double * rowlower_;
958
960 double * rowupper_;
961
963 double * collower_;
964
966 double * colupper_;
967
969 double * objective_;
970
972 double objectiveOffset_;
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_;
1006 double smallElement_;
1007
1009 CoinMessageHandler * handler_;
1015 bool defaultHandler_;
1017 CoinMessages messages_;
1019 CoinMpsCardReader * cardReader_;
1021 bool convertObjective_;
1023 int allowStringElements_;
1025 int maximumStringElements_;
1027 int numberStringElements_;
1029 char ** stringElements_;
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
CoinMpsIO::getFileName
const char * getFileName() const
Get the current file name for the CoinMpsIO object.
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:1027
CoinMpsCardReader::strcpyAndCompress
static void strcpyAndCompress(char *to, const char *from)
remove blanks
CoinMpsIO::infinity_
double infinity_
Value to use for infinity.
Definition: CoinMpsIO.hpp:1004
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::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:793
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:563
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:978
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])
COIN_XL_BASIS
Definition: CoinMpsIO.hpp:54
COIN_RANGES_SECTION
Definition: CoinMpsIO.hpp:41
CoinMpsIO::setSmallElementValue
void setSmallElementValue(double value)
Definition: CoinMpsIO.hpp:565
CoinMpsIO::CoinHashLink::next
int next
Definition: CoinMpsIO.hpp:898
CoinMpsIO::rowsense_
char * rowsense_
Pointer to dense vector of row sense indicators.
Definition: CoinMpsIO.hpp:940
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:1015
CoinSet::CoinSet
CoinSet()
Default constructor.
CoinMpsIO::allowStringElements_
int allowStringElements_
Whether to allow string elements.
Definition: CoinMpsIO.hpp:1023
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:750
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:989
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:954
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:255
CoinMpsIO::numberHash_
int numberHash_[2]
Number of entries in a hash table section.
Definition: CoinMpsIO.hpp:992
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:788
CoinMpsIO::rowlower_
double * rowlower_
Pointer to dense vector of row lower bounds.
Definition: CoinMpsIO.hpp:957
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:983
CoinMpsIO::objective_
double * objective_
Pointer to dense vector of objective coefficients.
Definition: CoinMpsIO.hpp:969
CoinMpsIO::copyStringElements
int copyStringElements(const CoinModel *model)
copies in strings from a CoinModel - returns number
CoinMpsIO::cardReader_
CoinMpsCardReader * cardReader_
Card reader.
Definition: CoinMpsIO.hpp:1019
COIN_BS_BASIS
Definition: CoinMpsIO.hpp:54
CoinMpsIO::rhs_
double * rhs_
Pointer to dense vector of row right-hand side values.
Definition: CoinMpsIO.hpp:943
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:966
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:1001
CoinSosSet
Very simple class for containing SOS set.
Definition: CoinMpsIO.hpp:286
CoinMpsIO::newLanguage
void newLanguage(CoinMessages::Language language)
Set the language for messages.
CoinMpsIO::numberElements_
CoinBigIndex numberElements_
Number of coefficients.
Definition: CoinMpsIO.hpp:937
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:274
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:252
CoinMpsIO::objectiveName_
char * objectiveName_
Objective row name.
Definition: CoinMpsIO.hpp:919
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:278
CoinMpsIO
MPS IO Interface.
Definition: CoinMpsIO.hpp:329
CoinMpsIO::hash_
CoinHashLink * hash_[2]
Hash tables (two sections, 0 - row names, 1 - column names)
Definition: CoinMpsIO.hpp:995
CoinMpsIO::convertObjective_
bool convertObjective_
If .gms file should it be massaged to move objective.
Definition: CoinMpsIO.hpp:1021
CoinFileIO.hpp
CoinSet::setType
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
Definition: CoinMpsIO.hpp:249
COIN_E_ROW
Definition: CoinMpsIO.hpp:47
CoinMpsIO::numberStringElements
int numberStringElements() const
Number of string elements.
Definition: CoinMpsIO.hpp:481
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:1025
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:694
CoinMpsIO::setLanguage
void setLanguage(CoinMessages::Language language)
Set the language for messages.
Definition: CoinMpsIO.hpp:785
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:1017
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:972
CoinSet::setType_
int setType_
type of set
Definition: CoinMpsIO.hpp:276
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:963
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:948
CoinMpsCardReader::fileInput
CoinFileInput * fileInput() const
Returns file input.
Definition: CoinMpsIO.hpp:150
CoinMpsIO::rhsName_
char * rhsName_
Right-hand side vector name.
Definition: CoinMpsIO.hpp:922
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:559
CoinMpsIO::matrixByRow_
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
Definition: CoinMpsIO.hpp:951
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:280
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:1006
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:960
CoinMpsIO::rangeName_
char * rangeName_
Range vector name.
Definition: CoinMpsIO.hpp:925
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:1009
CoinMpsIO::numberColumns_
int numberColumns_
Number of columns.
Definition: CoinMpsIO.hpp:934
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:556
CoinMpsIO::setObjectiveOffset
void setObjectiveOffset(double value)
Set objective offset.
Definition: CoinMpsIO.hpp:463
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:897
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:791
CoinMpsIO::boundName_
char * boundName_
Bounds vector name.
Definition: CoinMpsIO.hpp:928
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:931
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:484
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:916
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:1029
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.