lemon/mip_glpk.cc
changeset 2224 f973894da54e
parent 2213 2c094dfa176d
child 2253 1645f6cc9667
equal deleted inserted replaced
4:18413f4da092 5:4157332d14a3
    14  * express or implied, and with no claim as to its suitability for any
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    15  * purpose.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 #ifndef LEMON_ILP_GLPK_CC
    19 #ifndef LEMON_MIP_GLPK_CC
    20 #define LEMON_ILP_GLPK_CC
    20 #define LEMON_MIP_GLPK_CC
    21 
    21 
    22 ///\file
    22 ///\file
    23 ///\brief Implementation of the LEMON-GLPK lp solver interface.
    23 ///\brief Implementation of the LEMON-GLPK mip solver interface.
    24 
    24 
    25 #include <lemon/mip_glpk.h>
    25 #include <lemon/mip_glpk.h>
    26 
    26 
    27 namespace lemon {
    27 namespace lemon {
    28   
    28   
    30     lpx_set_class(lp,LPX_MIP);
    30     lpx_set_class(lp,LPX_MIP);
    31   }
    31   }
    32 
    32 
    33   void MipGlpk::_colType(int i, MipGlpk::ColTypes col_type){
    33   void MipGlpk::_colType(int i, MipGlpk::ColTypes col_type){
    34     switch (col_type){
    34     switch (col_type){
    35       case INTEGER:
    35       case LEMON_INTEGER:
    36 	lpx_set_col_kind(lp,i,LPX_IV);
    36 	lpx_set_col_kind(lp,i,LPX_IV);
    37 	break;
    37 	break;
    38       case REAL:
    38       case REAL:
    39 	lpx_set_col_kind(lp,i,LPX_CV);
    39 	lpx_set_col_kind(lp,i,LPX_CV);
    40 	break;
    40 	break;
    44   }
    44   }
    45   
    45   
    46   MipGlpk::ColTypes MipGlpk::_colType(int i){
    46   MipGlpk::ColTypes MipGlpk::_colType(int i){
    47     switch (lpx_get_col_kind(lp,i)){
    47     switch (lpx_get_col_kind(lp,i)){
    48     case LPX_IV:
    48     case LPX_IV:
    49       return INTEGER;//Or binary
    49       return LEMON_INTEGER;//Or binary
    50     case LPX_CV:
    50     case LPX_CV:
    51       return REAL;
    51       return REAL;
    52     default:
    52     default:
    53       return REAL;//Error!
    53       return REAL;//Error!
    54     }
    54     }
   108   }
   108   }
   109   
   109   
   110   MipGlpk::Value MipGlpk::_getPrimalValue(){
   110   MipGlpk::Value MipGlpk::_getPrimalValue(){
   111     return lpx_mip_obj_val(lp);
   111     return lpx_mip_obj_val(lp);
   112   }
   112   }
   113 } //END OG NAMESPACE LEMON
   113 } //END OF NAMESPACE LEMON
   114 
   114 
   115 #endif
   115 #endif //END OF MIP_GLPK_CC