Minor changes.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #ifndef LEMON_MIP_GLPK_CC
20 #define LEMON_MIP_GLPK_CC
23 ///\brief Implementation of the LEMON-GLPK mip solver interface.
25 #include <lemon/mip_glpk.h>
30 lpx_set_class(lp,LPX_MIP);
33 void MipGlpk::_colType(int i, MipGlpk::ColTypes col_type){
36 lpx_set_col_kind(lp,i,LPX_IV);
39 lpx_set_col_kind(lp,i,LPX_CV);
46 MipGlpk::ColTypes MipGlpk::_colType(int i){
47 switch (lpx_get_col_kind(lp,i)){
49 return LEMON_INTEGER;//Or binary
58 LpGlpk::SolveExitStatus MipGlpk::_solve(){
59 int result = lpx_simplex(lp);
61 if (lpx_get_status(lp)==LPX_OPT){
62 //Maybe we could try the routine lpx_intopt(lp), a revised
63 //version of lpx_integer
64 result = lpx_integer(lp);
77 LpGlpk::SolutionStatus MipGlpk::_getMipStatus(){
79 if (lpx_get_status(lp)==LPX_OPT){
80 //Meg kell nezni: ha az LP is infinite, akkor ez is, ha az is
81 //infeasible, akkor ez is, de ez lehet maskepp is infeasible.
82 int stat= lpx_mip_status(lp);
85 case LPX_I_UNDEF://Undefined (no solve has been run yet)
87 case LPX_I_NOFEAS://There is no feasible integral solution
89 // case LPX_UNBND://Unbounded
91 case LPX_I_FEAS://Feasible
93 case LPX_I_OPT://Feasible
96 return UNDEFINED; //to avoid gcc warning
101 return UNDEFINED; //Maybe we could refine this: what does the LP
102 //relaxation look like
106 MipGlpk::Value MipGlpk::_getPrimal(int i){
107 return lpx_mip_col_val(lp,i);
110 MipGlpk::Value MipGlpk::_getPrimalValue(){
111 return lpx_mip_obj_val(lp);
113 } //END OF NAMESPACE LEMON
115 #endif //END OF MIP_GLPK_CC