Importing objects from file


Data Structures

class  goblinImport
 Class for reading data objects from file. More...

Enumerations

enum  goblinController::TFileFormat {
  goblinController::FMT_GOBLIN = 0,
  goblinController::FMT_DIMACS_MIN = 1,
  goblinController::FMT_DIMACS_EDGE = 2,
  goblinController::FMT_DIMACS_GEOM = 7,
  goblinController::FMT_SQUARE_UCAP = 3,
  goblinController::FMT_SQUARE_LENGTH = 4,
  goblinController::FMT_TRIANGULAR_UCAP = 5,
  goblinController::FMT_TRIANGULAR_LENGTH = 6
}

Functions

virtual void goblinRootObject::ReadSpecial (goblinImport &, attributePool &, TPoolEnum) throw (ERParse)
managedObjectgoblinController::ImportByFormatName (const char *filename, const char *formatName) throw (ERParse)
managedObjectgoblinController::ImportFromFile (const char *filename, TFileFormat format) throw (ERParse)
managedObjectgoblinController::Import_Native (const char *filename) throw (ERParse)
sparseDiGraphgoblinController::Import_DimacsMin (const char *filename) throw (ERParse)
sparseGraphgoblinController::Import_DimacsEdge (const char *filename) throw (ERParse)
denseGraphgoblinController::Import_DimacsGeom (const char *filename) throw (ERParse)
denseDiGraphgoblinController::Import_SquareMatrix (const char *filename, TFileFormat format) throw (ERParse)
denseGraphgoblinController::Import_TriangularMatrix (const char *filename, TFileFormat format) throw (ERParse)
void mipInstance::ReadMPSFile (const char *) throw (ERParse,ERRejected)
void mipInstance::ReadMPSFile (ifstream &) throw (ERParse,ERRejected)
void mipInstance::ReadBASFile (const char *) throw (ERParse,ERRejected)
void mipInstance::ReadBASFile (ifstream &) throw (ERParse,ERRejected)
void mipInstance::ReadVarValues (goblinImport *, TVar) throw (ERParse)
template<typename TEntry>
TEntry * goblinImport::GetTuple () throw ()
template<typename TToken>
TToken goblinImport::ReadTuple (const TPoolTable listOfParameters[], TToken endToken, TToken undefToken) throw ()

Enumeration Type Documentation

enum TFileFormat [inherited]
 

Enum values for file format specifications.

Enumerator:
FMT_GOBLIN  The native file format.
FMT_DIMACS_MIN  Dimacs format for digraphs, in particular min-cost flow instances.
FMT_DIMACS_EDGE  Dimacs format for undirected graphs.
FMT_DIMACS_GEOM  Dimacs format for geometric graphs.
FMT_SQUARE_UCAP  Edge length adjacency maxtrix format of complete digraphs.
FMT_SQUARE_LENGTH  Edge capacity adjacency maxtrix format of complete digraphs.
FMT_TRIANGULAR_UCAP  Edge length adjacency maxtrix format of complete undirected graphs.
FMT_TRIANGULAR_LENGTH  Edge capacity adjacency maxtrix format of complete undirected graphs.


Function Documentation

TEntry * GetTuple  )  throw () [inherited]
 

sparseGraph * Import_DimacsEdge const char *  filename  )  throw (ERParse) [inherited]
 

Import a DIMACS like specified graph skeleton into a sparseGraph object.

Parameters:
filename The input filename
Returns:
A pointer to the constructed object
This scans the file for lines matching the formats
  • p edge [num of nodes] [number of arcs] or
  • n [node index] [node demand] or
  • e [start node index] [end node index] [arc length] [upper bound] [lower bound].

The problem dimension line must appear once and before the other formats. All lines not matching these formats are ignored. So both separate comment lines and trailing comments are possible.

Nodes indices are running 1,2,..,n. Node description lines are necessary only for demand values different from 1.0. For every edge definition line a graph edge is generated, and the number of edges specified in the dimension line is used only to avoid reallocations. Edge attributes can be ommitted, where the default edge length is 1.0, and the defaut upper and lower edge capacities are 1.0 and 0.0 respectively.

Note that the format slightly differs from the format for undirected graphs:

  • Edge definition lines start with an "e"
  • The order of edge attributes is different
  • Node demands are 1.0 by default

The accepted file format is an extension the Dimacs format for undirected graphs, especially for matching problem instances.

