equal
deleted
inserted
replaced
27 namespace lemon { |
27 namespace lemon { |
28 |
28 |
29 MipGlpk::MipGlpk() { |
29 MipGlpk::MipGlpk() { |
30 lpx_set_class(lp,LPX_MIP); |
30 lpx_set_class(lp,LPX_MIP); |
31 } |
31 } |
32 |
32 |
33 void MipGlpk::_integer(int i, bool enable){ |
33 void MipGlpk::_colType(int i, ColTypes col_type){ |
34 if(enable){ |
34 switch (col_type){ |
35 lpx_set_col_kind(lp,i,LPX_IV); |
35 case INTEGER: |
36 }else{ |
36 lpx_set_col_kind(lp,i,LPX_IV); |
37 lpx_set_col_kind(lp,i,LPX_CV); |
37 break; |
|
38 case REAL: |
|
39 lpx_set_col_kind(lp,i,LPX_CV); |
|
40 break; |
|
41 default: |
|
42 //FIXME problem |
38 } |
43 } |
39 } |
44 } |
40 |
45 |
41 bool MipGlpk::_integer(int i){ |
46 ColTypes MipGlpk::_colType(int i){ |
42 if(LPX_IV == lpx_get_col_kind(lp,i)){ |
47 switch (lpx_get_col_kind(lp,i)){ |
43 return true; |
48 case LPX_IV: |
|
49 return INTEGER;//Or binary |
|
50 case LPX_CV: |
|
51 return REAL; |
|
52 default: |
|
53 return REAL;//Error! |
44 } |
54 } |
45 return false; |
55 |
46 } |
56 } |
47 |
57 |
48 LpGlpk::SolveExitStatus MipGlpk::_solve(){ |
58 LpGlpk::SolveExitStatus MipGlpk::_solve(){ |
49 int result = lpx_simplex(lp); |
59 int result = lpx_simplex(lp); |
50 result = lpx_integer(lp); |
60 result = lpx_integer(lp); |