src/work/athos/lp_old/lp_solver_base.h
changeset 1365 c280de819a73
parent 1364 ee5959aa4410
child 1366 d00b85f8be45
     1.1 --- a/src/work/athos/lp_old/lp_solver_base.h	Sun Apr 17 18:57:22 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,639 +0,0 @@
     1.4 -// -*- c++ -*-
     1.5 -#ifndef LEMON_LP_SOLVER_BASE_H
     1.6 -#define LEMON_LP_SOLVER_BASE_H
     1.7 -
     1.8 -///\ingroup misc
     1.9 -///\file
    1.10 -
    1.11 -// #include <stdio.h>
    1.12 -#include <stdlib.h>
    1.13 -#include <iostream>
    1.14 -#include <map>
    1.15 -#include <limits>
    1.16 -// #include <stdio>
    1.17 -//#include <stdlib>
    1.18 -
    1.19 -#include <iostream>
    1.20 -#include <vector>
    1.21 -#include <string>
    1.22 -#include <list>
    1.23 -#include <memory>
    1.24 -#include <utility>
    1.25 -
    1.26 -#include <lemon/invalid.h>
    1.27 -#include <expression.h>
    1.28 -//#include <stp.h>
    1.29 -//#include <lemon/max_flow.h>
    1.30 -//#include <augmenting_flow.h>
    1.31 -//#include <iter_map.h>
    1.32 -
    1.33 -using std::cout;
    1.34 -using std::cin;
    1.35 -using std::endl;
    1.36 -
    1.37 -namespace lemon {
    1.38 -  
    1.39 -  /// \addtogroup misc
    1.40 -  /// @{
    1.41 -
    1.42 -  /// \brief A partitioned vector with iterable classes.
    1.43 -  ///
    1.44 -  /// This class implements a container in which the data is stored in an 
    1.45 -  /// stl vector, the range is partitioned into sets and each set is 
    1.46 -  /// doubly linked in a list. 
    1.47 -  /// That is, each class is iterable by lemon iterators, and any member of 
    1.48 -  /// the vector can bo moved to an other class.
    1.49 -  template <typename T>
    1.50 -  class IterablePartition {
    1.51 -  protected:
    1.52 -    struct Node {
    1.53 -      T data;
    1.54 -      int prev; //invalid az -1
    1.55 -      int next; 
    1.56 -    };
    1.57 -    std::vector<Node> nodes;
    1.58 -    struct Tip {
    1.59 -      int first;
    1.60 -      int last;
    1.61 -    };
    1.62 -    std::vector<Tip> tips;
    1.63 -  public:
    1.64 -    /// The classes are indexed by integers from \c 0 to \c classNum()-1.
    1.65 -    int classNum() const { return tips.size(); }
    1.66 -    /// This lemon style iterator iterates through a class. 
    1.67 -    class Class;
    1.68 -    /// Constructor. The number of classes is to be given which is fixed 
    1.69 -    /// over the life of the container. 
    1.70 -    /// The partition classes are indexed from 0 to class_num-1. 
    1.71 -    IterablePartition(int class_num) { 
    1.72 -      for (int i=0; i<class_num; ++i) {
    1.73 -	Tip t;
    1.74 -	t.first=t.last=-1;
    1.75 -	tips.push_back(t);
    1.76 -      }
    1.77 -    }
    1.78 -  protected:
    1.79 -    void befuz(Class it, int class_id) {
    1.80 -      if (tips[class_id].first==-1) {
    1.81 -	if (tips[class_id].last==-1) {
    1.82 -	  nodes[it.i].prev=nodes[it.i].next=-1;
    1.83 -	  tips[class_id].first=tips[class_id].last=it.i;
    1.84 -	}
    1.85 -      } else {
    1.86 -	nodes[it.i].prev=tips[class_id].last;
    1.87 -	nodes[it.i].next=-1;
    1.88 -	nodes[tips[class_id].last].next=it.i;
    1.89 -	tips[class_id].last=it.i;
    1.90 -      }
    1.91 -    }
    1.92 -    void kifuz(Class it, int class_id) {
    1.93 -      if (tips[class_id].first==it.i) {
    1.94 -	if (tips[class_id].last==it.i) {
    1.95 -	  tips[class_id].first=tips[class_id].last=-1;
    1.96 -	} else {
    1.97 -	  tips[class_id].first=nodes[it.i].next;
    1.98 -	  nodes[nodes[it.i].next].prev=-1;
    1.99 -	}
   1.100 -      } else {
   1.101 -	if (tips[class_id].last==it.i) {
   1.102 -	  tips[class_id].last=nodes[it.i].prev;
   1.103 -	  nodes[nodes[it.i].prev].next=-1;
   1.104 -	} else {
   1.105 -	  nodes[nodes[it.i].next].prev=nodes[it.i].prev;
   1.106 -	  nodes[nodes[it.i].prev].next=nodes[it.i].next;
   1.107 -	}
   1.108 -      }
   1.109 -    }
   1.110 -  public:
   1.111 -    /// A new element with data \c t is pushed into the vector and into class 
   1.112 -    /// \c class_id.
   1.113 -    Class push_back(const T& t, int class_id) { 
   1.114 -      Node n;
   1.115 -      n.data=t;
   1.116 -      nodes.push_back(n);
   1.117 -      int i=nodes.size()-1;
   1.118 -      befuz(i, class_id);
   1.119 -      return i;
   1.120 -    }
   1.121 -    /// A member is moved to an other class.
   1.122 -    void set(Class it, int old_class_id, int new_class_id) {
   1.123 -      kifuz(it.i, old_class_id);
   1.124 -      befuz(it.i, new_class_id);
   1.125 -    }
   1.126 -    /// Returns the data pointed by \c it.
   1.127 -    T& operator[](Class it) { return nodes[it.i].data; }
   1.128 -    /// Returns the data pointed by \c it.
   1.129 -    const T& operator[](Class it) const { return nodes[it.i].data; }
   1.130 -    ///.
   1.131 -    class Class {
   1.132 -      friend class IterablePartition;
   1.133 -    protected:
   1.134 -      int i;
   1.135 -    public:
   1.136 -      /// Default constructor.
   1.137 -      Class() { }
   1.138 -      /// This constructor constructs an iterator which points
   1.139 -      /// to the member of th container indexed by the integer _i.
   1.140 -      Class(const int& _i) : i(_i) { }
   1.141 -      /// Invalid constructor.
   1.142 -      Class(const Invalid&) : i(-1) { }
   1.143 -      friend bool operator<(const Class& x, const Class& y);
   1.144 -      friend std::ostream& operator<<(std::ostream& os, 
   1.145 -				      const Class& it);
   1.146 -      bool operator==(const Class& node) const {return i == node.i;}
   1.147 -      bool operator!=(const Class& node) const {return i != node.i;}
   1.148 -    };
   1.149 -    friend bool operator<(const Class& x, const Class& y) {
   1.150 -      return (x.i < y.i);
   1.151 -    }
   1.152 -    friend std::ostream& operator<<(std::ostream& os, 
   1.153 -				    const Class& it) {
   1.154 -      os << it.i;
   1.155 -      return os;
   1.156 -    }
   1.157 -    /// First member of class \c class_id.
   1.158 -    Class& first(Class& it, int class_id) const {
   1.159 -      it.i=tips[class_id].first;
   1.160 -      return it;
   1.161 -    }
   1.162 -    /// Next member.
   1.163 -    Class& next(Class& it) const {
   1.164 -      it.i=nodes[it.i].next;
   1.165 -      return it;
   1.166 -    }
   1.167 -    /// True iff the iterator is valid.
   1.168 -    bool valid(const Class& it) const { return it.i!=-1; }
   1.169 -
   1.170 -    class ClassIt : public Class {
   1.171 -      const IterablePartition* iterable_partition;
   1.172 -    public:
   1.173 -      ClassIt() { }
   1.174 -      ClassIt(Invalid i) : Class(i) { }
   1.175 -      ClassIt(const IterablePartition& _iterable_partition, 
   1.176 -	      const int& i) : iterable_partition(&_iterable_partition) {
   1.177 -        _iterable_partition.first(*this, i);
   1.178 -      }
   1.179 -      ClassIt(const IterablePartition& _iterable_partition, 
   1.180 -	      const Class& _class) : 
   1.181 -	Class(_class), iterable_partition(&_iterable_partition) { }
   1.182 -      ClassIt& operator++() {
   1.183 -        iterable_partition->next(*this);
   1.184 -        return *this;
   1.185 -      }
   1.186 -    };
   1.187 -
   1.188 -  };
   1.189 -
   1.190 -
   1.191 -  /*! \e
   1.192 -    \todo kellenene uj iterable structure bele, mert ez nem az igazi
   1.193 -    \todo A[x,y]-t cserel. Jobboldal, baloldal csere.
   1.194 -    \todo LEKERDEZESEK!!!
   1.195 -    \todo DOKSI!!!! Doxygen group!!!
   1.196 -    The aim of this class is to give a general surface to different 
   1.197 -    solvers, i.e. it makes possible to write algorithms using LP's, 
   1.198 -    in which the solver can be changed to an other one easily.
   1.199 -    \nosubgrouping
   1.200 -  */
   1.201 -  template <typename _Value>
   1.202 -  class LpSolverBase {
   1.203 -    
   1.204 -    /*! @name Uncategorized functions and types (public members)
   1.205 -    */
   1.206 -    //@{
   1.207 -  public:
   1.208 -
   1.209 -    //UNCATEGORIZED
   1.210 -
   1.211 -    /// \e
   1.212 -    typedef IterablePartition<int> Rows;
   1.213 -    /// \e
   1.214 -    typedef IterablePartition<int> Cols;
   1.215 -    /// \e
   1.216 -    typedef _Value Value;
   1.217 -    /// \e
   1.218 -    typedef Rows::Class Row;
   1.219 -    /// \e
   1.220 -    typedef Cols::Class Col;
   1.221 -  public:
   1.222 -    /// \e
   1.223 -    IterablePartition<int> row_iter_map;
   1.224 -    /// \e
   1.225 -    IterablePartition<int> col_iter_map;
   1.226 -    /// \e
   1.227 -    std::vector<Row> int_row_map;
   1.228 -    /// \e
   1.229 -    std::vector<Col> int_col_map;
   1.230 -    /// \e
   1.231 -    const int VALID_CLASS;
   1.232 -    /// \e
   1.233 -    const int INVALID_CLASS;
   1.234 -    /// \e 
   1.235 -    static const Value INF;
   1.236 -  public:
   1.237 -    /// \e
   1.238 -    LpSolverBase() : row_iter_map(2), 
   1.239 -		     col_iter_map(2), 
   1.240 -		     VALID_CLASS(0), INVALID_CLASS(1) { }
   1.241 -    /// \e
   1.242 -    virtual ~LpSolverBase() { }
   1.243 -    //@}
   1.244 -
   1.245 -    /*! @name Medium level interface (public members)
   1.246 -      These functions appear in the low level and also in the high level 
   1.247 -      interfaces thus these each of these functions have to be implemented 
   1.248 -      only once in the different interfaces.
   1.249 -      This means that these functions have to be reimplemented for all of the 
   1.250 -      different lp solvers. These are basic functions, and have the same 
   1.251 -      parameter lists in the low and high level interfaces. 
   1.252 -    */
   1.253 -    //@{
   1.254 -  public:
   1.255 -
   1.256 -    //UNCATEGORIZED FUNCTIONS
   1.257 -
   1.258 -    /// \e
   1.259 -    virtual void setMinimize() = 0;
   1.260 -    /// \e
   1.261 -    virtual void setMaximize() = 0;
   1.262 -
   1.263 -    //SOLVER FUNCTIONS
   1.264 -
   1.265 -    /// \e
   1.266 -    virtual void solveSimplex() = 0;
   1.267 -    /// \e
   1.268 -    virtual void solvePrimalSimplex() = 0;
   1.269 -    /// \e
   1.270 -    virtual void solveDualSimplex() = 0;
   1.271 -
   1.272 -    //SOLUTION RETRIEVING
   1.273 -
   1.274 -    /// \e
   1.275 -    virtual Value getObjVal() = 0;
   1.276 -
   1.277 -    //OTHER FUNCTIONS
   1.278 -
   1.279 -    /// \e
   1.280 -    virtual int rowNum() const = 0;
   1.281 -    /// \e
   1.282 -    virtual int colNum() const = 0;
   1.283 -    /// \e
   1.284 -    virtual int warmUp() = 0;
   1.285 -    /// \e
   1.286 -    virtual void printWarmUpStatus(int i) = 0;
   1.287 -    /// \e
   1.288 -    virtual int getPrimalStatus() = 0;
   1.289 -    /// \e
   1.290 -    virtual void printPrimalStatus(int i) = 0;
   1.291 -    /// \e
   1.292 -    virtual int getDualStatus() = 0;
   1.293 -    /// \e
   1.294 -    virtual void printDualStatus(int i) = 0;
   1.295 -    /// Returns the status of the slack variable assigned to row \c row.
   1.296 -    virtual int getRowStat(const Row& row) = 0;
   1.297 -    /// \e
   1.298 -    virtual void printRowStatus(int i) = 0;
   1.299 -    /// Returns the status of the variable assigned to column \c col.
   1.300 -    virtual int getColStat(const Col& col) = 0;
   1.301 -    /// \e
   1.302 -    virtual void printColStatus(int i) = 0;
   1.303 -
   1.304 -    //@}
   1.305 -
   1.306 -    /*! @name Low level interface (protected members)
   1.307 -      Problem manipulating functions in the low level interface
   1.308 -    */
   1.309 -    //@{
   1.310 -  protected:
   1.311 -
   1.312 -    //MATRIX MANIPULATING FUNCTIONS
   1.313 -
   1.314 -    /// \e
   1.315 -    virtual int _addCol() = 0;
   1.316 -    /// \e
   1.317 -    virtual int _addRow() = 0;
   1.318 -    /// \e
   1.319 -    virtual void _eraseCol(int i) = 0;
   1.320 -    /// \e
   1.321 -    virtual void _eraseRow(int i) = 0;
   1.322 -    /// \e
   1.323 -    virtual void _setRowCoeffs(int i, 
   1.324 -			       const std::vector<std::pair<int, Value> >& coeffs) = 0;
   1.325 -    /// \e
   1.326 -    /// This routine modifies \c coeffs only by the \c push_back method.
   1.327 -    virtual void _getRowCoeffs(int i, 
   1.328 -			       std::vector<std::pair<int, Value> >& coeffs) = 0;
   1.329 -    /// \e
   1.330 -    virtual void _setColCoeffs(int i, 
   1.331 -			       const std::vector<std::pair<int, Value> >& coeffs) = 0;
   1.332 -    /// \e
   1.333 -    /// This routine modifies \c coeffs only by the \c push_back method.
   1.334 -    virtual void _getColCoeffs(int i, 
   1.335 -			       std::vector<std::pair<int, Value> >& coeffs) = 0;
   1.336 -    /// \e
   1.337 -    virtual void _setCoeff(int col, int row, Value value) = 0;
   1.338 -    /// \e
   1.339 -    virtual Value _getCoeff(int col, int row) = 0;
   1.340 -    //  public:
   1.341 -    //    /// \e
   1.342 -    //    enum Bound { FREE, LOWER, UPPER, DOUBLE, FIXED };
   1.343 -  protected:
   1.344 -    /// \e
   1.345 -    /// The lower bound of a variable (column) have to be given by an 
   1.346 -    /// extended number of type Value, i.e. a finite number of type 
   1.347 -    /// Value or -INF.
   1.348 -    virtual void _setColLowerBound(int i, Value value) = 0;
   1.349 -    /// \e
   1.350 -    /// The lower bound of a variable (column) is an 
   1.351 -    /// extended number of type Value, i.e. a finite number of type 
   1.352 -    /// Value or -INF.
   1.353 -    virtual Value _getColLowerBound(int i) = 0;
   1.354 -    /// \e
   1.355 -    /// The upper bound of a variable (column) have to be given by an 
   1.356 -    /// extended number of type Value, i.e. a finite number of type 
   1.357 -    /// Value or INF.
   1.358 -    virtual void _setColUpperBound(int i, Value value) = 0;
   1.359 -    /// \e
   1.360 -    /// The upper bound of a variable (column) is an 
   1.361 -    /// extended number of type Value, i.e. a finite number of type 
   1.362 -    /// Value or INF.
   1.363 -    virtual Value _getColUpperBound(int i) = 0;
   1.364 -    /// \e
   1.365 -    /// The lower bound of a linear expression (row) have to be given by an 
   1.366 -    /// extended number of type Value, i.e. a finite number of type 
   1.367 -    /// Value or -INF.
   1.368 -    virtual void _setRowLowerBound(int i, Value value) = 0;
   1.369 -    /// \e
   1.370 -    /// The lower bound of a linear expression (row) is an 
   1.371 -    /// extended number of type Value, i.e. a finite number of type 
   1.372 -    /// Value or -INF.
   1.373 -    virtual Value _getRowLowerBound(int i) = 0;
   1.374 -    /// \e
   1.375 -    /// The upper bound of a linear expression (row) have to be given by an 
   1.376 -    /// extended number of type Value, i.e. a finite number of type 
   1.377 -    /// Value or INF.
   1.378 -    virtual void _setRowUpperBound(int i, Value value) = 0;
   1.379 -    /// \e
   1.380 -    /// The upper bound of a linear expression (row) is an 
   1.381 -    /// extended number of type Value, i.e. a finite number of type 
   1.382 -    /// Value or INF.
   1.383 -    virtual Value _getRowUpperBound(int i) = 0;
   1.384 -    /// \e
   1.385 -    virtual void _setObjCoeff(int i, Value obj_coef) = 0;
   1.386 -    /// \e
   1.387 -    virtual Value _getObjCoeff(int i) = 0;
   1.388 -    
   1.389 -    //SOLUTION RETRIEVING
   1.390 -
   1.391 -    /// \e
   1.392 -    virtual Value _getPrimal(int i) = 0;
   1.393 -    //@}
   1.394 -    
   1.395 -    /*! @name High level interface (public members)
   1.396 -      Problem manipulating functions in the high level interface
   1.397 -    */
   1.398 -    //@{
   1.399 -  public:
   1.400 -
   1.401 -    //MATRIX MANIPULATING FUNCTIONS
   1.402 -
   1.403 -    /// \e
   1.404 -    Col addCol() {
   1.405 -      int i=_addCol();  
   1.406 -      Col col;
   1.407 -      col_iter_map.first(col, INVALID_CLASS);
   1.408 -      if (col_iter_map.valid(col)) { //van hasznalhato hely
   1.409 -	col_iter_map.set(col, INVALID_CLASS, VALID_CLASS);
   1.410 -	col_iter_map[col]=i;
   1.411 -      } else { //a cucc vegere kell inzertalni mert nincs szabad hely
   1.412 -	col=col_iter_map.push_back(i, VALID_CLASS);
   1.413 -      }
   1.414 -      int_col_map.push_back(col);
   1.415 -      return col;
   1.416 -    }
   1.417 -    /// \e
   1.418 -    Row addRow() {
   1.419 -      int i=_addRow();
   1.420 -      Row row;
   1.421 -      row_iter_map.first(row, INVALID_CLASS);
   1.422 -      if (row_iter_map.valid(row)) { //van hasznalhato hely
   1.423 -	row_iter_map.set(row, INVALID_CLASS, VALID_CLASS);
   1.424 -	row_iter_map[row]=i;
   1.425 -      } else { //a cucc vegere kell inzertalni mert nincs szabad hely
   1.426 -	row=row_iter_map.push_back(i, VALID_CLASS);
   1.427 -      }
   1.428 -      int_row_map.push_back(row);
   1.429 -      return row;
   1.430 -    }
   1.431 -    /// \e
   1.432 -    void eraseCol(const Col& col) {
   1.433 -      col_iter_map.set(col, VALID_CLASS, INVALID_CLASS);
   1.434 -      int cols[2];
   1.435 -      cols[1]=col_iter_map[col];
   1.436 -      _eraseCol(cols[1]);
   1.437 -      col_iter_map[col]=0; //glpk specifikus, de kell ez??
   1.438 -      Col it;
   1.439 -      for (col_iter_map.first(it, VALID_CLASS); 
   1.440 -	   col_iter_map.valid(it); col_iter_map.next(it)) {
   1.441 -	if (col_iter_map[it]>cols[1]) --col_iter_map[it];
   1.442 -      }
   1.443 -      int_col_map.erase(int_col_map.begin()+cols[1]);
   1.444 -    }
   1.445 -    /// \e
   1.446 -    void eraseRow(const Row& row) {
   1.447 -      row_iter_map.set(row, VALID_CLASS, INVALID_CLASS);
   1.448 -      int rows[2];
   1.449 -      rows[1]=row_iter_map[row];
   1.450 -      _eraseRow(rows[1]);
   1.451 -      row_iter_map[row]=0; //glpk specifikus, de kell ez??
   1.452 -      Row it;
   1.453 -      for (row_iter_map.first(it, VALID_CLASS); 
   1.454 -	   row_iter_map.valid(it); row_iter_map.next(it)) {
   1.455 -	if (row_iter_map[it]>rows[1]) --row_iter_map[it];
   1.456 -      }
   1.457 -      int_row_map.erase(int_row_map.begin()+rows[1]);
   1.458 -    }
   1.459 -    /// \e
   1.460 -    void setCoeff(Col col, Row row, Value value) {
   1.461 -      _setCoeff(col_iter_map[col], row_iter_map[row], value);
   1.462 -    }
   1.463 -    /// \e
   1.464 -    Value getCoeff(Col col, Row row) {
   1.465 -      return _getCoeff(col_iter_map[col], row_iter_map[row], value);
   1.466 -    }
   1.467 -    /// \e
   1.468 -    void setColLowerBound(Col col, Value lo) {
   1.469 -      _setColLowerBound(col_iter_map[col], lo);
   1.470 -    }
   1.471 -    /// \e
   1.472 -    Value getColLowerBound(Col col) {
   1.473 -      return _getColLowerBound(col_iter_map[col]);
   1.474 -    }
   1.475 -    /// \e
   1.476 -    void setColUpperBound(Col col, Value up) {
   1.477 -      _setColUpperBound(col_iter_map[col], up);
   1.478 -    }
   1.479 -    /// \e
   1.480 -    Value getColUpperBound(Col col) {      
   1.481 -      return _getColUpperBound(col_iter_map[col]);
   1.482 -    }
   1.483 -    /// \e
   1.484 -    void setRowLowerBound(Row row, Value lo) {
   1.485 -      _setRowLowerBound(row_iter_map[row], lo);
   1.486 -    }
   1.487 -    /// \e
   1.488 -    Value getRowLowerBound(Row row) {
   1.489 -      return _getRowLowerBound(row_iter_map[row]);
   1.490 -    }
   1.491 -    /// \e
   1.492 -    void setRowUpperBound(Row row, Value up) {
   1.493 -      _setRowUpperBound(row_iter_map[row], up);
   1.494 -    }
   1.495 -    /// \e
   1.496 -    Value getRowUpperBound(Row row) {      
   1.497 -      return _getRowUpperBound(row_iter_map[row]);
   1.498 -    }
   1.499 -    /// \e
   1.500 -    void setObjCoeff(const Col& col, Value obj_coef) {
   1.501 -      _setObjCoeff(col_iter_map[col], obj_coef);
   1.502 -    }
   1.503 -    /// \e
   1.504 -    Value getObjCoeff(const Col& col) {
   1.505 -      return _getObjCoeff(col_iter_map[col]);
   1.506 -    }
   1.507 -
   1.508 -    //SOLUTION RETRIEVING FUNCTIONS
   1.509 -
   1.510 -    /// \e
   1.511 -    Value getPrimal(const Col& col) {
   1.512 -      return _getPrimal(col_iter_map[col]);
   1.513 -    }    
   1.514 -
   1.515 -    //@}
   1.516 -
   1.517 -    /*! @name User friend interface
   1.518 -      Problem manipulating functions in the user friend interface
   1.519 -    */
   1.520 -    //@{
   1.521 -
   1.522 -    //EXPRESSION TYPES
   1.523 -
   1.524 -    /// \e
   1.525 -    typedef Expr<Col, Value> Expression;
   1.526 -    /// \e
   1.527 -    typedef Expr<Row, Value> DualExpression;
   1.528 -    /// \e
   1.529 -    typedef Constr<Col, Value> Constraint;
   1.530 -
   1.531 -    //MATRIX MANIPULATING FUNCTIONS
   1.532 -
   1.533 -    /// \e
   1.534 -    void setRowCoeffs(Row row, const Expression& expr) {
   1.535 -      std::vector<std::pair<int, Value> > row_coeffs;
   1.536 -      for(typename Expression::Data::const_iterator i=expr.data.begin(); 
   1.537 -	  i!=expr.data.end(); ++i) {
   1.538 -	row_coeffs.push_back(std::make_pair
   1.539 -			     (col_iter_map[(*i).first], (*i).second));
   1.540 -      }
   1.541 -      _setRowCoeffs(row_iter_map[row], row_coeffs);
   1.542 -    }
   1.543 -    /// \e 
   1.544 -    void setRow(Row row, const Constraint& constr) {
   1.545 -      setRowCoeffs(row, constr.expr);
   1.546 -      setRowLowerBound(row, constr.lo);
   1.547 -      setRowUpperBound(row, constr.up);
   1.548 -    }
   1.549 -    /// \e 
   1.550 -    Row addRow(const Constraint& constr) {
   1.551 -      Row row=addRow();
   1.552 -      setRowCoeffs(row, constr.expr);
   1.553 -      setRowLowerBound(row, constr.lo);
   1.554 -      setRowUpperBound(row, constr.up);
   1.555 -      return row;
   1.556 -    }
   1.557 -    /// \e
   1.558 -    /// This routine modifies \c expr by only adding to it.
   1.559 -    void getRowCoeffs(Row row, Expression& expr) {
   1.560 -      std::vector<std::pair<int, Value> > row_coeffs;
   1.561 -      _getRowCoeffs(row_iter_map[row], row_coeffs);
   1.562 -      for(typename std::vector<std::pair<int, Value> >::const_iterator 
   1.563 - 	    i=row_coeffs.begin(); i!=row_coeffs.end(); ++i) {
   1.564 - 	expr+= (*i).second*int_col_map[(*i).first];
   1.565 -      }
   1.566 -    }
   1.567 -    /// \e
   1.568 -    void setColCoeffs(Col col, const DualExpression& expr) {
   1.569 -      std::vector<std::pair<int, Value> > col_coeffs;
   1.570 -      for(typename DualExpression::Data::const_iterator i=expr.data.begin(); 
   1.571 -	  i!=expr.data.end(); ++i) {
   1.572 -	col_coeffs.push_back(std::make_pair
   1.573 -			     (row_iter_map[(*i).first], (*i).second));
   1.574 -      }
   1.575 -      _setColCoeffs(col_iter_map[col], col_coeffs);
   1.576 -    }
   1.577 -    /// \e
   1.578 -    /// This routine modifies \c expr by only adding to it.
   1.579 -    void getColCoeffs(Col col, DualExpression& expr) {
   1.580 -      std::vector<std::pair<int, Value> > col_coeffs;
   1.581 -      _getColCoeffs(col_iter_map[col], col_coeffs);
   1.582 -      for(typename std::vector<std::pair<int, Value> >::const_iterator 
   1.583 - 	    i=col_coeffs.begin(); i!=col_coeffs.end(); ++i) {
   1.584 - 	expr+= (*i).second*int_row_map[(*i).first];
   1.585 -      }
   1.586 -    }
   1.587 -    /// \e
   1.588 -    void setObjCoeffs(const Expression& expr) {
   1.589 -      // writing zero everywhere
   1.590 -      for(Cols::ClassIt it(col_iter_map, VALID_CLASS); it!=INVALID; ++it)
   1.591 -	setObjCoeff(it, 0.0);
   1.592 -      // writing the data needed
   1.593 -      for(typename Expression::Data::const_iterator i=expr.data.begin(); 
   1.594 -	  i!=expr.data.end(); ++i) {
   1.595 -	setObjCoeff((*i).first, (*i).second);
   1.596 -      }
   1.597 -    }
   1.598 -    /// \e
   1.599 -    /// This routine modifies \c expr by only adding to it.
   1.600 -    void getObjCoeffs(Expression& expr) {
   1.601 -      for(Cols::ClassIt it(col_iter_map, VALID_CLASS); it!=INVALID; ++it)
   1.602 -	expr+=getObjCoeff(it)*it;
   1.603 -    }
   1.604 -    //@}
   1.605 -
   1.606 -
   1.607 -    /*! @name MIP functions and types (public members)
   1.608 -    */
   1.609 -    //@{
   1.610 -  public:
   1.611 -    /// \e
   1.612 -    virtual void solveBandB() = 0;
   1.613 -    /// \e
   1.614 -    virtual void setLP() = 0;
   1.615 -    /// \e
   1.616 -    virtual void setMIP() = 0;
   1.617 -  protected:
   1.618 -   /// \e
   1.619 -    virtual void _setColCont(int i) = 0;
   1.620 -    /// \e
   1.621 -    virtual void _setColInt(int i) = 0;
   1.622 -    /// \e
   1.623 -    virtual Value _getMIPPrimal(int i) = 0;
   1.624 -  public:
   1.625 -    /// \e
   1.626 -    void setColCont(Col col) {
   1.627 -      _setColCont(col_iter_map[col]);
   1.628 -    }
   1.629 -    /// \e
   1.630 -    void setColInt(Col col) {
   1.631 -      _setColInt(col_iter_map[col]);
   1.632 -    }
   1.633 -    /// \e
   1.634 -    Value getMIPPrimal(Col col) {
   1.635 -      return _getMIPPrimal(col_iter_map[col]);
   1.636 -    }
   1.637 -    //@}
   1.638 -  };
   1.639 -
   1.640 -} //namespace lemon
   1.641 -
   1.642 -#endif //LEMON_LP_SOLVER_BASE_H