SoPlex
Loading...
Searching...
No Matches
MPSInput Class Reference

#include <mpsinput.h>

Public Types

Types
enum  Section {
  NAME , OBJSEN , OBJNAME , ROWS ,
  COLUMNS , RHS , RANGES , BOUNDS ,
  ENDATA
}
enum  Sense { MAXIMIZE = 1 , MINIMIZE = -1 }
 optimization sense. More...
enum  { MAX_LINE_LEN = 256 }

Public Member Functions

Construction / destruction
 MPSInput (std::istream &p_input)
virtual ~MPSInput ()
Access
Section section () const
int lineno () const
const char * field0 () const
const char * field1 () const
const char * field2 () const
const char * field3 () const
const char * field4 () const
const char * field5 () const
const char * probName () const
const char * objName () const
Sense objSense () const
bool hasError () const
bool isInteger () const
Modification
void setSection (Section p_section)
void setProbName (const char *p_probname)
void setObjName (const char *p_objname)
void setObjSense (Sense sense)
Warnings and Errors
void syntaxError ()
void entryIgnored (const char *what, const char *what_name, const char *entity, const char *entity_name)
Helpers
bool readLine ()
 reads an MPS format data line and parse the fields.
void insertName (const char *name, bool second=false)
 Inserts name as field 1 and shifts all other fields up.

Private data

Section m_section
std::istream & m_input
 the input stream from which the file is read
int m_lineno
 line number
Sense m_objsense
 objctive sense (maximization or minimization)
bool m_has_error
 is set to true upon a syntax error
char m_buf [MAX_LINE_LEN]
 the line buffer
const char * m_f0
 first field in a line
const char * m_f1
 second field in a line
const char * m_f2
 third field in a line
const char * m_f3
 fourth field in a line
const char * m_f4
 fifth field in a line
const char * m_f5
 sixth field in a line
char m_probname [MAX_LINE_LEN]
 problem name
char m_objname [MAX_LINE_LEN]
 objective name
bool m_is_integer
bool m_is_new_format
 new MPS format?
int m_ignored
 Number of already ignored entries.
static const int m_max_ignore = 1000
 Maximal number of ignored entries for which a warning will be issued.

Detailed Description

Reads MPS input files. A right-hand side for the objective function is allowed but ignored.

Definition at line 43 of file mpsinput.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_LINE_LEN 

Definition at line 65 of file mpsinput.h.

◆ Section

enum Section
Enumerator
NAME 
OBJSEN 
OBJNAME 
ROWS 
COLUMNS 
RHS 
RANGES 
BOUNDS 
ENDATA 

Definition at line 52 of file mpsinput.h.

◆ Sense

enum Sense

optimization sense.

Enumerator
MAXIMIZE 
MINIMIZE 

Definition at line 59 of file mpsinput.h.

Constructor & Destructor Documentation

◆ MPSInput()

MPSInput ( std::istream & p_input)
explicit

◆ ~MPSInput()

virtual ~MPSInput ( )
virtual

Definition at line 137 of file mpsinput.h.

References m_f0, m_f1, m_f2, m_f3, m_f4, and m_f5.

Member Function Documentation

◆ entryIgnored()

void entryIgnored ( const char * what,
const char * what_name,
const char * entity,
const char * entity_name )

Definition at line 253 of file mpsinput.h.

References m_ignored, m_lineno, m_max_ignore, and SPX_MSG_ERROR.

◆ field0()

const char * field0 ( ) const

Definition at line 159 of file mpsinput.h.

References m_f0.

◆ field1()

const char * field1 ( ) const

Definition at line 164 of file mpsinput.h.

References m_f1.

◆ field2()

const char * field2 ( ) const

Definition at line 169 of file mpsinput.h.

References m_f2.

◆ field3()

const char * field3 ( ) const

Definition at line 174 of file mpsinput.h.

References m_f3.

◆ field4()

const char * field4 ( ) const

Definition at line 179 of file mpsinput.h.

References m_f4.

◆ field5()

const char * field5 ( ) const

Definition at line 184 of file mpsinput.h.

References m_f5.

◆ hasError()

bool hasError ( ) const

Definition at line 204 of file mpsinput.h.

References m_has_error.

◆ insertName()

void insertName ( const char * name,
bool second = false )

Inserts name as field 1 and shifts all other fields up.

Insert name as field 1 and shift all other fields up.

Definition at line 268 of file mpsinput.cpp.

References m_f1, m_f2, m_f3, m_f4, and m_f5.

◆ isInteger()

bool isInteger ( ) const

Definition at line 209 of file mpsinput.h.

References m_is_integer.

◆ lineno()

int lineno ( ) const

Definition at line 154 of file mpsinput.h.

References m_lineno.

◆ objName()

const char * objName ( ) const

Definition at line 194 of file mpsinput.h.

References m_objname.

◆ objSense()

Sense objSense ( ) const

Definition at line 199 of file mpsinput.h.

References m_objsense.

