Changeset 9496
 Timestamp:
 Dec 17, 2014 10:25:53 AM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

pyomo/trunk/pyomo/solvers/plugins/solvers/CPLEXDirect.py
r9392 r9496 920 920 # extraction of the absolute gap, so we have to compute it. 921 921 m = instance.solution.quality_metric 922 try: 922 if instance.get_problem_type() in [instance.problem_type.MILP, 923 instance.problem_type.MIQP, 924 instance.problem_type.MIQCP]: 923 925 relative_gap = instance.solution.MIP.get_mip_relative_gap() 924 926 best_integer = instance.solution.MIP.get_best_objective() 925 927 diff = relative_gap * (1.0e10 + math.fabs(best_integer)) 926 soln.gap = diff 927 except CplexError: 928 # 929 # If an error occurs, then the model is not a MIP 930 # 931 pass 928 soln.gap = diff 932 929 933 930 #Only try to get objective and variable values if a solution exists
Note: See TracChangeset
for help on using the changeset viewer.