# HG changeset patch # User alpar # Date 1112523649 0 # Node ID 2dec219d9ca2203dc0294375febb1917b8005704 # Parent 8ede2a6b25946e1165f084cec484a1c3aaca28f1 Documentation of abstract functions is in lp_solver_skeleton.h diff -r 8ede2a6b2594 -r 2dec219d9ca2 src/work/athos/lp/lp_base.h --- a/src/work/athos/lp/lp_base.h Fri Apr 01 19:50:29 2005 +0000 +++ b/src/work/athos/lp/lp_base.h Sun Apr 03 10:20:49 2005 +0000 @@ -361,69 +361,26 @@ _FixId rows; _FixId cols; - /// \e virtual int _addCol() = 0; - /// \e virtual int _addRow() = 0; - /// \e - - /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) - /// virtual void _setRowCoeffs(int i, int length, int const * indices, Value const * values ) = 0; - /// \e - - /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) - /// virtual void _setColCoeffs(int i, int length, int const * indices, Value const * values ) = 0; - - /// \e + virtual void _setColLowerBound(int i, Value value) = 0; + virtual void _setColUpperBound(int i, Value value) = 0; + virtual void _setRowLowerBound(int i, Value value) = 0; + virtual void _setRowUpperBound(int i, Value value) = 0; + virtual void _setObjCoeff(int i, Value obj_coef) = 0; + virtual SolutionStatus _solve() = 0; + virtual Value _getPrimal(int i) = 0; + virtual SolutionType _getPrimalType() = 0; - /// 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 -\ref INF. - virtual void _setColLowerBound(int i, Value value) = 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 \ref INF. - virtual void _setColUpperBound(int i, Value value) = 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 -\ref INF. - virtual void _setRowLowerBound(int i, Value value) = 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 \ref INF. - virtual void _setRowUpperBound(int i, Value value) = 0; - - /// \e - virtual void _setObjCoeff(int i, Value obj_coef) = 0; - - ///\e - - ///\bug Wrong interface - /// - virtual SolutionStatus _solve() = 0; - - ///\e - - ///\bug Wrong interface - /// - virtual Value _getPrimal(int i) = 0; - ///\e - - ///\bug unimplemented!!!! void clearObj() {} public: @@ -431,15 +388,15 @@ ///\e virtual ~LpSolverBase() {} - ///\name Building up and modification of the LP + ///\name Build up and modify of the LP ///@{ ///Add a new empty column (i.e a new variable) to the LP Col addCol() { Col c; c.id=cols.insert(_addCol()); return c;} - ///\brief Fill the elements of a container with newly created columns - ///(i.e a new variables) + ///\brief Adds several new columns + ///(i.e a variables) at once /// ///This magic function takes a container as its argument ///and fills its elements @@ -638,7 +595,7 @@ ///@} - ///\name Solving the LP + ///\name Solve the LP ///@{ @@ -647,11 +604,16 @@ ///@} - ///\name Obtaining the solution LP + ///\name Obtain the solution ///@{ ///\e + SolutionType primalType() { + return _getPrimalType(); + } + + ///\e Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); } ///@} diff -r 8ede2a6b2594 -r 2dec219d9ca2 src/work/athos/lp/lp_glpk.cc --- a/src/work/athos/lp/lp_glpk.cc Fri Apr 01 19:50:29 2005 +0000 +++ b/src/work/athos/lp/lp_glpk.cc Sun Apr 03 10:20:49 2005 +0000 @@ -248,6 +248,11 @@ return 0; } + LpGlpk::SolutionType LpGlpk::_getPrimalType() + { + return OPTIMAL; + } + } //END OF NAMESPACE LEMON diff -r 8ede2a6b2594 -r 2dec219d9ca2 src/work/athos/lp/lp_glpk.h --- a/src/work/athos/lp/lp_glpk.h Fri Apr 01 19:50:29 2005 +0000 +++ b/src/work/athos/lp/lp_glpk.h Sun Apr 03 10:20:49 2005 +0000 @@ -76,6 +76,11 @@ ///\bug Unimplemented /// virtual Value _getPrimal(int i); + ///\e + + ///\bug Unimplemented + /// + virtual SolutionType _getPrimalType(); }; } //END OF NAMESPACE LEMON diff -r 8ede2a6b2594 -r 2dec219d9ca2 src/work/athos/lp/lp_solver_skeleton.cc --- a/src/work/athos/lp/lp_solver_skeleton.cc Fri Apr 01 19:50:29 2005 +0000 +++ b/src/work/athos/lp/lp_solver_skeleton.cc Sun Apr 03 10:20:49 2005 +0000 @@ -75,5 +75,10 @@ return 0; } + LpSolverSkeleton::SolutionType LpSolverSkeleton::_getPrimalType() + { + return OPTIMAL; + } + } //namespace lemon diff -r 8ede2a6b2594 -r 2dec219d9ca2 src/work/athos/lp/lp_solver_skeleton.h --- a/src/work/athos/lp/lp_solver_skeleton.h Fri Apr 01 19:50:29 2005 +0000 +++ b/src/work/athos/lp/lp_solver_skeleton.h Sun Apr 03 10:20:49 2005 +0000 @@ -29,23 +29,72 @@ int col_num,row_num; protected: + /// \e virtual int _addCol(); + /// \e virtual int _addRow(); + /// \e + + /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) + /// virtual void _setRowCoeffs(int i, int length, int const * indices, Value const * values ); + /// \e + + /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) + /// virtual void _setColCoeffs(int i, int length, int const * indices, - Value const * values); + Value const * values ); + + /// \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 -\ref INF. virtual void _setColLowerBound(int i, Value value); + /// \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 \ref INF. virtual void _setColUpperBound(int i, Value value); + /// \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 -\ref INF. virtual void _setRowLowerBound(int i, Value value); + /// \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 \ref INF. virtual void _setRowUpperBound(int i, Value value); + + /// \e virtual void _setObjCoeff(int i, Value obj_coef); + + ///\e + + ///\bug Wrong interface + /// virtual SolutionStatus _solve(); + + ///\e + + ///\bug Wrong interface + /// virtual Value _getPrimal(int i); + ///\e + + ///\bug Wrong interface + /// + virtual SolutionType _getPrimalType(); + public: LpSolverSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} };