118 char& sense,
double& right,
double& range)
const;
206 int *card_prev)
const;
213 int *card_prev)
const;
225 const char *
rowName(
int index)
const;
235 int rowIndex(
const char * name)
const;
300 const double* collb,
const double* colub,
301 const double* obj_coeff,
302 const char* integrality,
303 const double* rowlb,
const double* rowub);
336 const int card_vnames,
337 const bool check_ranged)
const;
366 char const *
const *
const colnames);
382 int writeLp(
const char *filename,
383 const double epsilon,
384 const int numberAcross,
386 const bool useRowNames =
true);
403 const double epsilon,
404 const int numberAcross,
406 const bool useRowNames =
true);
410 int writeLp(
const char *filename,
const bool useRowNames =
true);
414 int writeLp(FILE *fp,
const bool useRowNames =
true);
420 void readLp(
const char *filename,
const double epsilon);
426 void readLp(
const char *filename);
433 void readLp(FILE *fp,
const double epsilon);
559 void startHash(
char const *
const *
const names,
578 void insertHash(
const char *thisName,
int section);
582 void out_coeff(FILE *fp,
double v,
int print_1)
const;
608 void scan_next(
char *buff, FILE *fp)
const;
612 int is_free(
const char *buff)
const;
616 int is_inf(
const char *buff)
const;
623 int is_sense(
const char *buff)
const;
638 int read_monom_obj(FILE *fp,
double *coeff,
char **name,
int *cnt,
645 int read_monom_row(FILE *fp,
char *start_str,
double *coeff,
char **name,
646 int cnt_coeff)
const;
649 void realloc_coeff(
double **coeff,
char ***colNames,
int *maxcoeff)
const;
652 void realloc_row(
char ***rowNames,
int **start,
double **rhs,
653 double **rowlow,
double **rowup,
int *maxrow)
const;
656 void realloc_col(
double **collow,
double **colup,
char **is_int,
660 void read_row(FILE *fp,
char *buff,
double **pcoeff,
char ***pcolNames,
661 int *cnt_coeff,
int *maxcoeff,
662 double *rhs,
double *rowlow,
double *rowup,
663 int *cnt_row,
double inf)
const;
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.
char ** previous_names_[2]
Row names (including objective function name) and column names when stopHash() for the corresponding ...
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...
const char * integerColumns() const
Get characteristic vector of integer variables.
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.
void setDecimals(const int)
Set decimals.
int first_is_number(const char *buff) const
Return 1 if the first character of buff is a number.
double objectiveOffset() const
Returns the (constant) objective offset.
void skip_comment(char *buff, FILE *fp) const
Read the file fp until buff contains an end of line.
CoinLpIO()
Default Constructor.
const char * rowName(int index) const
Return the row name for the specified index.
void scan_next(char *buff, FILE *fp) const
Put in buff the next string that is not part of a comment.
COINColumnIndex findHash(const char *name, int section) const
Return the index of the given name, return -1 if the name is not found.
int is_comment(const char *buff) const
Return 1 if the first character of buff is '/' or '\'.
int numberColumns_
Number of columns.
Class to read and write Lp files.
int numberElements_
Number of elements.
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.
void setEpsilon(const double)
Set epsilon.
char ** names_[2]
Row names (including objective function name) and column names (linked to Hash tables).
double * rowlower_
Pointer to dense vector of row lower bounds.
void getPreviousRowNames(char const *const *prev, int *card_prev) const
Get pointer to array[*card_prev] of previous row names.
char * problemName_
Problem name.
int getNumCols() const
Get number of columns.
void setDefaultRowNames()
Set objective function name to the default "obj" and row names to the default "cons0", "cons1", ...
char * integerType_
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
void out_coeff(FILE *fp, double v, int print_1) const
Write a coefficient.
double * rowrange_
Pointer to dense vector of slack variable upper bounds for ranged constraints (undefined for non-rang...
const double * getRowRange() const
Get pointer to array[getNumRows()] of row ranges.
int read_monom_row(FILE *fp, char *start_str, double *coeff, char **name, int cnt_coeff) const
Read a monomial of a constraint.
char * rowsense_
Pointer to dense vector of row senses.
int getNumberAcross() const
Get numberAcross, the number of monomials to be printed per line.
Sparse Matrix Base Class.
int numberRows_
Number of rows.
char * fileName_
Current file name.
int maxHash_[2]
Maximum number of entries in a hash table section.
double * rhs_
Pointer to dense vector of row rhs.
int rowIndex(const char *name) const
Return the index for the specified row name.
double infinity_
Value to use for infinity.
CoinPackedMatrix * matrixByColumn_
Pointer to column-wise copy of problem matrix coefficients.
void setLpDataRowAndColNames(char const *const *const rownames, char const *const *const colnames)
Set the row and column names.
char const *const * getColNames() const
Get pointer to array[getNumCols()] of column names.
bool isInteger(int columnNumber) const
Return true if a column is an integer (binary or general integer) variable.
const double * getObjCoefficients() const
Get pointer to array[getNumCols()] of objective function coefficients.
CoinHashLink * hash_[2]
Hash tables with two sections.
const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
void startHash(char const *const *const names, const COINColumnIndex number, int section)
Build the hash table for the given names.
void checkColNames()
Check that current column names are distinct.
const char * getProblemName() const
Get the problem name.
int numberAcross_
Number of monomials printed in a row.
void getPreviousColNames(char const *const *prev, int *card_prev) const
Get pointer to array[*card_prev] of previous column names.
int find_obj(FILE *fp) const
Locate the objective function.
char * objName_
Objective function name.
int columnIndex(const char *name) const
Return the index for the specified column name.
int is_free(const char *buff) const
Return 1 if buff is the keyword "free" or one of its variants.
int getDecimals() const
Get decimals, the number of digits to write after the decimal point.
int numberHash_[2]
Number of entries in a hash table section.
void stopHash(int section)
Delete hash storage.
double * rowupper_
Pointer to dense vector of row upper bounds.
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...
const double * getRowLower() const
Get pointer to array[getNumRows()] of row lower bounds.
void setNumberAcross(const int)
Set numberAcross.
const double * getRowUpper() const
Get pointer to array[getNumRows()] of row upper bounds.
void freePreviousNames(const int section)
Free the vector previous_names_[section] and set card_previous_names_[section] to 0...
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...
double getInfinity() const
Get infinity.
double * collower_
Pointer to dense vector of column lower bounds.
const CoinPackedMatrix * getMatrixByRow() const
Get pointer to row-wise copy of the coefficient matrix.
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...
int read_monom_obj(FILE *fp, double *coeff, char **name, int *cnt, char **obj_name)
Read a monomial of the objective function.
double objectiveOffset_
Constant offset for objective value.
void realloc_col(double **collow, double **colup, char **is_int, int *maxcol) const
Reallocate vectors related to columns.
char const *const * getRowNames() const
Get pointer to array[getNumRows()+1] of row names, including objective function name as last entry...
double getEpsilon() const
Get epsilon.
int is_inf(const char *buff) const
Return 1 if buff is the keyword "inf" or one of its variants.
CoinPackedMatrix * matrixByRow_
Pointer to row-wise copy of problem matrix coefficients.
void setObjectiveOffset(double value)
Set objective offset.
void realloc_row(char ***rowNames, int **start, double **rhs, double **rowlow, double **rowup, int *maxrow) const
Reallocate vectors related to rows.
double * colupper_
Pointer to dense vector of column upper bounds.
int getNumElements() const
Get number of nonzero elements.
const char * getObjName() const
Get objective function name.
int decimals_
Number of decimals printed for coefficients.
int is_sense(const char *buff) const
Return an integer indicating the inequality sense read.
double epsilon_
Value to use for epsilon.
const char * columnName(int index) const
Return the column name for the specified index.
void freeAll()
Free all memory (except memory related to hash tables and objName_).
void realloc_coeff(double **coeff, char ***colNames, int *maxcoeff) const
Reallocate vectors related to number of coefficients.
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 setInfinity(const double)
Set infinity.
void checkRowNames()
Check that current objective name and all row names are distinct including row names obtained by addi...
const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
const char * getRowSense() const
Get pointer to array[getNumRows()] of constraint senses.
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 setProblemName(const char *name)
Set problem name.
int card_previous_names_[2]
card_previous_names_[section] holds the number of entries in the vector previous_names_[section].
const CoinPackedMatrix * getMatrixByCol() const
Get pointer to column-wise copy of the coefficient matrix.
int getNumRows() const
Get number of rows.
void print() const
Dump the data. Low level method for debugging.
double * objective_
Pointer to dense vector of objective coefficients.
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 ...
void setDefaultColNames()
Set column names to the default "x0", "x1", ...
const double * getRightHandSide() const
Get pointer to array[getNumRows()] of constraint right-hand sides.