◆ probName()

const char * probName ( ) const

Definition at line 189 of file mpsinput.h.

References m_probname.

◆ readLine()

bool readLine ( )

reads an MPS format data line and parse the fields.

read a MPS format data line and parse the fields.

Definition at line 67 of file mpsinput.cpp.

References BLANK, BOUNDS, soplex::clear_from(), COLUMNS, SPxOut::debug(), m_buf, m_f0, m_f1, m_f2, m_f3, m_f4, m_f5, m_input, m_is_integer, m_is_new_format, m_lineno, m_section, soplex::patch_field(), RANGES, and RHS.

◆ section()

Section section ( ) const

Definition at line 149 of file mpsinput.h.

References m_section.

◆ setObjName()

void setObjName ( const char * p_objname)

Definition at line 230 of file mpsinput.h.

References m_objname, MAX_LINE_LEN, and soplex::spxSnprintf().

◆ setObjSense()

void setObjSense ( Sense sense)

Definition at line 236 of file mpsinput.h.

References m_objsense.

◆ setProbName()

void setProbName ( const char * p_probname)

Definition at line 224 of file mpsinput.h.

References m_probname, MAX_LINE_LEN, and soplex::spxSnprintf().

◆ setSection()

void setSection ( Section p_section)

Definition at line 219 of file mpsinput.h.

References m_section.

◆ syntaxError()

void syntaxError ( )

Definition at line 246 of file mpsinput.h.

References ENDATA, m_has_error, m_lineno, m_section, and SPX_MSG_ERROR.

Member Data Documentation

◆ m_buf

char m_buf[MAX_LINE_LEN]
private

the line buffer

Definition at line 85 of file mpsinput.h.

Referenced by MPSInput(), and readLine().

◆ m_f0

const char* m_f0
private

first field in a line

Definition at line 87 of file mpsinput.h.

Referenced by field0(), MPSInput(), readLine(), and ~MPSInput().

◆ m_f1

const char* m_f1
private

second field in a line

Definition at line 89 of file mpsinput.h.

Referenced by field1(), insertName(), MPSInput(), readLine(), and ~MPSInput().

◆ m_f2

const char* m_f2
private

third field in a line

Definition at line 91 of file mpsinput.h.

Referenced by field2(), insertName(), MPSInput(), readLine(), and ~MPSInput().

◆ m_f3

const char* m_f3
private

fourth field in a line

Definition at line 93 of file mpsinput.h.

Referenced by field3(), insertName(), MPSInput(), readLine(), and ~MPSInput().

◆ m_f4

const char* m_f4
private

fifth field in a line

Definition at line 95 of file mpsinput.h.

Referenced by field4(), insertName(), MPSInput(), readLine(), and ~MPSInput().

◆ m_f5

const char* m_f5
private

sixth field in a line

Definition at line 97 of file mpsinput.h.

Referenced by field5(), insertName(), MPSInput(), readLine(), and ~MPSInput().

◆ m_has_error

bool m_has_error
private

is set to true upon a syntax error

Definition at line 83 of file mpsinput.h.

Referenced by hasError(), MPSInput(), and syntaxError().

◆ m_ignored

int m_ignored
private

Number of already ignored entries.

Definition at line 107 of file mpsinput.h.

Referenced by entryIgnored(), and MPSInput().

◆ m_input

std::istream& m_input
private

the input stream from which the file is read

Definition at line 77 of file mpsinput.h.

Referenced by MPSInput(), and readLine().

◆ m_is_integer

bool m_is_integer
private

Definition at line 103 of file mpsinput.h.

Referenced by isInteger(), MPSInput(), and readLine().

◆ m_is_new_format

bool m_is_new_format
private

new MPS format?

Definition at line 105 of file mpsinput.h.

Referenced by MPSInput(), and readLine().

◆ m_lineno

int m_lineno
private

line number

Definition at line 79 of file mpsinput.h.

Referenced by entryIgnored(), lineno(), MPSInput(), readLine(), and syntaxError().

◆ m_max_ignore

const int m_max_ignore = 1000
staticprivate

Maximal number of ignored entries for which a warning will be issued.

Definition at line 109 of file mpsinput.h.

Referenced by entryIgnored().

◆ m_objname

char m_objname[MAX_LINE_LEN]
private

objective name

Definition at line 101 of file mpsinput.h.

Referenced by MPSInput(), objName(), and setObjName().

◆ m_objsense

Sense m_objsense
private

objctive sense (maximization or minimization)

Definition at line 81 of file mpsinput.h.

Referenced by MPSInput(), objSense(), and setObjSense().

◆ m_probname

char m_probname[MAX_LINE_LEN]
private

problem name

Definition at line 99 of file mpsinput.h.

Referenced by MPSInput(), probName(), and setProbName().

◆ m_section

Section m_section
private

Definition at line 75 of file mpsinput.h.

Referenced by MPSInput(), readLine(), section(), setSection(), and syntaxError().