# HG changeset patch # User athos # Date 1111581033 0 # Node ID 66b54d071a60d52665b472a9ee7bdf981f7b7d17 # Parent ca613a9e35673df21bed532fb9086947555e61e3 An alternative of lp_base.h. diff -r ca613a9e3567 -r 66b54d071a60 src/work/athos/lp/lp_solver_base.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/athos/lp/lp_solver_base.h Wed Mar 23 12:30:33 2005 +0000 @@ -0,0 +1,162 @@ +// -*- c++ -*- +#ifndef LEMON_LP_SOLVER_BASE_H +#define LEMON_LP_SOLVER_BASE_H + +///\ingroup misc +///\file + +// #include +#include +#include +#include +#include +// #include +//#include + +#include +#include +#include +#include +#include +#include + +//#include +//#include +//#include +//#include +//#include +//#include + +using std::cout; +using std::cin; +using std::endl; + +namespace lemon { + + template + class LpSolverBase { + + /*! @name Uncategorized functions and types (public members) + */ + //@{ + public: + + //UNCATEGORIZED + + /// \e + typedef _Value Value; + /// \e + static const Value INF; + public: + /// \e + LpSolverBase() { } + /// \e + virtual ~LpSolverBase() { } + + /*! @name Low level interface (protected members) + Problem manipulating functions in the low level interface + */ + //@{ + protected: + + //MATRIX MANIPULATING FUNCTIONS + + /// \e + virtual int _addCol() = 0; + /// \e + virtual int _addRow() = 0; + /// \e + virtual void _eraseCol(int i) = 0; + /// \e + virtual void _eraseRow(int i) = 0; + /// \e + virtual void _setRowCoeffs(int i, + const std::vector >& coeffs) = 0; + /// \e + /// This routine modifies \c coeffs only by the \c push_back method. + virtual void _getRowCoeffs(int i, + std::vector >& coeffs) = 0; + /// \e + virtual void _setColCoeffs(int i, + const std::vector >& coeffs) = 0; + /// \e + /// This routine modifies \c coeffs only by the \c push_back method. + virtual void _getColCoeffs(int i, + std::vector >& coeffs) = 0; + /// \e + virtual void _setCoeff(int col, int row, Value value) = 0; + /// \e + virtual Value _getCoeff(int col, int row) = 0; + // public: + // /// \e + // enum Bound { FREE, LOWER, UPPER, DOUBLE, FIXED }; + protected: + /// \e + /// The lower bound of a variable (column) have to be given by an + /// extended number of type Value, i.e. a finite number of type + /// Value or -INF. + virtual void _setColLowerBound(int i, Value value) = 0; + /// \e + /// The lower bound of a variable (column) is an + /// extended number of type Value, i.e. a finite number of type + /// Value or -INF. + virtual Value _getColLowerBound(int i) = 0; + /// \e + /// The upper bound of a variable (column) have to be given by an + /// extended number of type Value, i.e. a finite number of type + /// Value or INF. + virtual void _setColUpperBound(int i, Value value) = 0; + /// \e + /// The upper bound of a variable (column) is an + /// extended number of type Value, i.e. a finite number of type + /// Value or INF. + virtual Value _getColUpperBound(int i) = 0; + /// \e + /// The lower bound of a linear expression (row) have to be given by an + /// extended number of type Value, i.e. a finite number of type + /// Value or -INF. + virtual void _setRowLowerBound(int i, Value value) = 0; + /// \e + /// The lower bound of a linear expression (row) is an + /// extended number of type Value, i.e. a finite number of type + /// Value or -INF. + virtual Value _getRowLowerBound(int i) = 0; + /// \e + /// The upper bound of a linear expression (row) have to be given by an + /// extended number of type Value, i.e. a finite number of type + /// Value or INF. + virtual void _setRowUpperBound(int i, Value value) = 0; + /// \e + /// The upper bound of a linear expression (row) is an + /// extended number of type Value, i.e. a finite number of type + /// Value or INF. + virtual Value _getRowUpperBound(int i) = 0; + /// \e + virtual void _setObjCoeff(int i, Value obj_coef) = 0; + /// \e + virtual Value _getObjCoeff(int i) = 0; + + //SOLUTION RETRIEVING + + /// \e + virtual Value _getPrimal(int i) = 0; + //@} + + + + /*! @name MIP functions and types (public members) + */ + //@{ + protected: + /// \e + virtual void _setColCont(int i) = 0; + /// \e + virtual void _setColInt(int i) = 0; + /// \e + virtual Value _getMIPPrimal(int i) = 0; + //@} + }; + +} //namespace lemon + +#endif //LEMON_LP_SOLVER_BASE_H