138 char& sense,
double& right,
double& range)
const;
226 int *card_prev)
const;
233 int *card_prev)
const;
245 const char *
rowName(
int index)
const;
255 int rowIndex(
const char * name)
const;
320 const double* collb,
const double* colub,
321 const double* obj_coeff,
322 const char* integrality,
323 const double* rowlb,
const double* rowub);
356 const int card_vnames,
357 const bool check_ranged)
const;
386 char const *
const *
const colnames);
402 int writeLp(
const char *filename,
403 const double epsilon,
404 const int numberAcross,
406 const bool useRowNames =
true);
423 const double epsilon,
424 const int numberAcross,
426 const bool useRowNames =
true);
430 int writeLp(
const char *filename,
const bool useRowNames =
true);
434 int writeLp(FILE *fp,
const bool useRowNames =
true);
440 void readLp(
const char *filename,
const double epsilon);
446 void readLp(
const char *filename);
453 void readLp(FILE *fp,
const double epsilon);
613 void startHash(
char const *
const *
const names,
632 void insertHash(
const char *thisName,
int section);
636 void out_coeff(FILE *fp,
double v,
int print_1)
const;
662 void scan_next(
char *buff, FILE *fp)
const;
666 int is_free(
const char *buff)
const;
670 int is_inf(
const char *buff)
const;
677 int is_sense(
const char *buff)
const;
692 int read_monom_obj(FILE *fp,
double *coeff,
char **name,
int *cnt,
699 int read_monom_row(FILE *fp,
char *start_str,
double *coeff,
char **name,
700 int cnt_coeff)
const;
703 void realloc_coeff(
double **coeff,
char ***colNames,
int *maxcoeff)
const;
706 void realloc_row(
char ***rowNames,
int **start,
double **rhs,
707 double **rowlow,
double **rowup,
int *maxrow)
const;
710 void realloc_col(
double **collow,
double **colup,
char **is_int,
714 void read_row(FILE *fp,
char *buff,
double **pcoeff,
char ***pcolNames,
715 int *cnt_coeff,
int *maxcoeff,
716 double *rhs,
double *rowlow,
double *rowup,
717 int *cnt_row,
double inf)
const;
void getPreviousColNames(char const *const *prev, int *card_prev) const
Get pointer to array[*card_prev] of previous column names.
double * rowrange_
Pointer to dense vector of slack variable upper bounds for ranged constraints (undefined for non-rang...
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
char * rowsense_
Pointer to dense vector of row senses.
double objectiveOffset_
Constant offset for objective value.
void print() const
Dump the data. Low level method for debugging.
char const *const * getRowNames() const
Get pointer to array[getNumRows()+1] of row names, including objective function name as last entry...
int getNumRows() const
Get number of rows.
double * colupper_
Pointer to dense vector of column upper bounds.
COINColumnIndex findHash(const char *name, int section) const
Return the index of the given name, return -1 if the name is not found.
double * rowlower_
Pointer to dense vector of row lower bounds.
void setEpsilon(const double)
Set epsilon.
void setProblemName(const char *name)
Set problem name.
void setInfinity(const double)
Set infinity.
CoinLpIO & operator=(const CoinLpIO &rhs)
assignment operator
char ** previous_names_[2]
Row names (including objective function name) and column names when stopHash() for the corresponding ...
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...
int read_monom_obj(FILE *fp, double *coeff, char **name, int *cnt, char **obj_name)
Read a monomial of the objective function.
void stopHash(int section)
Delete hash storage.
char const *const * getColNames() const
Get pointer to array[getNumCols()] of column names.
const char * integerColumns() const
Get characteristic vector of integer variables.
double getEpsilon() const
Get epsilon.
const char * rowName(int index) const
Return the row name for the specified index.
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
void read_row(FILE *fp, 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.
CoinMessages * messagesPointer()
Return the messages pointer.
bool isInteger(int columnNumber) const
Return true if a column is an integer (binary or general integer) variable.
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
CoinLpIO()
Default Constructor.
int decimals_
Number of decimals printed for coefficients.
char * objName_
Objective function name.
int numberHash_[2]
Number of entries in a hash table section.
int getNumberAcross() const
Get numberAcross, the number of monomials to be printed per line.
void skip_comment(char *buff, FILE *fp) const
Read the file fp until buff contains an end of line.
int is_comment(const char *buff) const
Return 1 if the first character of buff is '/' or '\'.
const char * getObjName() const
Get objective function name.
int numberColumns_
Number of columns.
void CoinLpIOUnitTest(const std::string &lpDir)
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
Base class for message handling.
int read_monom_row(FILE *fp, char *start_str, double *coeff, char **name, int cnt_coeff) const
Read a monomial of a constraint.
void setDefaultRowNames()
Set objective function name to the default "obj" and row names to the default "cons0", "cons1", ...
int getNumCols() const
Get number of columns.
int getDecimals() const
Get decimals, the number of digits to write after the decimal point.
CoinHashLink * hash_[2]
Hash tables with two sections.
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...
CoinMessageHandler * handler_
Message handler.
char * problemName_
Problem name.
char ** names_[2]
Row names (including objective function name) and column names (linked to Hash tables).
double epsilon_
Value to use for epsilon.
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 getNumElements() const
Get number of nonzero elements.
void setLpDataRowAndColNames(char const *const *const rownames, char const *const *const colnames)
Set the row and column names.
double infinity_
Value to use for infinity.
int numberElements_
Number of elements.
const char * getProblemName() const
Get the problem name.
void checkRowNames()
Check that current objective name and all row names are distinct including row names obtained by addi...
void setLanguage(CoinMessages::Language language)
Set the language for messages.
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...
void scan_next(char *buff, FILE *fp) const
Put in buff the next string that is not part of a comment.
int is_inf(const char *buff) const
Return 1 if buff is the keyword "inf" or one of its variants.
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
void startHash(char const *const *const names, const COINColumnIndex number, int section)
Build the hash table for the given names.
int card_previous_names_[2]
card_previous_names_[section] holds the number of entries in the vector previous_names_[section].
char * fileName_
Current file name.
int find_obj(FILE *fp) const
Locate the objective function.
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
void newLanguage(CoinMessages::Language language)
Set the language for messages.
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 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.
int numberAcross_
Number of monomials printed in a row.
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
int first_is_number(const char *buff) const
Return 1 if the first character of buff is a number.
void gutsOfCopy(const CoinLpIO &)
Does the heavy lifting for copy and assignment.
CoinMessages messages_
Messages.
double getInfinity() const
Get infinity.
const char * getRowSense() const
Get pointer to array[getNumRows()] of constraint senses.
int columnIndex(const char *name) const
Return the index for the specified column name.
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...
Sparse Matrix Base Class.
void getPreviousRowNames(char const *const *prev, int *card_prev) const
Get pointer to array[*card_prev] of previous row names.
const char * columnName(int index) const
Return the column name for the specified index.
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...
Language
Supported languages.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
void setObjectiveOffset(double value)
Set objective offset.
int rowIndex(const char *name) const
Return the index for the specified row name.
double * objective_
Pointer to dense vector of objective coefficients.
CoinMessageHandler * messageHandler() const
Return the message handler.
void out_coeff(FILE *fp, double v, int print_1) const
Write a coefficient.
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
double objectiveOffset() const
Returns the (constant) objective offset.
double * rhs_
Pointer to dense vector of row rhs.
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of constraint right-hand sides.
void setDefaultColNames()
Set column names to the default "x0", "x1", ...
This file contains the enum for the standard set of Coin messages and a class definition whose sole p...
double * collower_
Pointer to dense vector of column lower bounds.
void realloc_coeff(double **coeff, char ***colNames, int *maxcoeff) const
Reallocate vectors related to number of coefficients.
void realloc_row(char ***rowNames, int **start, double **rhs, double **rowlow, double **rowup, int *maxrow) const
Reallocate vectors related to rows.
int maxHash_[2]
Maximum number of entries in a hash table section.
int numberRows_
Number of rows.
Class to read and write Lp files.
void gutsOfDestructor()
Does the heavy lifting for destruct and assignment.
CoinMessages messages()
Return the messages.
void checkColNames()
Check that current column names are distinct.
void setDecimals(const int)
Set decimals.
int is_sense(const char *buff) const
Return an integer indicating the inequality sense read.
void freeAll()
Free all memory (except memory related to hash tables and objName_).
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 ...
double * rowupper_
Pointer to dense vector of row upper bounds.
void realloc_col(double **collow, double **colup, char **is_int, int *maxcol) const
Reallocate vectors related to columns.
friend void CoinLpIOUnitTest(const std::string &lpDir)
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
Class to hold and manipulate an array of massaged messages.
int is_keyword(const char *buff) const
Return an integer indicating if one of the keywords "Bounds", "Integers", "Generals", "Binaries", "End", or one of their variants has been read.
void setNumberAcross(const int)
Set numberAcross.
void freePreviousNames(const int section)
Free the vector previous_names_[section] and set card_previous_names_[section] to 0...
bool defaultHandler_
Flag to say if the message handler is the default handler.