# HG changeset patch # User alpar # Date 1112385029 0 # Node ID 8ede2a6b25946e1165f084cec484a1c3aaca28f1 # Parent 58567408752223cc298772665629edb56829f96a - Make lp stuff compilable - Some 'set's removed diff -r 585674087522 -r 8ede2a6b2594 src/work/athos/lp/lp_base.h --- a/src/work/athos/lp/lp_base.h Fri Apr 01 14:13:32 2005 +0000 +++ b/src/work/athos/lp/lp_base.h Fri Apr 01 19:50:29 2005 +0000 @@ -105,27 +105,23 @@ public: ///\e - enum SolutionXXXType { + enum SolutionStatus { ///\e - INFEASIBLE = 0, + SOLVED = 0, ///\e - UNBOUNDED = 1, - ///\e - OPTIMAL = 2, - ///\e - FEASIBLE = 3 + UNSOLVED = 1 }; ///\e enum SolutionType { ///\e - INFEASIBLE = 0, + UNDEFINED = 0, ///\e - UNDEFINED = 1, + INFEASIBLE = 1, ///\e - OPTIMAL = 2, + FEASIBLE = 2, ///\e - FEASIBLE = 3 + OPTIMAL = 3 }; ///The floating point type used by the solver @@ -418,13 +414,13 @@ ///\bug Wrong interface /// - virtual SolutionXXXType _solve() = 0; + virtual SolutionStatus _solve() = 0; ///\e ///\bug Wrong interface /// - virtual Value _getSolution(int i) = 0; + virtual Value _getPrimal(int i) = 0; ///\e ///\bug unimplemented!!!! @@ -575,38 +571,60 @@ /// Set the lower bound of a column (i.e a variable) - /// The upper bound of a variable (column) have to be given by an + /// The upper bound of a variable (column) has to be given by an /// extended number of type Value, i.e. a finite number of type /// Value or -\ref INF. - void setColLowerBound(Col c, Value value) { + void colLowerBound(Col c, Value value) { _setColLowerBound(cols.floatingId(c.id),value); } /// Set the upper bound of a column (i.e a variable) - /// The upper bound of a variable (column) have to be given by an + /// The upper bound of a variable (column) has to be given by an /// extended number of type Value, i.e. a finite number of type /// Value or \ref INF. - void setColUpperBound(Col c, Value value) { + void colUpperBound(Col c, Value value) { _setColUpperBound(cols.floatingId(c.id),value); }; + /// Set the lower and the upper bounds of a column (i.e a variable) + + /// The lower and the upper bounds of + /// a variable (column) have to be given by an + /// extended number of type Value, i.e. a finite number of type + /// Value, -\ref INF or \ref INF. + void colBounds(Col c, Value lower, Value upper) { + _setColLowerBound(cols.floatingId(c.id),lower); + _setColUpperBound(cols.floatingId(c.id),upper); + } + /// Set the lower bound of a row (i.e a constraint) - /// The lower bound of a linear expression (row) have to be given by an + /// The lower bound of a linear expression (row) has to be given by an /// extended number of type Value, i.e. a finite number of type /// Value or -\ref INF. - void setRowLowerBound(Row r, Value value) { + void rowLowerBound(Row r, Value value) { _setRowLowerBound(rows.floatingId(r.id),value); }; /// Set the upper bound of a row (i.e a constraint) - /// The upper bound of a linear expression (row) have to be given by an + /// The upper bound of a linear expression (row) has to be given by an /// extended number of type Value, i.e. a finite number of type /// Value or \ref INF. - void setRowUpperBound(Row r, Value value) { + void rowUpperBound(Row r, Value value) { _setRowUpperBound(rows.floatingId(r.id),value); }; + /// Set the lower and the upper bounds of a row (i.e a variable) + + /// The lower and the upper bounds of + /// a constraint (row) have to be given by an + /// extended number of type Value, i.e. a finite number of type + /// Value, -\ref INF or \ref INF. + void rowBounds(Row c, Value lower, Value upper) { + _setRowLowerBound(rows.floatingId(c.id),lower); + _setRowUpperBound(rows.floatingId(c.id),upper); + } + ///Set an element of the objective function - void setObjCoeff(Col c, Value v) {_setObjCoeff(cols.floatingId(c.id),v); }; + void objCoeff(Col c, Value v) {_setObjCoeff(cols.floatingId(c.id),v); }; ///Set the objective function ///\param e is a linear expression of type \ref Expr. @@ -614,7 +632,7 @@ void setObj(Expr e) { clearObj(); for (Expr::iterator i=e.begin(); i!=e.end(); ++i) - setObjCoeff((*i).first,(*i).second); + objCoeff((*i).first,(*i).second); } ///@} @@ -625,7 +643,7 @@ ///@{ ///\e - SolutionType solve() { return _solve(); } + SolutionStatus solve() { return _solve(); } ///@} @@ -634,7 +652,7 @@ ///@{ ///\e - Value solution(Col c) { return _getSolution(cols.floatingId(c.id)); } + Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); } ///@} diff -r 585674087522 -r 8ede2a6b2594 src/work/athos/lp/lp_glpk.cc --- a/src/work/athos/lp/lp_glpk.cc Fri Apr 01 14:13:32 2005 +0000 +++ b/src/work/athos/lp/lp_glpk.cc Fri Apr 01 19:50:29 2005 +0000 @@ -238,12 +238,12 @@ } - LpGlpk::SolutionType LpGlpk::_solve() + LpGlpk::SolutionStatus LpGlpk::_solve() { - return OPTIMAL; + return SOLVED; } - LpGlpk::Value LpGlpk::_getSolution(int i) + LpGlpk::Value LpGlpk::_getPrimal(int i) { return 0; } diff -r 585674087522 -r 8ede2a6b2594 src/work/athos/lp/lp_glpk.h --- a/src/work/athos/lp/lp_glpk.h Fri Apr 01 14:13:32 2005 +0000 +++ b/src/work/athos/lp/lp_glpk.h Fri Apr 01 19:50:29 2005 +0000 @@ -70,12 +70,12 @@ ///\bug Unimplemented /// - virtual SolutionType _solve(); + virtual SolutionStatus _solve(); ///\e ///\bug Unimplemented /// - virtual Value _getSolution(int i); + virtual Value _getPrimal(int i); }; } //END OF NAMESPACE LEMON diff -r 585674087522 -r 8ede2a6b2594 src/work/athos/lp/lp_solver_skeleton.cc --- a/src/work/athos/lp/lp_solver_skeleton.cc Fri Apr 01 14:13:32 2005 +0000 +++ b/src/work/athos/lp/lp_solver_skeleton.cc Fri Apr 01 19:50:29 2005 +0000 @@ -65,12 +65,12 @@ { } - LpSolverSkeleton::SolutionType LpSolverSkeleton::_solve() + LpSolverSkeleton::SolutionStatus LpSolverSkeleton::_solve() { - return OPTIMAL; + return SOLVED; } - LpSolverSkeleton::Value LpSolverSkeleton::_getSolution(int i) + LpSolverSkeleton::Value LpSolverSkeleton::_getPrimal(int i) { return 0; } diff -r 585674087522 -r 8ede2a6b2594 src/work/athos/lp/lp_solver_skeleton.h --- a/src/work/athos/lp/lp_solver_skeleton.h Fri Apr 01 14:13:32 2005 +0000 +++ b/src/work/athos/lp/lp_solver_skeleton.h Fri Apr 01 19:50:29 2005 +0000 @@ -44,8 +44,8 @@ virtual void _setRowLowerBound(int i, Value value); virtual void _setRowUpperBound(int i, Value value); virtual void _setObjCoeff(int i, Value obj_coef); - virtual SolutionType _solve(); - virtual Value _getSolution(int i); + virtual SolutionStatus _solve(); + virtual Value _getPrimal(int i); public: LpSolverSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} }; diff -r 585674087522 -r 8ede2a6b2594 src/work/athos/lp/lp_test.cc --- a/src/work/athos/lp/lp_test.cc Fri Apr 01 14:13:32 2005 +0000 +++ b/src/work/athos/lp/lp_test.cc Fri Apr 01 19:50:29 2005 +0000 @@ -143,8 +143,8 @@ lp.addColSet(x); for(EdgeIt e(g);e!=INVALID;++e) { - lp.setColUpperBound(x[e],cap[e]); - lp.setColLowerBound(x[e],0); + lp.colUpperBound(x[e],cap[e]); + lp.colLowerBound(x[e],0); } for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) {