Index: lemon/lp_base.h
===================================================================
--- lemon/lp_base.h	(revision 2364)
+++ lemon/lp_base.h	(revision 2366)
@@ -136,8 +136,8 @@
 
     class ColIt : public Col {
-      LpSolverBase *_lp;
+      const LpSolverBase *_lp;
     public:
       ColIt() {}
-      ColIt(LpSolverBase &lp) : _lp(&lp)
+      ColIt(const LpSolverBase &lp) : _lp(&lp)
       {
         _lp->cols.firstFix(id);
@@ -181,8 +181,8 @@
 
     class RowIt : public Row {
-      LpSolverBase *_lp;
+      const LpSolverBase *_lp;
     public:
       RowIt() {}
-      RowIt(LpSolverBase &lp) : _lp(&lp)
+      RowIt(const LpSolverBase &lp) : _lp(&lp)
       {
         _lp->rows.firstFix(id);
@@ -736,37 +736,39 @@
     virtual int _addCol() = 0;
     virtual int _addRow() = 0; 
+
     virtual void _eraseCol(int col) = 0;
     virtual void _eraseRow(int row) = 0;
-    virtual void _getColName(int col, std::string & name) = 0;
+
+    virtual void _getColName(int col, std::string & name) const = 0;
     virtual void _setColName(int col, const std::string & name) = 0;
+    virtual int _colByName(const std::string& name) const = 0;
+
     virtual void _setRowCoeffs(int i, ConstRowIterator b, 
                                ConstRowIterator e) = 0;
-    virtual void _getRowCoeffs(int i, RowIterator b) = 0;
+    virtual void _getRowCoeffs(int i, RowIterator b) const = 0;
     virtual void _setColCoeffs(int i, ConstColIterator b, 
                                ConstColIterator e) = 0;
-    virtual void _getColCoeffs(int i, ColIterator b) = 0;
+    virtual void _getColCoeffs(int i, ColIterator b) const = 0;
     virtual void _setCoeff(int row, int col, Value value) = 0;
-    virtual Value _getCoeff(int row, int col) = 0;
+    virtual Value _getCoeff(int row, int col) const = 0;
     virtual void _setColLowerBound(int i, Value value) = 0;
-    virtual Value _getColLowerBound(int i) = 0;
+    virtual Value _getColLowerBound(int i) const = 0;
     virtual void _setColUpperBound(int i, Value value) = 0;
-    virtual Value _getColUpperBound(int i) = 0;
+    virtual Value _getColUpperBound(int i) const = 0;
     virtual void _setRowBounds(int i, Value lower, Value upper) = 0;
-    virtual void _getRowBounds(int i, Value &lower, Value &upper)=0;
+    virtual void _getRowBounds(int i, Value &lower, Value &upper) const = 0;
 
     virtual void _setObjCoeff(int i, Value obj_coef) = 0;
-    virtual Value _getObjCoeff(int i) = 0;
+    virtual Value _getObjCoeff(int i) const = 0;
     virtual void _clearObj()=0;
 
     virtual SolveExitStatus _solve() = 0;
-    virtual Value _getPrimal(int i) = 0;
-    virtual Value _getDual(int i) = 0;
-    virtual Value _getPrimalValue() = 0;
-    virtual bool _isBasicCol(int i) = 0;
-    virtual SolutionStatus _getPrimalStatus() = 0;
-    virtual SolutionStatus _getDualStatus() = 0;
-    ///\todo This could be implemented here, too, using _getPrimalStatus() and
-    ///_getDualStatus()
-    virtual ProblemTypes _getProblemType() = 0;
+    virtual Value _getPrimal(int i) const = 0;
+    virtual Value _getDual(int i) const = 0;
+    virtual Value _getPrimalValue() const = 0;
+    virtual bool _isBasicCol(int i) const = 0;
+    virtual SolutionStatus _getPrimalStatus() const = 0;
+    virtual SolutionStatus _getDualStatus() const = 0;
+    virtual ProblemTypes _getProblemType() const = 0;
 
     virtual void _setMax() = 0;
@@ -774,5 +776,5 @@
     
 
-    virtual bool _isMax() = 0;
+    virtual bool _isMax() const = 0;
 
     //Own protected stuff
@@ -878,5 +880,5 @@
     ///\param r is the column to get
     ///\return the dual expression associated to the column
-    DualExpr col(Col c) {
+    DualExpr col(Col c) const {
       DualExpr e;
       _getColCoeffs(_lpId(c), ColIterator(std::inserter(e, e.end()), *this));
@@ -975,5 +977,5 @@
     ///\todo Option to control whether a constraint with a single variable is
     ///added or not.
-    void row(Row r, Value l,const Expr &e, Value u) {
+    void row(Row r, Value l, const Expr &e, Value u) {
       e.simplify();
       _setRowCoeffs(_lpId(r), ConstRowIterator(e.begin(), *this),
@@ -996,5 +998,5 @@
     ///\param r is the row to get
     ///\return the expression associated to the row
-    Expr row(Row r) {
+    Expr row(Row r) const {
       Expr e;
       _getRowCoeffs(_lpId(r), RowIterator(std::inserter(e, e.end()), *this));
@@ -1046,5 +1048,5 @@
     ///\param c is the coresponding coloumn 
     ///\return The name of the colunm
-    std::string colName(Col c){
+    std::string colName(Col c) const {
       std::string name;
       _getColName(_lpId(c), name);
@@ -1056,5 +1058,5 @@
     ///\param c is the coresponding coloumn 
     ///\param name The name to be given
-    void colName(Col c, const std::string& name){
+    void colName(Col c, const std::string& name) {
       _setColName(_lpId(c), name);
     }
@@ -1066,5 +1068,5 @@
     ///\param val is the new value of the coefficient
 
-    void coeff(Row r, Col c, Value val){
+    void coeff(Row r, Col c, Value val) {
       _setCoeff(_lpId(r),_lpId(c), val);
     }
@@ -1076,5 +1078,5 @@
     ///\return the corresponding coefficient
 
-    Value coeff(Row r, Col c){
+    Value coeff(Row r, Col c) const {
       return _getCoeff(_lpId(r),_lpId(c));
     }
@@ -1094,5 +1096,5 @@
     /// (this might be -\ref INF as well).  
     ///\return The lower bound for coloumn \t c
-    Value colLowerBound(Col c) {
+    Value colLowerBound(Col c) const {
       return _getColLowerBound(_lpId(c));
     }
@@ -1149,5 +1151,5 @@
     /// (this might be \ref INF as well).  
     ///\return The upper bound for coloumn \t c
-    Value colUpperBound(Col c) {
+    Value colUpperBound(Col c) const {
       return _getColUpperBound(_lpId(c));
     }
@@ -1261,5 +1263,5 @@
     /// implementation of the setting functions for CPLEX:  
     /// check out whether this can be done for these functions.
-    void getRowBounds(Row c, Value &lower, Value &upper) {
+    void getRowBounds(Row c, Value &lower, Value &upper) const {
       _getRowBounds(_lpId(c),lower, upper);
     }
@@ -1269,5 +1271,5 @@
 
     ///Get an element of the objective function
-    Value objCoeff(Col c) {return _getObjCoeff(_lpId(c)); };
+    Value objCoeff(Col c) const { return _getObjCoeff(_lpId(c)); };
 
     ///Set the objective function
@@ -1285,5 +1287,5 @@
 
     ///\return the objective function as a linear expression of type \ref Expr.
-    Expr obj() {
+    Expr obj() const {
       Expr e;
       for (ColIt it(*this); it != INVALID; ++it) {
@@ -1303,8 +1305,8 @@
 
     ///Query function: is this a maximization problem?
-    bool is_max() {return _isMax(); }
+    bool is_max() const {return _isMax(); }
 
     ///Query function: is this a minimization problem?
-    bool is_min() {return !is_max(); }
+    bool is_min() const {return !is_max(); }
     
     ///@}
@@ -1331,26 +1333,26 @@
 
     /// The status of the primal problem (the original LP problem)
-    SolutionStatus primalStatus() {
+    SolutionStatus primalStatus() const {
       return _getPrimalStatus();
     }
 
     /// The status of the dual (of the original LP) problem 
-    SolutionStatus dualStatus() {
+    SolutionStatus dualStatus() const {
       return _getDualStatus();
     }
 
     ///The type of the original LP problem
-    ProblemTypes problemType() {
+    ProblemTypes problemType() const {
       return _getProblemType();
     }
 
     ///\e
-    Value primal(Col c) { return _getPrimal(_lpId(c)); }
+    Value primal(Col c) const { return _getPrimal(_lpId(c)); }
 
     ///\e
-    Value dual(Row r) { return _getDual(_lpId(r)); }
+    Value dual(Row r) const { return _getDual(_lpId(r)); }
 
     ///\e
-    bool isBasicCol(Col c) { return _isBasicCol(_lpId(c)); }
+    bool isBasicCol(Col c) const { return _isBasicCol(_lpId(c)); }
 
     ///\e
@@ -1361,5 +1363,5 @@
     ///- \ref NaN if no primal solution is found.
     ///- The (finite) objective value if an optimal solution is found.
-    Value primalValue() { return _getPrimalValue()+obj_const_comp;}
+    Value primalValue() const { return _getPrimalValue()+obj_const_comp;}
     ///@}
     
@@ -1395,5 +1397,5 @@
     ///
     ///Gives back the type of the column.
-    ColTypes colType(Col c){
+    ColTypes colType(Col c) const {
       return _colType(_lpId(c));
     }
@@ -1413,10 +1415,10 @@
     ///Gives back the type of the column.
     ///\return true if the column has integer type and false if not.
-    bool integer(Col c){
+    bool integer(Col c) const {
       return (colType(c)==INT);
     }
 
     /// The status of the MIP problem
-    SolutionStatus mipStatus() {
+    SolutionStatus mipStatus() const {
       return _getMipStatus();
     }
@@ -1424,7 +1426,7 @@
   protected:
 
-    virtual ColTypes _colType(int col) = 0;
+    virtual ColTypes _colType(int col) const = 0;
     virtual void _colType(int col, ColTypes col_type) = 0;
-    virtual SolutionStatus _getMipStatus()=0;
+    virtual SolutionStatus _getMipStatus() const = 0;
 
   };
