athos@1249: // -*- c++ -*-
athos@1249: #ifndef LEMON_LP_SOLVER_BASE_H
athos@1249: #define LEMON_LP_SOLVER_BASE_H
athos@1249: 
athos@1249: ///\ingroup misc
athos@1249: ///\file
athos@1249: 
athos@1249: // #include <stdio.h>
athos@1249: #include <stdlib.h>
athos@1249: #include <iostream>
athos@1249: #include <map>
athos@1249: #include <limits>
athos@1249: // #include <stdio>
athos@1249: //#include <stdlib>
athos@1249: 
athos@1249: #include <iostream>
athos@1249: #include <vector>
athos@1249: #include <string>
athos@1249: #include <list>
athos@1249: #include <memory>
athos@1249: #include <utility>
athos@1249: 
athos@1249: //#include <lemon/invalid.h>
athos@1249: //#include <expression.h>
athos@1249: //#include <stp.h>
athos@1249: //#include <lemon/max_flow.h>
athos@1249: //#include <augmenting_flow.h>
athos@1249: //#include <iter_map.h>
athos@1249: 
athos@1249: using std::cout;
athos@1249: using std::cin;
athos@1249: using std::endl;
athos@1249: 
athos@1249: namespace lemon {
athos@1249:   
athos@1249:   template <typename _Value>
athos@1249:   class LpSolverBase {
athos@1249:     
athos@1249:     /*! @name Uncategorized functions and types (public members)
athos@1249:     */
athos@1249:     //@{
athos@1249:   public:
athos@1249: 
athos@1249:     //UNCATEGORIZED
athos@1249: 
athos@1249:     /// \e
athos@1249:     typedef _Value Value;
athos@1249:     /// \e 
athos@1249:     static const Value INF;
athos@1249:   public:
athos@1249:     /// \e
athos@1249:     LpSolverBase() { }
athos@1249:     /// \e
athos@1249:     virtual ~LpSolverBase() { }
athos@1249: 
athos@1249:     /*! @name Low level interface (protected members)
athos@1249:       Problem manipulating functions in the low level interface
athos@1249:     */
athos@1249:     //@{
athos@1249:   protected:
athos@1249: 
athos@1249:     //MATRIX MANIPULATING FUNCTIONS
athos@1249: 
athos@1249:     /// \e
athos@1249:     virtual int _addCol() = 0;
athos@1249:     /// \e
athos@1249:     virtual int _addRow() = 0;
athos@1249:     /// \e
athos@1249:     virtual void _eraseCol(int i) = 0;
athos@1249:     /// \e
athos@1249:     virtual void _eraseRow(int i) = 0;
athos@1249:     /// \e
athos@1249:     virtual void _setRowCoeffs(int i, 
athos@1249: 			       const std::vector<std::pair<int, Value> >& coeffs) = 0;
athos@1249:     /// \e
athos@1249:     /// This routine modifies \c coeffs only by the \c push_back method.
athos@1249:     virtual void _getRowCoeffs(int i, 
athos@1249: 			       std::vector<std::pair<int, Value> >& coeffs) = 0;
athos@1249:     /// \e
athos@1249:     virtual void _setColCoeffs(int i, 
athos@1249: 			       const std::vector<std::pair<int, Value> >& coeffs) = 0;
athos@1249:     /// \e
athos@1249:     /// This routine modifies \c coeffs only by the \c push_back method.
athos@1249:     virtual void _getColCoeffs(int i, 
athos@1249: 			       std::vector<std::pair<int, Value> >& coeffs) = 0;
athos@1249:     /// \e
athos@1249:     virtual void _setCoeff(int col, int row, Value value) = 0;
athos@1249:     /// \e
athos@1249:     virtual Value _getCoeff(int col, int row) = 0;
athos@1249:     //  public:
athos@1249:     //    /// \e
athos@1249:     //    enum Bound { FREE, LOWER, UPPER, DOUBLE, FIXED };
athos@1249:   protected:
athos@1249:     /// \e
athos@1249:     /// The lower bound of a variable (column) have to be given by an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or -INF.
athos@1249:     virtual void _setColLowerBound(int i, Value value) = 0;
athos@1249:     /// \e
athos@1249:     /// The lower bound of a variable (column) is an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or -INF.
athos@1249:     virtual Value _getColLowerBound(int i) = 0;
athos@1249:     /// \e
athos@1249:     /// The upper bound of a variable (column) have to be given by an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or INF.
athos@1249:     virtual void _setColUpperBound(int i, Value value) = 0;
athos@1249:     /// \e
athos@1249:     /// The upper bound of a variable (column) is an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or INF.
athos@1249:     virtual Value _getColUpperBound(int i) = 0;
athos@1249:     /// \e
athos@1249:     /// The lower bound of a linear expression (row) have to be given by an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or -INF.
athos@1249:     virtual void _setRowLowerBound(int i, Value value) = 0;
athos@1249:     /// \e
athos@1249:     /// The lower bound of a linear expression (row) is an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or -INF.
athos@1249:     virtual Value _getRowLowerBound(int i) = 0;
athos@1249:     /// \e
athos@1249:     /// The upper bound of a linear expression (row) have to be given by an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or INF.
athos@1249:     virtual void _setRowUpperBound(int i, Value value) = 0;
athos@1249:     /// \e
athos@1249:     /// The upper bound of a linear expression (row) is an 
athos@1249:     /// extended number of type Value, i.e. a finite number of type 
athos@1249:     /// Value or INF.
athos@1249:     virtual Value _getRowUpperBound(int i) = 0;
athos@1249:     /// \e
athos@1249:     virtual void _setObjCoeff(int i, Value obj_coef) = 0;
athos@1249:     /// \e
athos@1249:     virtual Value _getObjCoeff(int i) = 0;
athos@1249:     
athos@1249:     //SOLUTION RETRIEVING
athos@1249: 
athos@1249:     /// \e
athos@1249:     virtual Value _getPrimal(int i) = 0;
athos@1249:     //@}
athos@1249:     
athos@1249: 
athos@1249: 
athos@1249:     /*! @name MIP functions and types (public members)
athos@1249:     */
athos@1249:     //@{
athos@1249:   protected:
athos@1249:    /// \e
athos@1249:     virtual void _setColCont(int i) = 0;
athos@1249:     /// \e
athos@1249:     virtual void _setColInt(int i) = 0;
athos@1249:     /// \e
athos@1249:     virtual Value _getMIPPrimal(int i) = 0;
athos@1249:     //@}
athos@1249:   };
athos@1249: 
athos@1249: } //namespace lemon
athos@1249: 
athos@1249: #endif //LEMON_LP_SOLVER_BASE_H