144 char &sense,
double &right,
double &range)
const;
241 int *card_prev)
const;
248 int *card_prev)
const;
352 const double *collb,
const double *colub,
353 const double *obj_coeff,
354 const char *integrality,
355 const double *rowlb,
const double *rowub);
359 const double *collb,
const double *colub,
362 const char *integrality,
363 const double *rowlb,
const double *rowub);
396 const int card_vnames,
397 const bool check_ranged)
const;
426 char const *
const *
const colnames);
443 const double epsilon,
444 const int numberAcross,
446 const bool useRowNames =
true);
463 const double epsilon,
464 const int numberAcross,
466 const bool useRowNames =
true);
470 int writeLp(
const char *filename,
const bool useRowNames =
true);
474 int writeLp(FILE *fp,
const bool useRowNames =
true);
480 void readLp(
const char *filename,
const double epsilon);
493 void readLp(FILE *fp,
const double epsilon);
779 char **obj_name,
int *num_objectives,
int *obj_starts);
786 int cnt_coeff)
const;
793 double **rowlow,
double **rowup,
int *maxrow)
const;
800 void read_row(
char *buff,
double **pcoeff,
char ***pcolNames,
801 int *cnt_coeff,
int *maxcoeff,
802 double *rhs,
double *rowlow,
double *rowup,
803 int *cnt_row,
double inf)
const;
void CoinLpIOUnitTest(const std::string &lpDir)
This file contains the enum for the standard set of Coin messages and a class definition whose sole p...
Class to read and write Lp files.
CoinBigIndex numberElements_
Number of elements.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
int is_comment(const char *buff) const
Return 1 if the first character of buff is '/' or '\'.
int rowIndex(const char *name) const
Return the index for the specified row name.
double objectiveOffset_[MAX_OBJECTIVES]
Constant offset for objective value.
int read_monom_row(char *start_str, double *coeff, char **name, int cnt_coeff) const
Read a monomial of a constraint.
char const *const * getRowNames() const
Get pointer to array[getNumRows()+1] of row names, including objective function name as last entry.
const double * getObjCoefficients(int j) const
Get pointer to array[getNumCols()] of objective function coefficients for objective j.
char * fileName_
Current file name.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
void setInfinity(const double)
Set infinity.
char inputBuffer_[1028]
Current buffer (needed so can get rid of blanks with :
bool isInteger(int columnNumber) const
Return true if a column is an integer (binary or general integer) variable.
int is_free(const char *buff) const
Return 1 if buff is the keyword "free" or one of its variants.
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of the coefficient matrix.
int numberSets_
Number of sets.
int read_monom_obj(double *coeff, char **name, int *cnt, char **obj_name, int *num_objectives, int *obj_starts)
Read a monomial of the objective function.
double * rowrange_
Pointer to dense vector of slack variable upper bounds for ranged constraints (undefined for non-rang...
int writeLp(const char *filename, const bool useRowNames=true)
Write the data in Lp format in the file with name filename.
void readLp(FILE *fp)
Read the data in Lp format from the file stream.
bool wasMaximization_
Maximization reformulation flag.
void setDefaultColNames()
Set column names to the default "x0", "x1", ...
void gutsOfCopy(const CoinLpIO &)
Does the heavy lifting for copy and assignment.
int is_keyword(const char *buff) const
Return an integer indicating if one of the keywords "Bounds", "Integers", "Generals",...
const char * getObjName(int j) const
Get objective function name for objective j.
int writeLp(FILE *fp, const double epsilon, const int numberAcross, const int decimals, const bool useRowNames=true)
Write the data in Lp format in the file pointed to by the paramater fp.
char * rowsense_
Pointer to dense vector of row senses.
CoinFileInput * input_
File handler.
int bufferLength_
Current buffer length (negative if not got eol)
double * rhs_
Pointer to dense vector of row rhs.
void startHash(char const *const *const names, const COINColumnIndex number, int section)
Build the hash table for the given names.
int bufferPosition_
Current buffer position.
COINColumnIndex findHash(const char *name, int section) const
Return the index of the given name, return -1 if the name is not found.
void setObjectiveOffset(double value, int j)
Set objective offset.
void setEpsilon(const double)
Set epsilon.
void checkColNames()
Check that current column names are distinct.
int writeLp(const char *filename, const double epsilon, const int numberAcross, const int decimals, const bool useRowNames=true)
Write the data in Lp format in the file with name filename.
bool defaultHandler_
Flag to say if the message handler is the default handler.
CoinMessages messages_
Messages.
char const *const * getColNames() const
Get pointer to array[getNumCols()] of column names.
const char * integerColumns() const
Get characteristic vector of integer variables.
void readLp(FILE *fp, const double epsilon)
Read the data in Lp format from the file stream, using the given value for epsilon.
void setLpDataWithoutRowAndColNames(const CoinPackedMatrix &m, const double *collb, const double *colub, const double *obj_coeff, const char *integrality, const double *rowlb, const double *rowub)
Set the data of the object.
int is_invalid_name(const char *buff, const bool ranged) const
Return 0 if buff is a valid name for a row, a column or objective function, return a positive number ...
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
int getNumCols() const
Get number of columns.
void insertHash(const char *thisName, int section)
Insert thisName in the hash table if not present yet; does nothing if the name is already in.
CoinHashLink * hash_[2]
Hash tables with two sections.
void setDecimals(const int)
Set decimals.
void readLp(const char *filename, const double epsilon)
Read the data in Lp format from the file with name filename, using the given value for epsilon.
char ** names_[2]
Row names (including objective function name) and column names (linked to Hash tables).
int writeLp(FILE *fp, const bool useRowNames=true)
Write the data in Lp format in the file pointed to by the parameter fp.
CoinSet ** set_
Pointer to sets.
double * colupper_
Pointer to dense vector of column upper bounds.
double * rowlower_
Pointer to dense vector of row lower bounds.
CoinMessageHandler * handler_
Message handler.
void newLanguage(CoinMessages::Language language)
Set the language for messages.
int num_objectives_
Number of objectives.
void loadSOS(int numberSets, const CoinSet *sets)
Load in SOS stuff.
double getInfinity() const
Get infinity.
void read_row(char *buff, double **pcoeff, char ***pcolNames, int *cnt_coeff, int *maxcoeff, double *rhs, double *rowlow, double *rowup, int *cnt_row, double inf) const
Read a constraint.
const char * getRowSense() const
Get pointer to array[getNumRows()] of constraint senses.
double getEpsilon() const
Get epsilon.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
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.
double infinity_
Value to use for infinity.
int fscanfLpIO(char *buff) const
Get next string (returns number in)
const char * rowName(int index) const
Return the row name for the specified index.
void realloc_coeff(double **coeff, char ***colNames, int *maxcoeff) const
Reallocate vectors related to number of coefficients.
void setObjectiveOffset(double value)
Set objective offset.
int is_sense(const char *buff) const
Return an integer indicating the inequality sense read.
int numberRows_
Number of rows.
int getNumRows() const
Get number of rows.
void getPreviousRowNames(char const *const *prev, int *card_prev) const
Get pointer to array[*card_prev] of previous row names.
void setProblemName(const char *name)
Set problem name.
int getDecimals() const
Get decimals, the number of digits to write after the decimal point.
int columnIndex(const char *name) const
Return the index for the specified column name.
friend void CoinLpIOUnitTest(const std::string &lpDir)
int numberColumns_
Number of columns.
CoinMessageHandler * messageHandler() const
Return the message handler.
CoinLpIO(const CoinLpIO &)
Copy constructor.
int is_subject_to(const char *buff) const
Return an integer indicating if the keyword "subject to" or one of its variants has been read.
void checkRowNames()
Check that current objective name and all row names are distinct including row names obtained by addi...
int is_inf(const char *buff) const
Return 1 if buff is the keyword "inf" or one of its variants.
double * collower_
Pointer to dense vector of column lower bounds.
const char * columnName(int index) const
Return the column name for the specified index.
double objectiveOffset() const
Returns the (constant) objective offset.
const int getNumObjectives() const
Get pointer to array[getNumCols()] of objective function coefficients.
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
int numberAcross_
Number of monomials printed in a row.
int getNumberAcross() const
Get numberAcross, the number of monomials to be printed per line.
int numberSets() const
Number of SOS sets.
CoinMessages messages()
Return the messages.
void getPreviousColNames(char const *const *prev, int *card_prev) const
Get pointer to array[*card_prev] of previous column names.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
CoinSet ** setInformation() const
Set information.
int find_obj() const
Locate the objective function.
int newCardLpIO() const
Get next line into inputBuffer_ (returns number in)
int card_previous_names_[2]
card_previous_names_[section] holds the number of entries in the vector previous_names_[section].
CoinLpIO & operator=(const CoinLpIO &rhs)
assignment operator
int are_invalid_names(char const *const *vnames, const int card_vnames, const bool check_ranged) const
Return 0 if each of the card_vnames entries of vnames is a valid name, return a positive number other...
void setDefaultRowNames()
Set objective function name to the default "obj" and row names to the default "cons0",...
void readLp()
Does work of readLp.
char * objName_[MAX_OBJECTIVES]
Objective function name.
char ** previous_names_[2]
Row names (including objective function name) and column names when stopHash() for the corresponding ...
void loadSOS(int numberSets, const CoinSet **sets)
Load in SOS stuff.
char * problemName_
Problem name.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of constraint right-hand sides.
void setLanguage(CoinMessages::Language language)
Set the language for messages.
void skip_comment(char *buff) const
Read the file fp until buff contains an end of line.
int maxHash_[2]
Maximum number of entries in a hash table section.
void print() const
Dump the data. Low level method for debugging.
double * rowupper_
Pointer to dense vector of row upper bounds.
void setLpDataRowAndColNames(char const *const *const rownames, char const *const *const colnames)
Set the row and column names.
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler.
void freePreviousNames(const int section)
Free the vector previous_names_[section] and set card_previous_names_[section] to 0.
double objectiveOffset(int j) const
Returns the (constant) objective offset for objective j.
int first_is_number(const char *buff) const
Return 1 if the first character of buff is a number.
const char * getObjName() const
Get objective function name.
double * objective_[MAX_OBJECTIVES]
Pointer to dense vector of objective coefficients.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
CoinBigIndex getNumElements() const
Get number of nonzero elements.
void freeAll()
Free all memory (except memory related to hash tables and objName_).
bool eofFound_
If already inserted one End.
void setLpDataWithoutRowAndColNames(const CoinPackedMatrix &m, const double *collb, const double *colub, const double *obj_coeff[MAX_OBJECTIVES], int num_objectives, const char *integrality, const double *rowlb, const double *rowub)
int numberHash_[2]
Number of entries in a hash table section.
bool wasMaximization() const
Return true if maximization problem reformulated as minimization.
CoinLpIO()
Default Constructor.
CoinMessages * messagesPointer()
Return the messages pointer.
const char * getProblemName() const
Get the problem name.
int decimals_
Number of decimals printed for coefficients.
void out_coeff(FILE *fp, double v, int print_1) const
Write a coefficient.
void stopHash(int section)
Delete hash storage.
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
void readLp(const char *filename)
Read the data in Lp format from the file with name filename.
double epsilon_
Value to use for epsilon.
void realloc_row(char ***rowNames, CoinBigIndex **start, double **rhs, double **rowlow, double **rowup, int *maxrow) const
Reallocate vectors related to rows.
void setNumberAcross(const int)
Set numberAcross.
void gutsOfDestructor()
Does the heavy lifting for destruct and assignment.
void realloc_col(double **collow, double **colup, char **is_int, int *maxcol) const
Reallocate vectors related to columns.
Base class for message handling.
Class to hold and manipulate an array of massaged messages.
Language
Supported languages.
Sparse Matrix Base Class.
Very simple class for containing data on set.