lemon/lp_base.h
changeset 2168 6474b8254f24
parent 2144 cd8897f67c26
child 2185 e2bf51eab7f7
equal deleted inserted replaced
30:872c1242ddee 31:7929f236bc2e
  1156     ///@}
  1156     ///@}
  1157     
  1157     
  1158   };  
  1158   };  
  1159 
  1159 
  1160 
  1160 
  1161   ///Common base class for ILP solvers
  1161   ///Common base class for MIP solvers
  1162   ///\todo Much more docs
  1162   ///\todo Much more docs
  1163   ///\ingroup gen_opt_group
  1163   ///\ingroup gen_opt_group
  1164   class MipSolverBase : virtual public LpSolverBase{
  1164   class MipSolverBase : virtual public LpSolverBase{
  1165   public:
  1165   public:
  1166 
  1166 
  1167     ///Set the type of the given Col to integer or remove that property.
  1167     ///Possible variable (coloumn) types (e.g. real, integer, binary etc.)
  1168     ///
  1168     enum ColTypes {
  1169     ///Set the type of the given Col to integer or remove that property.
  1169       ///Continuous variable
       
  1170       REAL = 0,
       
  1171       ///Integer variable
       
  1172       INTEGER = 1
       
  1173       ///\todo No support for other types yet.
       
  1174     };
       
  1175 
       
  1176     ///Sets the type of the given coloumn to the given type
       
  1177     ///
       
  1178     ///Sets the type of the given coloumn to the given type.
       
  1179     void colType(Col c, ColTypes col_type) {
       
  1180       _colType(cols.floatingId(c.id),col_type);
       
  1181     }
       
  1182 
       
  1183     ///Gives back the type of the column.
       
  1184     ///
       
  1185     ///Gives back the type of the column.
       
  1186     ColTypes colType(Col c){
       
  1187       return _colType(cols.floatingId(c.id));
       
  1188     }
       
  1189 
       
  1190     ///Sets the type of the given Col to integer or remove that property.
       
  1191     ///
       
  1192     ///Sets the type of the given Col to integer or remove that property.
  1170     void integer(Col c, bool enable) {
  1193     void integer(Col c, bool enable) {
  1171       _integer(cols.floatingId(c.id),enable);
  1194       if (enable)
  1172     }
  1195 	colType(c,INTEGER);
  1173 
  1196       else
  1174     ///Gives back the type of the column.
  1197 	colType(c,REAL);
       
  1198     }
       
  1199 
       
  1200     ///Gives back whether the type of the column is integer or not.
  1175     ///
  1201     ///
  1176     ///Gives back the type of the column.
  1202     ///Gives back the type of the column.
  1177     ///\return true if the column has integer type and false if not.
  1203     ///\return true if the column has integer type and false if not.
  1178     bool integer(Col c){
  1204     bool integer(Col c){
  1179       return _integer(cols.floatingId(c.id));
  1205       return (colType(c)==INTEGER);
  1180     }
  1206     }
  1181 
  1207 
  1182   protected:
  1208   protected:
  1183 
  1209 
  1184     virtual bool _integer(int col) = 0;
  1210     virtual ColTypes _colType(int col) = 0;
  1185     virtual void _integer(int col, bool enable) = 0;
  1211     virtual void _colType(int col, ColTypes col_type) = 0;
       
  1212 
  1186   };
  1213   };
  1187   
  1214   
  1188   ///\relates LpSolverBase::Expr
  1215   ///\relates LpSolverBase::Expr
  1189   ///
  1216   ///
  1190   inline LpSolverBase::Expr operator+(const LpSolverBase::Expr &a,
  1217   inline LpSolverBase::Expr operator+(const LpSolverBase::Expr &a,