lemon/lp_base.h
changeset 2148 ab368e0ab662
parent 2144 cd8897f67c26
child 2185 e2bf51eab7f7
     1.1 --- a/lemon/lp_base.h	Mon Jul 17 09:31:41 2006 +0000
     1.2 +++ b/lemon/lp_base.h	Mon Jul 17 11:56:17 2006 +0000
     1.3 @@ -1158,31 +1158,58 @@
     1.4    };  
     1.5  
     1.6  
     1.7 -  ///Common base class for ILP solvers
     1.8 +  ///Common base class for MIP solvers
     1.9    ///\todo Much more docs
    1.10    ///\ingroup gen_opt_group
    1.11    class MipSolverBase : virtual public LpSolverBase{
    1.12    public:
    1.13  
    1.14 -    ///Set the type of the given Col to integer or remove that property.
    1.15 +    ///Possible variable (coloumn) types (e.g. real, integer, binary etc.)
    1.16 +    enum ColTypes {
    1.17 +      ///Continuous variable
    1.18 +      REAL = 0,
    1.19 +      ///Integer variable
    1.20 +      INTEGER = 1
    1.21 +      ///\todo No support for other types yet.
    1.22 +    };
    1.23 +
    1.24 +    ///Sets the type of the given coloumn to the given type
    1.25      ///
    1.26 -    ///Set the type of the given Col to integer or remove that property.
    1.27 -    void integer(Col c, bool enable) {
    1.28 -      _integer(cols.floatingId(c.id),enable);
    1.29 +    ///Sets the type of the given coloumn to the given type.
    1.30 +    void colType(Col c, ColTypes col_type) {
    1.31 +      _colType(cols.floatingId(c.id),col_type);
    1.32      }
    1.33  
    1.34      ///Gives back the type of the column.
    1.35      ///
    1.36      ///Gives back the type of the column.
    1.37 +    ColTypes colType(Col c){
    1.38 +      return _colType(cols.floatingId(c.id));
    1.39 +    }
    1.40 +
    1.41 +    ///Sets the type of the given Col to integer or remove that property.
    1.42 +    ///
    1.43 +    ///Sets the type of the given Col to integer or remove that property.
    1.44 +    void integer(Col c, bool enable) {
    1.45 +      if (enable)
    1.46 +	colType(c,INTEGER);
    1.47 +      else
    1.48 +	colType(c,REAL);
    1.49 +    }
    1.50 +
    1.51 +    ///Gives back whether the type of the column is integer or not.
    1.52 +    ///
    1.53 +    ///Gives back the type of the column.
    1.54      ///\return true if the column has integer type and false if not.
    1.55      bool integer(Col c){
    1.56 -      return _integer(cols.floatingId(c.id));
    1.57 +      return (colType(c)==INTEGER);
    1.58      }
    1.59  
    1.60    protected:
    1.61  
    1.62 -    virtual bool _integer(int col) = 0;
    1.63 -    virtual void _integer(int col, bool enable) = 0;
    1.64 +    virtual ColTypes _colType(int col) = 0;
    1.65 +    virtual void _colType(int col, ColTypes col_type) = 0;
    1.66 +
    1.67    };
    1.68    
    1.69    ///\relates LpSolverBase::Expr