# HG changeset patch # User marci # Date 1104861281 0 # Node ID 38a49245a701046085d781fb459c72de45055de0 # Parent a6094968ed09f56d391e3bca28a81a5bb8db10fd minor changes for various number types diff -r a6094968ed09 -r 38a49245a701 src/work/marci/lp/lp_solver_wrapper_2.h --- a/src/work/marci/lp/lp_solver_wrapper_2.h Tue Jan 04 17:16:35 2005 +0000 +++ b/src/work/marci/lp/lp_solver_wrapper_2.h Tue Jan 04 17:54:41 2005 +0000 @@ -159,9 +159,12 @@ /*! \e */ + template class LPSolverBase { public: /// \e + typedef _Value Value; + /// \e typedef IterablePartition::ClassIt RowIt; /// \e typedef IterablePartition::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-bol kell megadni egy std range-et + int* indices, _Value* doubles) = 0; + //pair-bol kell megadni egy std range-et /// \e template 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-bol kell megadni egy std range-et + int* indices, _Value* doubles) = 0; + //pair-bol kell megadni egy std range-et /// \e template 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 { public: - typedef LPSolverBase Parent; + typedef LPSolverBase 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); }