Skip to content

Commit

Permalink
A first step towards updating the GLPK results
Browse files Browse the repository at this point in the history
reader.  I've copied the GLPK shell class that was working,
to retain backwards compatibility.


git-svn-id: https://software.sandia.gov/svn/pyomo/pyomo/trunk@11392 570ccb8d-5833-0410-9ce8-cbedd0da42eb
  • Loading branch information
whart222 committed May 14, 2016
1 parent 049b5e5 commit ec4f7d6
Show file tree
Hide file tree
Showing 2 changed files with 384 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pyomo/solvers/plugins/solvers/GLPK.py
Expand Up @@ -39,7 +39,7 @@ def configure_glpk():
[registered_executable('glpsol').get_path(), "--version"], timelimit=2)
if errcode == 0:
_glpk_version = _extract_version(results)
glpk_file_flag = _glpk_version >= (4,42,0,0)
glpk_file_flag = _glpk_version >= (4,60,0,0)


# Not sure how better to get these constants, but pulled from GLPK
Expand Down Expand Up @@ -78,14 +78,17 @@ def __new__(cls, *args, **kwds):
if mode == 'lp':
if glpk_file_flag:
return SolverFactory('_glpk_shell', **kwds)
elif _glpk_version >= (4,42,0,0):
return SolverFactory('_glpk_shell_4_42', **kwds)
else:
return SolverFactory('_glpk_shell_old', **kwds)
if mode == 'mps':
if glpk_file_flag:
opt = SolverFactory('_glpk_shell', **kwds)
elif _glpk_version >= (4,42,0,0):
opt = SolverFactory('_glpk_shell_4_42', **kwds)
else:
opt = SolverFactory('_glpk_shell_old', **kwds)
opt = SolverFactory('_glpk_shell', **kwds)
opt.set_problem_format(ProblemFormat.mps)
return opt
if mode == 'python':
Expand Down Expand Up @@ -209,7 +212,6 @@ def create_command_line(self, executable, problem_files):

return Bunch(cmd=cmd, log_file=self._log_file, env=None)


def process_logfile(self):
"""
Process logfile
Expand Down Expand Up @@ -251,7 +253,6 @@ def process_logfile(self):

return results


def _glpk_get_solution_status(self, status):
if GLP_OPT == status: return SolutionStatus.optimal
elif GLP_FEAS == status: return SolutionStatus.feasible
Expand All @@ -261,7 +262,6 @@ def _glpk_get_solution_status(self, status):
elif GLP_UNDEF == status: return SolutionStatus.other
raise RuntimeError("Unknown solution status returned by GLPK solver")


def process_soln_file (self, results):
soln = None
pdata = self._glpfile
Expand Down

0 comments on commit ec4f7d6

Please sign in to comment.