Skip to content

Commit

Permalink
Merge branch 'gurobi_unbounded_fix' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
qtothec committed Jun 16, 2017
2 parents 90ae046 + cea8d80 commit 9e2c25d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pyomo/solvers/plugins/solvers/GUROBI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# rights in this software.
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________
Expand Down Expand Up @@ -469,6 +469,16 @@ def process_soln_file(self, results):
elif (tokens[0] == 'termination_condition'):
try:
results.solver.termination_condition = getattr(TerminationCondition, tokens[1])
if results.solver.termination_condition == TerminationCondition.unbounded:
# If unbounded, need to check to make sure the
# problem is not actually infeasible.
if (results.problem.sense == ProblemSense.minimize and
results.problem.lower_bound == float('1e+100')) or \
(results.problem.sense == ProblemSense.maximize and
results.problem.upper_bound == float('-1e+100')):
# Problem is actually infeasible. Update accordingly.
results.solver.termination_condition = TerminationCondition.infeasible

except AttributeError:
results.solver.termination_condition = TerminationCondition.unknown
else:
Expand Down

0 comments on commit 9e2c25d

Please sign in to comment.