Output module for writing MPS files. More...
#include <mpsgen.hh>


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 | |
| CoinPackedMatrix * | matrix |
| COIN-OR matrix representation. | |
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.
| mpsgen::mpsgen | ( | const driver & | d | ) |
Constructor.
The mpsgen::matrix element will be constructed in mpsgen::make_matrix(), not in the constructor.
| 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.
| void mpsgen::make_matrix | ( | size_t | rows, | |
| size_t | cols | |||
| ) | [protected, virtual] |
Allocates a CoinPackedMatrix data structure.
| 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.
| 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.
.mps to any file name not already ending with that extension.| 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().
CoinPackedMatrix* mpsgen::matrix [private] |
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().
1.6.0