[Lemon-commits] [lemon_svn] marci: r1442 - hugo/trunk/src/work/marci/lp
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:45:28 CET 2006
Author: marci
Date: Tue Jan 4 18:54:41 2005
New Revision: 1442
Modified:
hugo/trunk/src/work/marci/lp/lp_solver_wrapper_2.h
Log:
minor changes for various number types
Modified: hugo/trunk/src/work/marci/lp/lp_solver_wrapper_2.h
==============================================================================
--- hugo/trunk/src/work/marci/lp/lp_solver_wrapper_2.h (original)
+++ hugo/trunk/src/work/marci/lp/lp_solver_wrapper_2.h Tue Jan 4 18:54:41 2005
@@ -159,9 +159,12 @@
/*! \e
*/
+ template <typename _Value>
class LPSolverBase {
public:
/// \e
+ typedef _Value Value;
+ /// \e
typedef IterablePartition<int>::ClassIt RowIt;
/// \e
typedef IterablePartition<int>::ClassIt ColIt;
@@ -191,14 +194,14 @@
virtual ColIt addCol() = 0;
/// temporally, glpk style indexing
virtual void setRowCoeffs(RowIt row_it, int num,
- int* indices, double* doubles) = 0;
- //pair<RowIt, double>-bol kell megadni egy std range-et
+ int* indices, _Value* doubles) = 0;
+ //pair<RowIt, _Value>-bol kell megadni egy std range-et
/// \e
template <typename Begin, typename End>
void setRowCoeffs(RowIt row_it, Begin begin, End end) {
int mem_length=1+colNum();
int* indices = new int[mem_length];
- double* doubles = new double[mem_length];
+ _Value* doubles = new _Value[mem_length];
int length=0;
for ( ; begin!=end; ++begin) {
++length;
@@ -211,14 +214,14 @@
}
/// temporally, glpk style indexing
virtual void setColCoeffs(ColIt col_it, int num,
- int* indices, double* doubles) = 0;
- //pair<ColIt, double>-bol kell megadni egy std range-et
+ int* indices, _Value* doubles) = 0;
+ //pair<ColIt, _Value>-bol kell megadni egy std range-et
/// \e
template <typename Begin, typename End>
void setColCoeffs(ColIt col_it, Begin begin, End end) {
int mem_length=1+rowNum();
int* indices = new int[mem_length];
- double* doubles = new double[mem_length];
+ _Value* doubles = new _Value[mem_length];
int length=0;
for ( ; begin!=end; ++begin) {
++length;
@@ -235,14 +238,14 @@
virtual void eraseRow(const RowIt& row_it) = 0;
/// \e
virtual void setColBounds(const ColIt& col_it, int bound_type,
- double lo, double up) =0;
+ _Value lo, _Value up) =0;
/// \e
- virtual double getObjCoef(const ColIt& col_it) = 0;
+ virtual _Value getObjCoef(const ColIt& col_it) = 0;
/// \e
virtual void setRowBounds(const RowIt& row_it, int bound_type,
- double lo, double up) = 0;
+ _Value lo, _Value up) = 0;
/// \e
- virtual void setObjCoef(const ColIt& col_it, double obj_coef) = 0;
+ virtual void setObjCoef(const ColIt& col_it, _Value obj_coef) = 0;
/// \e
virtual void solveSimplex() = 0;
/// \e
@@ -250,9 +253,9 @@
/// \e
virtual void solveDualSimplex() = 0;
/// \e
- virtual double getPrimal(const ColIt& col_it) = 0;
+ virtual _Value getPrimal(const ColIt& col_it) = 0;
/// \e
- virtual double getObjVal() = 0;
+ virtual _Value getObjVal() = 0;
/// \e
virtual int rowNum() const = 0;
/// \e
@@ -279,6 +282,7 @@
virtual void printColStatus(int i) = 0;
};
+
/// \brief Wrappers for LP solvers
///
/// This class implements a lemon wrapper for glpk.
@@ -286,9 +290,9 @@
/// The aim of this class is to give a general surface to different
/// solvers, i.e. it makes possible to write algorithms using LP's,
/// in which the solver can be changed to an other one easily.
- class LPSolverWrapper : public LPSolverBase {
+ class LPSolverWrapper : public LPSolverBase<double> {
public:
- typedef LPSolverBase Parent;
+ typedef LPSolverBase<double> Parent;
// class Row {
// protected:
@@ -323,7 +327,7 @@
public:
/// \e
- LPSolverWrapper() : LPSolverBase(),
+ LPSolverWrapper() : Parent(),
lp(lpx_create_prob()) {
lpx_set_int_parm(lp, LPX_K_DUAL, 1);
}
More information about the Lemon-commits
mailing list