More doc.
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
20 ///\brief Implementation of the LEMON-GLPK mip solver interface.
22 #include <lemon/mip_glpk.h>
27 lpx_set_class(lp,LPX_MIP);
30 void MipGlpk::_colType(int i, MipGlpk::ColTypes col_type){
33 lpx_set_col_kind(lp,i,LPX_IV);
36 lpx_set_col_kind(lp,i,LPX_CV);
43 MipGlpk::ColTypes MipGlpk::_colType(int i) const {
44 switch (lpx_get_col_kind(lp,i)){
46 return INT;//Or binary
55 LpGlpk::SolveExitStatus MipGlpk::_solve() {
56 int result = lpx_simplex(lp);
58 if (lpx_get_status(lp)==LPX_OPT){
59 //Maybe we could try the routine lpx_intopt(lp), a revised
60 //version of lpx_integer
61 result = lpx_integer(lp);
74 LpGlpk::SolutionStatus MipGlpk::_getMipStatus() const {
76 if (lpx_get_status(lp)==LPX_OPT){
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.
79 int stat= lpx_mip_status(lp);
82 case LPX_I_UNDEF://Undefined (no solve has been run yet)
84 case LPX_I_NOFEAS://There is no feasible integral solution
86 // case LPX_UNBND://Unbounded
88 case LPX_I_FEAS://Feasible
90 case LPX_I_OPT://Feasible
93 return UNDEFINED; //to avoid gcc warning
98 return UNDEFINED; //Maybe we could refine this: what does the LP
99 //relaxation look like
103 MipGlpk::Value MipGlpk::_getPrimal(int i) const {
104 return lpx_mip_col_val(lp,i);
107 MipGlpk::Value MipGlpk::_getPrimalValue() const {
108 return lpx_mip_obj_val(lp);
110 } //END OF NAMESPACE LEMON