mpsgen Class Reference

Output module for writing MPS files. More...

#include <mpsgen.hh>

Inheritance diagram for mpsgen:
Inheritance graph
[legend]
Collaboration diagram for mpsgen:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 mpsgen (const driver &d)
 Constructor.
virtual ~mpsgen ()
 Destructor.
void write (const char *filename)
 Write output to named file.

Protected Member Functions

void make_matrix (size_t rows, size_t cols)
 Allocates a CoinPackedMatrix data structure.
void set_element (size_t row, size_t col, int val)
 Set a single matrix element.

Private Attributes

CoinPackedMatrixmatrix
 COIN-OR matrix representation.

Detailed Description

Output module for writing MPS files.

The MPS file format is commonly used as input format for linear optimization software. Descriptions can be found on the web. This class uses the CoinUtils library to write output in this format.

Definition at line 39 of file mpsgen.hh.


Constructor & Destructor Documentation

mpsgen::mpsgen ( const driver d  ) 

Constructor.

The mpsgen::matrix element will be constructed in mpsgen::make_matrix(), not in the constructor.

Definition at line 42 of file mpsgen.cc.

mpsgen::~mpsgen (  )  [virtual]

Destructor.

Deletes mpsgen::matrix if it has been created. As mipgen::~mipgen is a virtual destructor, this destructor will get called even if the object is referenced through a pointer to mipgen.

Definition at line 52 of file mpsgen.cc.

References matrix.


Member Function Documentation

void mpsgen::make_matrix ( size_t  rows,
size_t  cols 
) [protected, virtual]

Allocates a CoinPackedMatrix data structure.

Parameters:
rows the number of rows the coefficient matrix has.
cols the number of columns the coefficient matrix has.

Reimplemented from mipgen.

Definition at line 108 of file mpsgen.cc.

References matrix, and CoinPackedMatrix::setDimensions().

void mpsgen::set_element ( size_t  row,
size_t  col,
int  val 
) [protected, virtual]

Set a single matrix element.

This implementation skips zero elements. Nonzero elements will be stored in the matrix.

Parameters:
row the row index of the matrix element.
col the column index of the matrix element.
val the value of the matrix element.

Reimplemented from mipgen.

Definition at line 124 of file mpsgen.cc.

References matrix, and CoinPackedMatrix::modifyCoefficient().

void mpsgen::write ( const char *  filename  )  [virtual]

Write output to named file.

Bounds are set using operations on the CoinPackedMatrix. Then the problem is written to the specified file.

Bug:
Passing a 0 pointer as file name should result in the problem being written to standard output, but the current version of CoinUtils seems incapable of this, as it wants to append .mps to any file name not already ending with that extension.
Parameters:
filename the file to which output will be written

Reimplemented from mipgen.

Definition at line 68 of file mpsgen.cc.

References mipgen::col_bounds, mipgen::col_names, mipgen::drv, CoinMpsIO::getInfinity(), matrix, mipgen::modcount, driver::name, mipgen::row_bounds, mipgen::row_names, CoinMpsIO::setMpsData(), CoinMpsIO::setProblemName(), and CoinMpsIO::writeMps().


Member Data Documentation

COIN-OR matrix representation.

As we don't use mipgen::matrix, shadowing that structure by using the same name only avoids accidential access to an uninitialized data structure.

Reimplemented from mipgen.

Definition at line 57 of file mpsgen.hh.

Referenced by make_matrix(), set_element(), write(), and ~mpsgen().


The documentation for this class was generated from the following files:

Generated on Fri Aug 21 08:15:08 2009 for mqn2mps by  doxygen 1.6.0