denseGraph * Import_DimacsGeom const char *  filename  )  throw (ERParse) [inherited]
 

Import a DIMACS geom file into a denseGraph object.

Parameters:
filename The input filename
Returns:
A pointer to the constructed object
This scans the file for lines matching the formats
  • p geom [number of nodes] [geometry dimension] or
  • v [x-pos value] [y-pos value] [z-pos value].

The number of lines of the second pattern must match the number specified in the problem dimension line. The dimension may be either 1,2 or 3.

sparseDiGraph * Import_DimacsMin const char *  filename  )  throw (ERParse) [inherited]
 

Import a DIMACS like specified digraph skeleton into a sparseDiGraph object.

Parameters:
filename The input filename
Returns:
A pointer to the constructed object
This scans the file for lines matching the formats
  • p min [number of nodes] [number of arcs],
  • n [node index] [node supply] or
  • a [start node index] [end node index] [lower bound] [upper bound] [arc length].

The problem dimension line must appear once and before the other formats. All lines not matching these formats are ignored. So both separate comment lines and trailing comments are possible.

Nodes indices are running 1,2,..,n. Node description lines are necessary only for supply/demand values different from zero. For every arc definition line a graph arc is generated, and the number of arcs specified in the dimension line is used only to avoid reallocations. Arc attributes can be ommitted, where the default arc length is 1.0, and the defaut upper and lower arc capacities are 1.0 and 0.0 respectively.

Note that the format slightly differs from the format for undirected graphs:

  • Arc definition lines start with an "a"
  • The order of arc attributes is different
  • Node demands are 0.0 by default

The accepted file format is an extension the Dimacs format specified for min-cost flow.

managedObject * Import_Native const char *  filename  )  throw (ERParse) [inherited]
 

Import from a file in a library native format.

Parameters:
filename The input filename
Returns:
A pointer to the constructed object
This evaluates the object type as specified in the file, and calls the respective file constructor

denseDiGraph * Import_SquareMatrix const char *  filename,
TFileFormat  format
throw (ERParse) [inherited]
 

Import an square matrix into a denseDiGraph object.

Parameters:
filename The input filename
format Specifies the attribute (length/capacity bound) to which values are saved
Returns:
A pointer to the constructed object
This expects a square number of arc attribute values in the input file. The values must delimited by at least one white space, preceding the numbers. Trailing symbols (such as commata), and even stray strings (comments) are allowed. It is also not required that matrix rows and file lines match.

denseGraph * Import_TriangularMatrix const char *  filename,
TFileFormat  format
throw (ERParse) [inherited]
 

Import a lower triangular matrix into a denseGraph object.

Parameters:
filename The input filename
format Specifies the attribute (length/capacity bound) to which values are saved
Returns:
A pointer to the constructed object
This expects an appropriate number of arc attribute values in the input file. The values must delimited by at least one white space, preceding the numbers. Trailing symbols (such as commata), and even stray strings (comments) are allowed. It is also not required that matrix rows and file lines match.

managedObject * ImportByFormatName const char *  filename,
const char *  formatName
throw (ERParse) [inherited]
 

Import from a file in a format specified by a string value.

Parameters:
filename The input filename
formatName The expected file format
Returns:
A pointer to the constructed object
This only looks up the respecitive format enum and then calls ImportFromFile()

managedObject * ImportFromFile const char *  filename,
TFileFormat  format
throw (ERParse) [inherited]
 

Import from a file in a format specified by an enum value.

Parameters:
filename The input filename
format The expected file format
Returns:
A pointer to the constructed object

void ReadBASFile ifstream &   )  throw (ERParse,ERRejected) [inherited]
 

void ReadBASFile const char *   )  throw (ERParse,ERRejected) [inherited]
 

void ReadMPSFile ifstream &   )  throw (ERParse,ERRejected) [inherited]
 

void ReadMPSFile const char *   )  throw (ERParse,ERRejected) [inherited]
 

void ReadSpecial goblinImport ,
attributePool ,
TPoolEnum 
throw (ERParse) [virtual, inherited]
 

Reimplemented in abstractMixedGraph.

TToken ReadTuple const TPoolTable  listOfParameters[],
TToken  endToken,
TToken  undefToken
throw () [inherited]
 

void ReadVarValues goblinImport ,
TVar 
throw (ERParse) [inherited]