An alternative of lp_base.h.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/athos/lp/lp_solver_base.h Wed Mar 23 12:30:33 2005 +0000
1.3 @@ -0,0 +1,162 @@
1.4 +// -*- c++ -*-
1.5 +#ifndef LEMON_LP_SOLVER_BASE_H
1.6 +#define LEMON_LP_SOLVER_BASE_H
1.7 +
1.8 +///\ingroup misc
1.9 +///\file
1.10 +
1.11 +// #include <stdio.h>
1.12 +#include <stdlib.h>
1.13 +#include <iostream>
1.14 +#include <map>
1.15 +#include <limits>
1.16 +// #include <stdio>
1.17 +//#include <stdlib>
1.18 +
1.19 +#include <iostream>
1.20 +#include <vector>
1.21 +#include <string>
1.22 +#include <list>
1.23 +#include <memory>
1.24 +#include <utility>
1.25 +
1.26 +//#include <lemon/invalid.h>
1.27 +//#include <expression.h>
1.28 +//#include <stp.h>
1.29 +//#include <lemon/max_flow.h>
1.30 +//#include <augmenting_flow.h>
1.31 +//#include <iter_map.h>
1.32 +
1.33 +using std::cout;
1.34 +using std::cin;
1.35 +using std::endl;
1.36 +
1.37 +namespace lemon {
1.38 +
1.39 + template <typename _Value>
1.40 + class LpSolverBase {
1.41 +
1.42 + /*! @name Uncategorized functions and types (public members)
1.43 + */
1.44 + //@{
1.45 + public:
1.46 +
1.47 + //UNCATEGORIZED
1.48 +
1.49 + /// \e
1.50 + typedef _Value Value;
1.51 + /// \e
1.52 + static const Value INF;
1.53 + public:
1.54 + /// \e
1.55 + LpSolverBase() { }
1.56 + /// \e
1.57 + virtual ~LpSolverBase() { }
1.58 +
1.59 + /*! @name Low level interface (protected members)
1.60 + Problem manipulating functions in the low level interface
1.61 + */
1.62 + //@{
1.63 + protected:
1.64 +
1.65 + //MATRIX MANIPULATING FUNCTIONS
1.66 +
1.67 + /// \e
1.68 + virtual int _addCol() = 0;
1.69 + /// \e
1.70 + virtual int _addRow() = 0;
1.71 + /// \e
1.72 + virtual void _eraseCol(int i) = 0;
1.73 + /// \e
1.74 + virtual void _eraseRow(int i) = 0;
1.75 + /// \e
1.76 + virtual void _setRowCoeffs(int i,
1.77 + const std::vector<std::pair<int, Value> >& coeffs) = 0;
1.78 + /// \e
1.79 + /// This routine modifies \c coeffs only by the \c push_back method.
1.80 + virtual void _getRowCoeffs(int i,
1.81 + std::vector<std::pair<int, Value> >& coeffs) = 0;
1.82 + /// \e
1.83 + virtual void _setColCoeffs(int i,
1.84 + const std::vector<std::pair<int, Value> >& coeffs) = 0;
1.85 + /// \e
1.86 + /// This routine modifies \c coeffs only by the \c push_back method.
1.87 + virtual void _getColCoeffs(int i,
1.88 + std::vector<std::pair<int, Value> >& coeffs) = 0;
1.89 + /// \e
1.90 + virtual void _setCoeff(int col, int row, Value value) = 0;
1.91 + /// \e
1.92 + virtual Value _getCoeff(int col, int row) = 0;
1.93 + // public:
1.94 + // /// \e
1.95 + // enum Bound { FREE, LOWER, UPPER, DOUBLE, FIXED };
1.96 + protected:
1.97 + /// \e
1.98 + /// The lower bound of a variable (column) have to be given by an
1.99 + /// extended number of type Value, i.e. a finite number of type
1.100 + /// Value or -INF.
1.101 + virtual void _setColLowerBound(int i, Value value) = 0;
1.102 + /// \e
1.103 + /// The lower bound of a variable (column) is an
1.104 + /// extended number of type Value, i.e. a finite number of type
1.105 + /// Value or -INF.
1.106 + virtual Value _getColLowerBound(int i) = 0;
1.107 + /// \e
1.108 + /// The upper bound of a variable (column) have to be given by an
1.109 + /// extended number of type Value, i.e. a finite number of type
1.110 + /// Value or INF.
1.111 + virtual void _setColUpperBound(int i, Value value) = 0;
1.112 + /// \e
1.113 + /// The upper bound of a variable (column) is an
1.114 + /// extended number of type Value, i.e. a finite number of type
1.115 + /// Value or INF.
1.116 + virtual Value _getColUpperBound(int i) = 0;
1.117 + /// \e
1.118 + /// The lower bound of a linear expression (row) have to be given by an
1.119 + /// extended number of type Value, i.e. a finite number of type
1.120 + /// Value or -INF.
1.121 + virtual void _setRowLowerBound(int i, Value value) = 0;
1.122 + /// \e
1.123 + /// The lower bound of a linear expression (row) is an
1.124 + /// extended number of type Value, i.e. a finite number of type
1.125 + /// Value or -INF.
1.126 + virtual Value _getRowLowerBound(int i) = 0;
1.127 + /// \e
1.128 + /// The upper bound of a linear expression (row) have to be given by an
1.129 + /// extended number of type Value, i.e. a finite number of type
1.130 + /// Value or INF.
1.131 + virtual void _setRowUpperBound(int i, Value value) = 0;
1.132 + /// \e
1.133 + /// The upper bound of a linear expression (row) is an
1.134 + /// extended number of type Value, i.e. a finite number of type
1.135 + /// Value or INF.
1.136 + virtual Value _getRowUpperBound(int i) = 0;
1.137 + /// \e
1.138 + virtual void _setObjCoeff(int i, Value obj_coef) = 0;
1.139 + /// \e
1.140 + virtual Value _getObjCoeff(int i) = 0;
1.141 +
1.142 + //SOLUTION RETRIEVING
1.143 +
1.144 + /// \e
1.145 + virtual Value _getPrimal(int i) = 0;
1.146 + //@}
1.147 +
1.148 +
1.149 +
1.150 + /*! @name MIP functions and types (public members)
1.151 + */
1.152 + //@{
1.153 + protected:
1.154 + /// \e
1.155 + virtual void _setColCont(int i) = 0;
1.156 + /// \e
1.157 + virtual void _setColInt(int i) = 0;
1.158 + /// \e
1.159 + virtual Value _getMIPPrimal(int i) = 0;
1.160 + //@}
1.161 + };
1.162 +
1.163 +} //namespace lemon
1.164 +
1.165 +#endif //LEMON_LP_SOLVER_BASE_H