- Make lp stuff compilable
authoralpar
Fri, 01 Apr 2005 19:50:29 +0000
changeset 12938ede2a6b2594
parent 1292 585674087522
child 1294 2dec219d9ca2
- Make lp stuff compilable
- Some 'set's removed
src/work/athos/lp/lp_base.h
src/work/athos/lp/lp_glpk.cc
src/work/athos/lp/lp_glpk.h
src/work/athos/lp/lp_solver_skeleton.cc
src/work/athos/lp/lp_solver_skeleton.h
src/work/athos/lp/lp_test.cc
     1.1 --- a/src/work/athos/lp/lp_base.h	Fri Apr 01 14:13:32 2005 +0000
     1.2 +++ b/src/work/athos/lp/lp_base.h	Fri Apr 01 19:50:29 2005 +0000
     1.3 @@ -105,27 +105,23 @@
     1.4    public:
     1.5  
     1.6      ///\e
     1.7 -    enum SolutionXXXType {
     1.8 +    enum SolutionStatus {
     1.9        ///\e
    1.10 -      INFEASIBLE = 0,
    1.11 +      SOLVED = 0,
    1.12        ///\e
    1.13 -      UNBOUNDED = 1,
    1.14 -      ///\e
    1.15 -      OPTIMAL = 2,
    1.16 -      ///\e
    1.17 -      FEASIBLE = 3
    1.18 +      UNSOLVED = 1
    1.19      };
    1.20        
    1.21      ///\e
    1.22      enum SolutionType {
    1.23        ///\e
    1.24 -      INFEASIBLE = 0,
    1.25 +      UNDEFINED = 0,
    1.26        ///\e
    1.27 -      UNDEFINED = 1,
    1.28 +      INFEASIBLE = 1,
    1.29        ///\e
    1.30 -      OPTIMAL = 2,
    1.31 +      FEASIBLE = 2,
    1.32        ///\e
    1.33 -      FEASIBLE = 3
    1.34 +      OPTIMAL = 3
    1.35      };
    1.36        
    1.37      ///The floating point type used by the solver
    1.38 @@ -418,13 +414,13 @@
    1.39      
    1.40      ///\bug Wrong interface
    1.41      ///
    1.42 -    virtual SolutionXXXType _solve() = 0;
    1.43 +    virtual SolutionStatus _solve() = 0;
    1.44  
    1.45      ///\e
    1.46  
    1.47      ///\bug Wrong interface
    1.48      ///
    1.49 -    virtual Value _getSolution(int i) = 0;
    1.50 +    virtual Value _getPrimal(int i) = 0;
    1.51      ///\e
    1.52  
    1.53      ///\bug unimplemented!!!!
    1.54 @@ -575,38 +571,60 @@
    1.55  
    1.56      /// Set the lower bound of a column (i.e a variable)
    1.57  
    1.58 -    /// The upper bound of a variable (column) have to be given by an 
    1.59 +    /// The upper bound of a variable (column) has to be given by an 
    1.60      /// extended number of type Value, i.e. a finite number of type 
    1.61      /// Value or -\ref INF.
    1.62 -    void setColLowerBound(Col c, Value value) {
    1.63 +    void colLowerBound(Col c, Value value) {
    1.64        _setColLowerBound(cols.floatingId(c.id),value);
    1.65      }
    1.66      /// Set the upper bound of a column (i.e a variable)
    1.67  
    1.68 -    /// The upper bound of a variable (column) have to be given by an 
    1.69 +    /// The upper bound of a variable (column) has to be given by an 
    1.70      /// extended number of type Value, i.e. a finite number of type 
    1.71      /// Value or \ref INF.
    1.72 -    void setColUpperBound(Col c, Value value) {
    1.73 +    void colUpperBound(Col c, Value value) {
    1.74        _setColUpperBound(cols.floatingId(c.id),value);
    1.75      };
    1.76 +    /// Set the lower and the upper bounds of a column (i.e a variable)
    1.77 +
    1.78 +    /// The lower and the upper bounds of
    1.79 +    /// a variable (column) have to be given by an 
    1.80 +    /// extended number of type Value, i.e. a finite number of type 
    1.81 +    /// Value, -\ref INF or \ref INF.
    1.82 +    void colBounds(Col c, Value lower, Value upper) {
    1.83 +      _setColLowerBound(cols.floatingId(c.id),lower);
    1.84 +      _setColUpperBound(cols.floatingId(c.id),upper);
    1.85 +    }
    1.86 +    
    1.87      /// Set the lower bound of a row (i.e a constraint)
    1.88  
    1.89 -    /// The lower bound of a linear expression (row) have to be given by an 
    1.90 +    /// The lower bound of a linear expression (row) has to be given by an 
    1.91      /// extended number of type Value, i.e. a finite number of type 
    1.92      /// Value or -\ref INF.
    1.93 -    void setRowLowerBound(Row r, Value value) {
    1.94 +    void rowLowerBound(Row r, Value value) {
    1.95        _setRowLowerBound(rows.floatingId(r.id),value);
    1.96      };
    1.97      /// Set the upper bound of a row (i.e a constraint)
    1.98  
    1.99 -    /// The upper bound of a linear expression (row) have to be given by an 
   1.100 +    /// The upper bound of a linear expression (row) has to be given by an 
   1.101      /// extended number of type Value, i.e. a finite number of type 
   1.102      /// Value or \ref INF.
   1.103 -    void setRowUpperBound(Row r, Value value) {
   1.104 +    void rowUpperBound(Row r, Value value) {
   1.105        _setRowUpperBound(rows.floatingId(r.id),value);
   1.106      };
   1.107 +    /// Set the lower and the upper bounds of a row (i.e a variable)
   1.108 +
   1.109 +    /// The lower and the upper bounds of
   1.110 +    /// a constraint (row) have to be given by an 
   1.111 +    /// extended number of type Value, i.e. a finite number of type 
   1.112 +    /// Value, -\ref INF or \ref INF.
   1.113 +    void rowBounds(Row c, Value lower, Value upper) {
   1.114 +      _setRowLowerBound(rows.floatingId(c.id),lower);
   1.115 +      _setRowUpperBound(rows.floatingId(c.id),upper);
   1.116 +    }
   1.117 +    
   1.118      ///Set an element of the objective function
   1.119 -    void setObjCoeff(Col c, Value v) {_setObjCoeff(cols.floatingId(c.id),v); };
   1.120 +    void objCoeff(Col c, Value v) {_setObjCoeff(cols.floatingId(c.id),v); };
   1.121      ///Set the objective function
   1.122      
   1.123      ///\param e is a linear expression of type \ref Expr.
   1.124 @@ -614,7 +632,7 @@
   1.125      void setObj(Expr e) {
   1.126        clearObj();
   1.127        for (Expr::iterator i=e.begin(); i!=e.end(); ++i)
   1.128 -	setObjCoeff((*i).first,(*i).second);
   1.129 +	objCoeff((*i).first,(*i).second);
   1.130      }
   1.131  
   1.132      ///@}
   1.133 @@ -625,7 +643,7 @@
   1.134      ///@{
   1.135  
   1.136      ///\e
   1.137 -    SolutionType solve() { return _solve(); }
   1.138 +    SolutionStatus solve() { return _solve(); }
   1.139      
   1.140      ///@}
   1.141      
   1.142 @@ -634,7 +652,7 @@
   1.143      ///@{
   1.144  
   1.145      ///\e
   1.146 -    Value solution(Col c) { return _getSolution(cols.floatingId(c.id)); }
   1.147 +    Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); }
   1.148  
   1.149      ///@}
   1.150      
     2.1 --- a/src/work/athos/lp/lp_glpk.cc	Fri Apr 01 14:13:32 2005 +0000
     2.2 +++ b/src/work/athos/lp/lp_glpk.cc	Fri Apr 01 19:50:29 2005 +0000
     2.3 @@ -238,12 +238,12 @@
     2.4      }
     2.5  
     2.6  
     2.7 -  LpGlpk::SolutionType LpGlpk::_solve()
     2.8 +  LpGlpk::SolutionStatus LpGlpk::_solve()
     2.9    {
    2.10 -    return OPTIMAL;
    2.11 +    return SOLVED;
    2.12    }
    2.13  
    2.14 -  LpGlpk::Value LpGlpk::_getSolution(int i)
    2.15 +  LpGlpk::Value LpGlpk::_getPrimal(int i)
    2.16    {
    2.17      return 0;
    2.18    }
     3.1 --- a/src/work/athos/lp/lp_glpk.h	Fri Apr 01 14:13:32 2005 +0000
     3.2 +++ b/src/work/athos/lp/lp_glpk.h	Fri Apr 01 19:50:29 2005 +0000
     3.3 @@ -70,12 +70,12 @@
     3.4      
     3.5      ///\bug Unimplemented
     3.6      ///
     3.7 -    virtual SolutionType _solve();
     3.8 +    virtual SolutionStatus _solve();
     3.9      ///\e
    3.10      
    3.11      ///\bug Unimplemented
    3.12      ///
    3.13 -    virtual Value _getSolution(int i);
    3.14 +    virtual Value _getPrimal(int i);
    3.15  
    3.16    };
    3.17  } //END OF NAMESPACE LEMON
     4.1 --- a/src/work/athos/lp/lp_solver_skeleton.cc	Fri Apr 01 14:13:32 2005 +0000
     4.2 +++ b/src/work/athos/lp/lp_solver_skeleton.cc	Fri Apr 01 19:50:29 2005 +0000
     4.3 @@ -65,12 +65,12 @@
     4.4    {
     4.5    }
     4.6  
     4.7 -  LpSolverSkeleton::SolutionType LpSolverSkeleton::_solve()
     4.8 +  LpSolverSkeleton::SolutionStatus LpSolverSkeleton::_solve()
     4.9    {
    4.10 -    return OPTIMAL;
    4.11 +    return SOLVED;
    4.12    }
    4.13  
    4.14 -  LpSolverSkeleton::Value LpSolverSkeleton::_getSolution(int i)
    4.15 +  LpSolverSkeleton::Value LpSolverSkeleton::_getPrimal(int i)
    4.16    {
    4.17      return 0;
    4.18    }
     5.1 --- a/src/work/athos/lp/lp_solver_skeleton.h	Fri Apr 01 14:13:32 2005 +0000
     5.2 +++ b/src/work/athos/lp/lp_solver_skeleton.h	Fri Apr 01 19:50:29 2005 +0000
     5.3 @@ -44,8 +44,8 @@
     5.4      virtual void _setRowLowerBound(int i, Value value);
     5.5      virtual void _setRowUpperBound(int i, Value value);
     5.6      virtual void _setObjCoeff(int i, Value obj_coef);
     5.7 -    virtual SolutionType _solve();
     5.8 -    virtual Value _getSolution(int i);
     5.9 +    virtual SolutionStatus _solve();
    5.10 +    virtual Value _getPrimal(int i);
    5.11    public:
    5.12      LpSolverSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
    5.13    };  
     6.1 --- a/src/work/athos/lp/lp_test.cc	Fri Apr 01 14:13:32 2005 +0000
     6.2 +++ b/src/work/athos/lp/lp_test.cc	Fri Apr 01 19:50:29 2005 +0000
     6.3 @@ -143,8 +143,8 @@
     6.4    lp.addColSet(x);
     6.5    
     6.6    for(EdgeIt e(g);e!=INVALID;++e) {
     6.7 -    lp.setColUpperBound(x[e],cap[e]);
     6.8 -    lp.setColLowerBound(x[e],0);
     6.9 +    lp.colUpperBound(x[e],cap[e]);
    6.10 +    lp.colLowerBound(x[e],0);
    6.11    }
    6.12  
    6.13    for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) {