11 #pragma warning(disable : 4786) 34 #ifndef COIN_MAX_FIELD_LENGTH 35 #define COIN_MAX_FIELD_LENGTH 160 37 #define MAX_CARD_LENGTH 5 * COIN_MAX_FIELD_LENGTH + 80 172 inline const char *
card()
const 252 double osi_strtod(
char *ptr,
char **output,
int type);
277 CoinSet(
int numberEntries,
const int *which);
291 inline int numberEntries()
const 294 return numberEntries_;
299 numberEntries_ = number;
336 virtual SbbObject *sbbObject(SbbModel *model)
const 366 CoinSosSet(
int numberEntries,
const int *which,
const double *weights,
int type);
376 virtual SbbObject *sbbObject(SbbModel *model)
const;
416 int getNumCols()
const;
420 int getNumRows()
const;
426 const double *getColLower()
const;
429 const double *getColUpper()
const;
440 const char *getRowSense()
const;
453 const double *getRightHandSide()
const;
468 const double *getRowRange()
const;
471 const double *getRowLower()
const;
474 const double *getRowUpper()
const;
477 const double *getObjCoefficients()
const;
486 bool isContinuous(
int colNumber)
const;
493 bool isInteger(
int columnNumber)
const;
500 int isIntegerOrSemiContinuous(
int columnNumber)
const;
507 const char *integerColumns()
const;
513 const char *
rowName(
int index)
const;
527 int rowIndex(
const char *name)
const;
533 int columnIndex(
const char *name)
const;
539 double objectiveOffset()
const;
543 objectiveOffset_ =
value;
547 const char *getProblemName()
const;
550 const char *getObjectiveName()
const;
553 const char *getRhsName()
const;
556 const char *getRangeName()
const;
559 const char *getBoundName()
const;
563 return numberStringElements_;
568 return stringElements_[i];
580 const double *collb,
const double *colub,
581 const double *obj,
const char *integrality,
582 const double *rowlb,
const double *rowub,
583 char const *
const *
const colnames,
584 char const *
const *
const rownames);
586 const double *collb,
const double *colub,
587 const double *obj,
const char *integrality,
588 const double *rowlb,
const double *rowub,
589 const std::vector< std::string > &colnames,
590 const std::vector< std::string > &rownames);
592 const double *collb,
const double *colub,
593 const double *obj,
const char *integrality,
594 const char *rowsen,
const double *rowrhs,
595 const double *rowrng,
596 char const *
const *
const colnames,
597 char const *
const *
const rownames);
599 const double *collb,
const double *colub,
600 const double *obj,
const char *integrality,
601 const char *rowsen,
const double *rowrhs,
602 const double *rowrng,
603 const std::vector< std::string > &colnames,
604 const std::vector< std::string > &rownames);
611 void copyInIntegerInformation(
const char *integerInformation);
614 void setProblemName(
const char *name);
617 void setObjectiveName(
const char *name);
627 void setInfinity(
double value);
631 double getInfinity()
const;
634 void setDefaultBound(
int value);
637 int getDefaultBound()
const;
641 return allowStringElements_;
646 allowStringElements_ = yesNo;
652 return smallElement_;
656 smallElement_ =
value;
678 void setFileName(
const char *name);
682 const char *getFileName()
const;
688 int readMps(
const char *filename,
const char *extension =
"mps");
695 int readMps(
const char *filename,
const char *extension,
696 int &numberSets,
CoinSet **&sets);
710 int readMps(
int &numberSets,
CoinSet **&sets);
720 int readBasis(
const char *filename,
const char *extension,
721 double *solution,
unsigned char *rowStatus,
unsigned char *columnStatus,
722 const std::vector< std::string > &colnames,
int numberColumns,
723 const std::vector< std::string > &rownames,
int numberRows);
730 int readGms(
const char *filename,
const char *extension =
"gms",
bool convertObjective =
false);
737 int readGms(
const char *filename,
const char *extension,
738 int &numberSets,
CoinSet **&sets);
748 int readGms(
int &numberSets,
CoinSet **&sets);
751 int readGMPL(
const char *modelName,
const char *dataName = NULL,
bool keepNames =
false);
778 int writeMps(
const char *filename,
int compression = 0,
779 int formatType = 0,
int numberAcross = 2,
781 int numberSOS = 0,
const CoinSet *setInfo = NULL)
const;
816 int readQuadraticMps(
const char *filename,
817 CoinBigIndex *&columnStart,
int *&column,
double *&elements,
839 int readConicMps(
const char *filename,
840 int *&columnStart,
int *&column,
int *&coneType,
int &numberCones);
844 convertObjective_ = trueFalse;
847 int copyStringElements(
const CoinModel *model);
899 void releaseRedundantInformation();
902 void releaseRowInformation();
905 void releaseColumnInformation();
908 void releaseIntegerInformation();
911 void releaseRowNames();
914 void releaseColumnNames();
917 void releaseMatrixInformation();
926 setMpsDataWithoutRowAndColNames(
928 const double *collb,
const double *colub,
929 const double *obj,
const char *integrality,
930 const double *rowlb,
const double *rowub);
932 setMpsDataColAndRowNames(
933 const std::vector< std::string > &colnames,
934 const std::vector< std::string > &rownames);
936 setMpsDataColAndRowNames(
937 char const *
const *
const colnames,
938 char const *
const *
const rownames);
941 void gutsOfDestructor();
952 convertBoundToSense(
const double lower,
const double upper,
953 char &sense,
double &right,
double &range)
const;
957 convertSenseToBound(
const char sense,
const double right,
959 double &lower,
double &upper)
const;
973 int dealWithFileName(
const char *filename,
const char *extension,
979 void addString(
int iRow,
int iColumn,
const char *value);
981 void decodeString(
int iString,
int &iRow,
int &iColumn,
const char *&value)
const;
991 void startHash(
char **names,
const int number,
int section);
994 void startHash(
int section)
const;
996 void stopHash(
int section);
998 int findHash(
const char *name,
int section)
const;
int COINColumnIndex
The following lengths are in decreasing order (for 64 bit etc) Large enough to contain element index ...
int ieeeFormat_
Whether IEEE - 0 no, 1 INTEL, 2 not INTEL.
int numberStringElements_
Number of string elements.
static void strcpyAndCompress(char *to, const char *from)
remove blanks
double infinity_
Value to use for infinity.
void setWhichSection(COINSectionType section)
Sets current section type.
int allowStringElements() const
Whether to allow string elements.
CoinMessages * messagesPointer()
Return the messages pointer.
CoinMessageHandler * handler_
Message handler.
void setPosition(char *position)
set position (again so gms reader will work)
void setSetType(int type)
Sets type of set - 1 =SOS1, 2 =SOS2.
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
const char * columnName() const
Returns column name of current field.
const char * valueString() const
Returns value as string in current field.
void CoinConvertDouble(int section, int formatType, double value, char outputValue[24])
void setNumberEntries(int number)
Sets number of entries.
double getSmallElementValue() const
Small element value - elements less than this set to zero on input default is 1.0e-14.
void setSmallElementValue(double value)
char * rowsense_
Pointer to dense vector of row sense indicators.
char valueString_[COIN_MAX_FIELD_LENGTH]
Current element as characters (only if strings allowed)
bool defaultHandler_
Flag to say if the message handler is the default handler.
int allowStringElements_
Whether to allow string elements.
CoinFileInput * input_
File input.
This is a simple minded model which is stored in a format which makes it easier to construct and modi...
void setConvertObjective(bool trueFalse)
Set whether to move objective from matrix.
bool freeFormat() const
Sees if free format.
CoinMpsCardReader(CoinFileInput *input, CoinMpsIO *reader)
Constructor expects file to be open This one takes gzFile if fp null.
CoinMessageHandler * messageHandler() const
Return the message handler.
bool freeFormat_
Whether free format. Just for blank RHS etc.
COINSectionType whichSection() const
Returns current section type.
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
Base class for message handling.
char * getPosition() const
get position (again so gms reader will work)
COINSectionType section_
Which section we think we are in.
const double * weights() const
Returns weights.
const int * which() const
Returns list of variables.
double * rowlower_
Pointer to dense vector of row lower bounds.
void setFreeFormat(bool yesNo)
Sets whether free format. Mainly for blank RHS etc.
CoinMpsIO * reader_
MpsIO.
double * objective_
Pointer to dense vector of objective coefficients.
CoinMpsCardReader * cardReader_
Card reader.
double * rhs_
Pointer to dense vector of row right-hand side values.
bool stringsAllowed_
Whether strings allowed.
This is a first attempt at a message handler.
double * colupper_
Pointer to dense vector of column upper bounds.
double osi_strtod(char *ptr, char **output, int type)
type - 0 normal, 1 INTEL IEEE, 2 other IEEE
Very simple class for containing SOS set.
CoinBigIndex numberElements_
Number of coefficients.
char * objectiveName_
Objective row name.
double value() const
Returns value in current field.
COINMpsType mpsType_
Current COINMpsType.
#define COIN_MAX_FIELD_LENGTH
int * which_
Which variables are in set.
CoinFileInput * fileInput() const
Returns file input.
bool convertObjective_
If .gms file should it be massaged to move objective.
const CoinMpsCardReader * reader() const
Return card reader object so can see what last card was e.g. QUADOBJ.
int maximumStringElements_
Maximum number of string elements.
void setLanguage(CoinMessages::Language language)
Set the language for messages.
void CoinMpsIOUnitTest(const std::string &mpsDir)
A function that tests the methods in the CoinMpsIO class.
char * position_
Current position within card image.
int cleanCard()
Reads and cleans card - taking out trailing blanks - return 1 if EOF.
CoinMessages messages_
Messages.
bool eightChar_
If all names <= 8 characters then allow embedded blanks.
int setType() const
Returns type of set - 1 =SOS1, 2 =SOS2.
double objectiveOffset_
Constant offset for objective value (i.e., RHS value for OBJ row)
double * collower_
Pointer to dense vector of column lower bounds.
Sparse Matrix Base Class.
Very simple code for reading MPS data.
double * rowrange_
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range...
const char * rowName() const
Returns row name of current field.
char * rhsName_
Right-hand side vector name.
int nextGmsField(int expectedType)
Gets next field for .gms file and returns type.
void setAllowStringElements(int yesNo)
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
int COINRowIndex
Large enough to contain row index (or basis)
Language
Supported languages.
double * weights_
Weights.
const char * stringElement(int i) const
String element.
COINSectionType readToNextSection()
Read to next section.
char * mutableCard()
Whole card - so we look at it (not const so nextBlankOr will work for gms reader) ...
char card_[MAX_CARD_LENGTH]
Current card image.
double smallElement_
Small element value.
double * rowupper_
Pointer to dense vector of row upper bounds.
char * rangeName_
Range vector name.
char rowName_[COIN_MAX_FIELD_LENGTH]
Current row name.
int numberStringElements() const
Number of string elements.
CoinMessageHandler * handler_
Message handler.
CoinBigIndex cardNumber() const
Returns card number.
int numberColumns_
Number of columns.
COINSectionType nextField()
Gets next field and returns section type e.g. COIN_COLUMN_SECTION.
void setObjectiveOffset(double value)
Set objective offset.
double value_
Current value.
static char * nextBlankOr(char *image)
void setStringsAllowed()
Sets whether strings allowed.
CoinMessages messages()
Return the messages.
char * boundName_
Bounds vector name.
char columnName_[COIN_MAX_FIELD_LENGTH]
Current column name.
double * modifiableWeights() const
Returns modifiable weights.
CoinMessages messages_
Messages.
int numberRows_
Number of rows.
int * modifiableWhich() const
Returns modifiable list of variables.
CoinBigIndex cardNumber_
Card number.
~CoinMpsCardReader()
Destructor.
COINMpsType mpsType() const
Only for first field on card otherwise BLANK_COLUMN e.g.
Class to hold and manipulate an array of massaged messages.
Very simple class for containing data on set.
char ** stringElements_
String elements.
const char * card() const
Whole card (for printing)