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 132 inline const char *
card ( )
const {
203 double osi_strtod(
char * ptr,
char ** output,
int type);
210 double osi_strtod(
char * ptr,
char ** output);
230 CoinSet (
int numberEntries,
const int * which);
245 inline int numberEntries ( )
const 247 {
return numberEntries_; }
262 virtual SbbObject * sbbObject(SbbModel * model)
const 292 CoinSosSet (
int numberEntries,
const int * which,
const double * weights,
int type);
303 virtual SbbObject * sbbObject(SbbModel * model)
const ;
345 int getNumCols()
const;
349 int getNumRows()
const;
352 int getNumElements()
const;
355 const double * getColLower()
const;
358 const double * getColUpper()
const;
369 const char * getRowSense()
const;
382 const double * getRightHandSide()
const;
397 const double * getRowRange()
const;
400 const double * getRowLower()
const;
403 const double * getRowUpper()
const;
406 const double * getObjCoefficients()
const;
415 bool isContinuous(
int colNumber)
const;
422 bool isInteger(
int columnNumber)
const;
429 const char * integerColumns()
const;
435 const char *
rowName(
int index)
const;
449 int rowIndex(
const char * name)
const;
455 int columnIndex(
const char * name)
const;
461 double objectiveOffset()
const;
464 { objectiveOffset_=
value;}
467 const char * getProblemName()
const;
470 const char * getObjectiveName()
const;
473 const char * getRhsName()
const;
476 const char * getRangeName()
const;
479 const char * getBoundName()
const;
482 {
return numberStringElements_;}
485 {
return stringElements_[i];}
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);
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);
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);
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);
528 void copyInIntegerInformation(
const char * integerInformation);
531 void setProblemName(
const char *name) ;
534 void setObjectiveName(
const char *name) ;
544 void setInfinity(
double value);
548 double getInfinity()
const;
551 void setDefaultBound(
int value);
554 int getDefaultBound()
const;
557 {
return allowStringElements_;}
560 { allowStringElements_ = yesNo;}
564 {
return smallElement_;}
566 { smallElement_=
value;}
588 void setFileName(
const char * name);
592 const char * getFileName()
const;
598 int readMps(
const char *filename,
const char *extension =
"mps");
605 int readMps(
const char *filename,
const char *extension ,
606 int & numberSets,
CoinSet **& sets);
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);
640 int readGms(
const char *filename,
const char *extension =
"gms",
bool convertObjective=
false);
647 int readGms(
const char *filename,
const char *extension ,
648 int & numberSets,
CoinSet **& sets);
658 int readGms(
int & numberSets,
CoinSet **& sets);
661 int readGMPL(
const char *modelName,
const char * dataName=NULL,
bool keepNames=
false);
688 int writeMps(
const char *filename,
int compression = 0,
689 int formatType = 0,
int numberAcross = 2,
691 int numberSOS=0,
const CoinSet * setInfo=NULL)
const;
695 {
return cardReader_;}
724 int readQuadraticMps(
const char * filename,
725 int * &columnStart,
int * &column,
double * &elements,
747 int readConicMps(
const char * filename,
748 int * &columnStart,
int * &column,
int * &coneType,
int & numberCones);
751 { convertObjective_=trueFalse;}
753 int copyStringElements(
const CoinModel * model);
807 void releaseRedundantInformation();
810 void releaseRowInformation();
813 void releaseColumnInformation();
816 void releaseIntegerInformation();
819 void releaseRowNames();
822 void releaseColumnNames();
825 void releaseMatrixInformation();
835 setMpsDataWithoutRowAndColNames(
837 const double* collb,
const double* colub,
838 const double* obj,
const char* integrality,
839 const double* rowlb,
const double* rowub);
841 setMpsDataColAndRowNames(
842 const std::vector<std::string> & colnames,
843 const std::vector<std::string> & rownames);
845 setMpsDataColAndRowNames(
846 char const *
const *
const colnames,
847 char const *
const *
const rownames);
851 void gutsOfDestructor();
863 convertBoundToSense(
const double lower,
const double upper,
864 char& sense,
double& right,
double& range)
const;
868 convertSenseToBound(
const char sense,
const double right,
870 double& lower,
double& upper)
const;
884 int dealWithFileName(
const char * filename,
const char * extension,
890 void addString(
int iRow,
int iColumn,
const char * value);
892 void decodeString(
int iString,
int & iRow,
int & iColumn,
const char * & value)
const;
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;
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)
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])
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.
CoinMessages messages_
Messages.
int numberRows_
Number of rows.
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)