lemon/mip_glpk.cc
changeset 2388 c6d537888fe5
parent 2267 3575f17a6e7f
child 2391 14a343be7a5a
equal deleted inserted replaced
7:6eac7dd95b1e 8:ccfa2ac469b0
    38     default:;
    38     default:;
    39         //FIXME problem
    39         //FIXME problem
    40     }
    40     }
    41   }
    41   }
    42   
    42   
    43   MipGlpk::ColTypes MipGlpk::_colType(int i){
    43   MipGlpk::ColTypes MipGlpk::_colType(int i) const {
    44     switch (lpx_get_col_kind(lp,i)){
    44     switch (lpx_get_col_kind(lp,i)){
    45     case LPX_IV:
    45     case LPX_IV:
    46       return INT;//Or binary
    46       return INT;//Or binary
    47     case LPX_CV:
    47     case LPX_CV:
    48       return REAL;
    48       return REAL;
    50       return REAL;//Error!
    50       return REAL;//Error!
    51     }
    51     }
    52     
    52     
    53   }
    53   }
    54   
    54   
    55   LpGlpk::SolveExitStatus MipGlpk::_solve(){
    55   LpGlpk::SolveExitStatus MipGlpk::_solve() {
    56     int result = lpx_simplex(lp);
    56     int result = lpx_simplex(lp);
    57     //
    57     //
    58     if (lpx_get_status(lp)==LPX_OPT){
    58     if (lpx_get_status(lp)==LPX_OPT){
    59       //Maybe we could try the routine lpx_intopt(lp), a revised
    59       //Maybe we could try the routine lpx_intopt(lp), a revised
    60       //version of lpx_integer
    60       //version of lpx_integer
    69     }
    69     }
    70     return UNSOLVED;
    70     return UNSOLVED;
    71   }
    71   }
    72 
    72 
    73 
    73 
    74   LpGlpk::SolutionStatus MipGlpk::_getMipStatus(){
    74   LpGlpk::SolutionStatus MipGlpk::_getMipStatus() const {
    75 
    75 
    76     if (lpx_get_status(lp)==LPX_OPT){
    76     if (lpx_get_status(lp)==LPX_OPT){
    77       //Meg kell nezni: ha az LP is infinite, akkor ez is, ha az is
    77       //Meg kell nezni: ha az LP is infinite, akkor ez is, ha az is
    78       //infeasible, akkor ez is, de ez lehet maskepp is infeasible.
    78       //infeasible, akkor ez is, de ez lehet maskepp is infeasible.
    79       int stat=  lpx_mip_status(lp);
    79       int stat=  lpx_mip_status(lp);
    98       return UNDEFINED; //Maybe we could refine this: what does the LP
    98       return UNDEFINED; //Maybe we could refine this: what does the LP
    99 			//relaxation look like
    99 			//relaxation look like
   100       
   100       
   101   }  
   101   }  
   102 
   102 
   103   MipGlpk::Value MipGlpk::_getPrimal(int i){
   103   MipGlpk::Value MipGlpk::_getPrimal(int i) const {
   104     return lpx_mip_col_val(lp,i);
   104     return lpx_mip_col_val(lp,i);
   105   }
   105   }
   106   
   106   
   107   MipGlpk::Value MipGlpk::_getPrimalValue(){
   107   MipGlpk::Value MipGlpk::_getPrimalValue() const {
   108     return lpx_mip_obj_val(lp);
   108     return lpx_mip_obj_val(lp);
   109   }
   109   }
   110 } //END OF NAMESPACE LEMON
   110 } //END OF NAMESPACE LEMON