Documentation of abstract functions is in lp_solver_skeleton.h
authoralpar
Sun, 03 Apr 2005 10:20:49 +0000
changeset 12942dec219d9ca2
parent 1293 8ede2a6b2594
child 1295 02a403c305b9
Documentation of abstract functions is in lp_solver_skeleton.h
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
     1.1 --- a/src/work/athos/lp/lp_base.h	Fri Apr 01 19:50:29 2005 +0000
     1.2 +++ b/src/work/athos/lp/lp_base.h	Sun Apr 03 10:20:49 2005 +0000
     1.3 @@ -361,69 +361,26 @@
     1.4      _FixId rows;
     1.5      _FixId cols;
     1.6  
     1.7 -    /// \e
     1.8      virtual int _addCol() = 0;
     1.9 -    /// \e
    1.10      virtual int _addRow() = 0;
    1.11 -    /// \e
    1.12 -
    1.13 -    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
    1.14 -    ///
    1.15      virtual void _setRowCoeffs(int i, 
    1.16  			       int length,
    1.17                                 int  const * indices, 
    1.18                                 Value  const * values ) = 0;
    1.19 -    /// \e
    1.20 -
    1.21 -    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
    1.22 -    ///
    1.23      virtual void _setColCoeffs(int i, 
    1.24  			       int length,
    1.25                                 int  const * indices, 
    1.26                                 Value  const * values ) = 0;
    1.27 -    
    1.28 -    /// \e
    1.29 +    virtual void _setColLowerBound(int i, Value value) = 0;
    1.30 +    virtual void _setColUpperBound(int i, Value value) = 0;
    1.31 +    virtual void _setRowLowerBound(int i, Value value) = 0;
    1.32 +    virtual void _setRowUpperBound(int i, Value value) = 0;
    1.33 +    virtual void _setObjCoeff(int i, Value obj_coef) = 0;
    1.34 +    virtual SolutionStatus _solve() = 0;
    1.35 +    virtual Value _getPrimal(int i) = 0;
    1.36 +    virtual SolutionType _getPrimalType() = 0;
    1.37  
    1.38 -    /// The lower bound of a variable (column) have to be given by an 
    1.39 -    /// extended number of type Value, i.e. a finite number of type 
    1.40 -    /// Value or -\ref INF.
    1.41 -    virtual void _setColLowerBound(int i, Value value) = 0;
    1.42 -    /// \e
    1.43  
    1.44 -    /// The upper bound of a variable (column) have to be given by an 
    1.45 -    /// extended number of type Value, i.e. a finite number of type 
    1.46 -    /// Value or \ref INF.
    1.47 -    virtual void _setColUpperBound(int i, Value value) = 0;
    1.48 -    /// \e
    1.49 -
    1.50 -    /// The lower bound of a linear expression (row) have to be given by an 
    1.51 -    /// extended number of type Value, i.e. a finite number of type 
    1.52 -    /// Value or -\ref INF.
    1.53 -    virtual void _setRowLowerBound(int i, Value value) = 0;
    1.54 -    /// \e
    1.55 -
    1.56 -    /// The upper bound of a linear expression (row) have to be given by an 
    1.57 -    /// extended number of type Value, i.e. a finite number of type 
    1.58 -    /// Value or \ref INF.
    1.59 -    virtual void _setRowUpperBound(int i, Value value) = 0;
    1.60 -
    1.61 -    /// \e
    1.62 -    virtual void _setObjCoeff(int i, Value obj_coef) = 0;
    1.63 -
    1.64 -    ///\e
    1.65 -    
    1.66 -    ///\bug Wrong interface
    1.67 -    ///
    1.68 -    virtual SolutionStatus _solve() = 0;
    1.69 -
    1.70 -    ///\e
    1.71 -
    1.72 -    ///\bug Wrong interface
    1.73 -    ///
    1.74 -    virtual Value _getPrimal(int i) = 0;
    1.75 -    ///\e
    1.76 -
    1.77 -    ///\bug unimplemented!!!!
    1.78      void clearObj() {}
    1.79    public:
    1.80  
    1.81 @@ -431,15 +388,15 @@
    1.82      ///\e
    1.83      virtual ~LpSolverBase() {}
    1.84  
    1.85 -    ///\name Building up and modification of the LP
    1.86 +    ///\name Build up and modify of the LP
    1.87  
    1.88      ///@{
    1.89  
    1.90      ///Add a new empty column (i.e a new variable) to the LP
    1.91      Col addCol() { Col c; c.id=cols.insert(_addCol()); return c;}
    1.92  
    1.93 -    ///\brief Fill the elements of a container with newly created columns
    1.94 -    ///(i.e a new variables)
    1.95 +    ///\brief Adds several new columns
    1.96 +    ///(i.e a variables) at once
    1.97      ///
    1.98      ///This magic function takes a container as its argument
    1.99      ///and fills its elements
   1.100 @@ -638,7 +595,7 @@
   1.101      ///@}
   1.102  
   1.103  
   1.104 -    ///\name Solving the LP
   1.105 +    ///\name Solve the LP
   1.106  
   1.107      ///@{
   1.108  
   1.109 @@ -647,11 +604,16 @@
   1.110      
   1.111      ///@}
   1.112      
   1.113 -    ///\name Obtaining the solution LP
   1.114 +    ///\name Obtain the solution
   1.115  
   1.116      ///@{
   1.117  
   1.118      ///\e
   1.119 +    SolutionType primalType() {
   1.120 +      return _getPrimalType();
   1.121 +    }
   1.122 +
   1.123 +    ///\e
   1.124      Value primal(Col c) { return _getPrimal(cols.floatingId(c.id)); }
   1.125  
   1.126      ///@}
     2.1 --- a/src/work/athos/lp/lp_glpk.cc	Fri Apr 01 19:50:29 2005 +0000
     2.2 +++ b/src/work/athos/lp/lp_glpk.cc	Sun Apr 03 10:20:49 2005 +0000
     2.3 @@ -248,6 +248,11 @@
     2.4      return 0;
     2.5    }
     2.6    
     2.7 +  LpGlpk::SolutionType LpGlpk::_getPrimalType()
     2.8 +  {
     2.9 +    return OPTIMAL;
    2.10 +  }
    2.11 +  
    2.12  
    2.13  
    2.14  } //END OF NAMESPACE LEMON
     3.1 --- a/src/work/athos/lp/lp_glpk.h	Fri Apr 01 19:50:29 2005 +0000
     3.2 +++ b/src/work/athos/lp/lp_glpk.h	Sun Apr 03 10:20:49 2005 +0000
     3.3 @@ -76,6 +76,11 @@
     3.4      ///\bug Unimplemented
     3.5      ///
     3.6      virtual Value _getPrimal(int i);
     3.7 +    ///\e
     3.8 +    
     3.9 +    ///\bug Unimplemented
    3.10 +    ///
    3.11 +    virtual SolutionType _getPrimalType();
    3.12  
    3.13    };
    3.14  } //END OF NAMESPACE LEMON
     4.1 --- a/src/work/athos/lp/lp_solver_skeleton.cc	Fri Apr 01 19:50:29 2005 +0000
     4.2 +++ b/src/work/athos/lp/lp_solver_skeleton.cc	Sun Apr 03 10:20:49 2005 +0000
     4.3 @@ -75,5 +75,10 @@
     4.4      return 0;
     4.5    }
     4.6    
     4.7 +  LpSolverSkeleton::SolutionType LpSolverSkeleton::_getPrimalType()
     4.8 +  {
     4.9 +    return OPTIMAL;
    4.10 +  }
    4.11 +  
    4.12  } //namespace lemon
    4.13  
     5.1 --- a/src/work/athos/lp/lp_solver_skeleton.h	Fri Apr 01 19:50:29 2005 +0000
     5.2 +++ b/src/work/athos/lp/lp_solver_skeleton.h	Sun Apr 03 10:20:49 2005 +0000
     5.3 @@ -29,23 +29,72 @@
     5.4      int col_num,row_num;
     5.5      
     5.6    protected:
     5.7 +    /// \e
     5.8      virtual int _addCol();
     5.9 +    /// \e
    5.10      virtual int _addRow();
    5.11 +    /// \e
    5.12 +
    5.13 +    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
    5.14 +    ///
    5.15      virtual void _setRowCoeffs(int i, 
    5.16  			       int length,
    5.17                                 int  const * indices, 
    5.18                                 Value  const * values );
    5.19 +    /// \e
    5.20 +
    5.21 +    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
    5.22 +    ///
    5.23      virtual void _setColCoeffs(int i, 
    5.24  			       int length,
    5.25                                 int  const * indices, 
    5.26 -                               Value  const * values);
    5.27 +                               Value  const * values );
    5.28 +    
    5.29 +    /// \e
    5.30 +
    5.31 +    /// The lower bound of a variable (column) have to be given by an 
    5.32 +    /// extended number of type Value, i.e. a finite number of type 
    5.33 +    /// Value or -\ref INF.
    5.34      virtual void _setColLowerBound(int i, Value value);
    5.35 +    /// \e
    5.36 +
    5.37 +    /// The upper bound of a variable (column) have to be given by an 
    5.38 +    /// extended number of type Value, i.e. a finite number of type 
    5.39 +    /// Value or \ref INF.
    5.40      virtual void _setColUpperBound(int i, Value value);
    5.41 +    /// \e
    5.42 +
    5.43 +    /// The lower bound of a linear expression (row) have to be given by an 
    5.44 +    /// extended number of type Value, i.e. a finite number of type 
    5.45 +    /// Value or -\ref INF.
    5.46      virtual void _setRowLowerBound(int i, Value value);
    5.47 +    /// \e
    5.48 +
    5.49 +    /// The upper bound of a linear expression (row) have to be given by an 
    5.50 +    /// extended number of type Value, i.e. a finite number of type 
    5.51 +    /// Value or \ref INF.
    5.52      virtual void _setRowUpperBound(int i, Value value);
    5.53 +
    5.54 +    /// \e
    5.55      virtual void _setObjCoeff(int i, Value obj_coef);
    5.56 +
    5.57 +    ///\e
    5.58 +    
    5.59 +    ///\bug Wrong interface
    5.60 +    ///
    5.61      virtual SolutionStatus _solve();
    5.62 +
    5.63 +    ///\e
    5.64 +
    5.65 +    ///\bug Wrong interface
    5.66 +    ///
    5.67      virtual Value _getPrimal(int i);
    5.68 +    ///\e
    5.69 +
    5.70 +    ///\bug Wrong interface
    5.71 +    ///
    5.72 +    virtual SolutionType _getPrimalType();
    5.73 +
    5.74    public:
    5.75      LpSolverSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
    5.76    };