Scippy

SoPlex

Sequential object-oriented simPlex

spxlpbase_rational.cpp File Reference

Saving LPs with Rational values in a form suitable for SoPlex. More...

#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <iostream>
#include "soplex/spxdefines.h"
#include "soplex/spxlpbase.h"
#include "soplex/spxout.h"
#include "soplex/mpsinput.h"
#include "soplex/exceptions.h"

Go to the source code of this file.

Namespaces

 soplex
 Everything should be within this namespace.
 

Macros

#define MAX_LINE_WRITE_LEN   65536
 maximum length allowed for writing lines More...
 
#define LPF_MAX_LINE_LEN   8192
 maximum length of a line (8190 + \n + \0) More...
 
#define INIT_COLS   1000
 Read LP in MPS File Format. More...
 
#define INIT_NZOS   5000
 initialy allocated non zeros. More...
 
#define NUM_ENTRIES_PER_LINE   5
 

Functions

static bool LPFisSpace (int c)
 Is c a space, tab, nl or cr ? More...
 
static bool LPFisValue (const char *s)
 Is there a number at the beginning of s ? More...
 
static bool LPFisColName (const char *s)
 Is there a possible column name at the beginning of s ? More...
 
static bool LPFisSense (const char *s)
 Is there a comparison operator at the beginning of s ? More...
 
static bool LPFisInfinity (const char *s)
 
static bool LPFisFree (const char *s)
 
static Rational LPFreadValue (char *&pos, SPxOut *spxout, const int lineno=-1)
 Read the next number and advance pos. More...
 
static int LPFreadColName (char *&pos, NameSet *colnames, LPColSetBase< Rational > &colset, const LPColBase< Rational > *emptycol, SPxOut *spxout)
 Read the next column name from the input. More...
 
static int LPFreadSense (char *&pos)
 Read the next <,>,=,==,<=,=<,>=,=> and advance pos. More...
 
static bool LPFhasKeyword (char *&pos, const char *keyword)
 Is the keyword present in buf ? If yes, advance pos. More...
 
static bool LPFhasRowName (char *&pos, NameSet *rownames)
 If buf start with "name:" store the name in rownames and advance pos. More...
 
static Rational LPFreadInfinity (char *&pos)
 
static void MPSreadName (MPSInput &mps, SPxOut *spxout)
 Process NAME section. More...
 
static void MPSreadObjsen (MPSInput &mps)
 Process OBJSEN section. This Section is an ILOG extension. More...
 
static void MPSreadObjname (MPSInput &mps)
 Process OBJNAME section. This Section is an ILOG extension. More...
 
static void MPSreadRows (MPSInput &mps, LPRowSetBase< Rational > &rset, NameSet &rnames, SPxOut *spxout)
 Process ROWS section. More...
 
static void MPSreadCols (MPSInput &mps, const LPRowSetBase< Rational > &rset, const NameSet &rnames, LPColSetBase< Rational > &cset, NameSet &cnames, DIdxSet *intvars, SPxOut *spxout)
 Process COLUMNS section. More...
 
static void MPSreadRhs (MPSInput &mps, LPRowSetBase< Rational > &rset, const NameSet &rnames, SPxOut *spxout)
 Process RHS section. More...
 
static void MPSreadRanges (MPSInput &mps, LPRowSetBase< Rational > &rset, const NameSet &rnames, SPxOut *spxout)
 Process RANGES section. More...
 
static void MPSreadBounds (MPSInput &mps, LPColSetBase< Rational > &cset, const NameSet &cnames, DIdxSet *intvars, SPxOut *spxout)
 Process BOUNDS section. More...
 
static const char * LPFgetRowName (const SPxLPBase< Rational > &p_lp, int p_idx, const NameSet *p_rnames, char *p_buf, int p_num_written_rows)
 
static const char * getColName (const SPxLPBase< Rational > &p_lp, int p_idx, const NameSet *p_cnames, char *p_buf)
 
static void LPFwriteSVector (const SPxLPBase< Rational > &p_lp, std::ostream &p_output, const NameSet *p_cnames, const SVectorBase< Rational > &p_svec, SPxOut *spxout)
 
static void LPFwriteObjective (const SPxLPBase< Rational > &p_lp, std::ostream &p_output, const NameSet *p_cnames, SPxOut *spxout)
 
static void LPFwriteRow (const SPxLPBase< Rational > &p_lp, std::ostream &p_output, const NameSet *p_cnames, const SVectorBase< Rational > &p_svec, const Rational &p_lhs, const Rational &p_rhs, SPxOut *spxout)
 
static void LPFwriteRows (const SPxLPBase< Rational > &p_lp, std::ostream &p_output, const NameSet *p_rnames, const NameSet *p_cnames, SPxOut *spxout)
 
static void LPFwriteBounds (const SPxLPBase< Rational > &p_lp, std::ostream &p_output, const NameSet *p_cnames, SPxOut *spxout)
 
static void LPFwriteGenerals (const SPxLPBase< Rational > &p_lp, std::ostream &p_output, const NameSet *p_cnames, const DIdxSet *p_intvars)
 
static void MPSwriteRecord (std::ostream &os, const char *indicator, const char *name, SPxOut *spxout, const char *name1=0, const Rational value1=0, const char *name2=0, const Rational value2=0)
 
static Rational MPSgetRHS (Rational left, Rational right)
 
static const char * MPSgetRowName (const SPxLPBase< Rational > &lp, int idx, const NameSet *rnames, char *buf)
 

Detailed Description

Saving LPs with Rational values in a form suitable for SoPlex.

Definition in file spxlpbase_rational.cpp.

Macro Definition Documentation

◆ INIT_COLS

#define INIT_COLS   1000

Read LP in MPS File Format.

The specification is taken from the IBM Optimization Library Guide and Reference, online available at http://www.software.ibm.com/sos/features/libuser.htm and from the ILOG CPLEX 7.0 Reference Manual, Appendix E, Page 531.

This routine should read all valid MPS format files. What it will not do, is find all cases where a file is ill formed. If this happens it may complain and read nothing or read "something".

Returns
true if the file was read correctly.initialy allocated columns.

Definition at line 1743 of file spxlpbase_rational.cpp.

Referenced by SPxLPBase< Real >::readMPS().

◆ INIT_NZOS

#define INIT_NZOS   5000

initialy allocated non zeros.

Definition at line 1744 of file spxlpbase_rational.cpp.

Referenced by SPxLPBase< Real >::readMPS().

◆ LPF_MAX_LINE_LEN

#define LPF_MAX_LINE_LEN   8192

maximum length of a line (8190 + \n + \0)

Definition at line 154 of file spxlpbase_rational.cpp.

Referenced by soplex::LPFhasRowName(), soplex::LPFreadColName(), soplex::LPFreadValue(), and SPxLPBase< Real >::readLPF().

◆ MAX_LINE_WRITE_LEN

#define MAX_LINE_WRITE_LEN   65536

maximum length allowed for writing lines

Definition at line 31 of file spxlpbase_rational.cpp.

Referenced by soplex::LPFwriteBounds(), soplex::LPFwriteRow(), soplex::LPFwriteSVector(), and soplex::MPSwriteRecord().

◆ NUM_ENTRIES_PER_LINE

#define NUM_ENTRIES_PER_LINE   5

Definition at line 1923 of file spxlpbase_rational.cpp.

Referenced by soplex::LPFwriteSVector().