Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ipet/parsing/Solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ def extractByExpression(self, line : str, expr, key : str, datatype : type = flo
break
assert(d is not None)

# restrict floating point value to infinity threshold range
if datatype is float:
if d < -misc.FLOAT_INFINITY:
d = -misc.FLOAT_INFINITY
elif d > misc.FLOAT_INFINITY:
d = misc.FLOAT_INFINITY

self.addData(key, d)
except:
pass
Expand Down Expand Up @@ -251,6 +258,13 @@ def addHistoryData(self, key, timestr : str, boundstr : str):
bound = float(boundstr)
except:
return

# restrict floating point value to infinity threshold range
if bound < -misc.FLOAT_INFINITY:
bound = -misc.FLOAT_INFINITY
elif bound > misc.FLOAT_INFINITY:
bound = misc.FLOAT_INFINITY

history = self.data.setdefault(key, [])
# only append newly found bounds

Expand Down
12 changes: 6 additions & 6 deletions test/SolverTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ class SolverTest(unittest.TestCase):
Key.Nodes: 0,
Key.ObjectiveSense: Key.ObjectiveSenseCode.MINIMIZE,
Key.SolverStatus: Key.SolverStatusCodes.Infeasible }, {
Key.PrimalBound: 1e+40,
Key.DualBound: 1e+40} ],
Key.PrimalBound: 1e+20,
Key.DualBound: 1e+20} ],
"xpress300103-satellites1-25" : [ {
Key.Solver: "XPRESS",
Key.Version: "30.01.03",
Expand Down Expand Up @@ -633,8 +633,8 @@ class SolverTest(unittest.TestCase):
"OriginalProblem_InitialNCons": 1,
"PresolvedProblem_Vars": 1,
"PresolvedProblem_InitialNCons": 1 }, {
Key.PrimalBound: 1e+100,
Key.DualBound: 1e+100} ],
Key.PrimalBound: 1e+20,
Key.DualBound: 1e+20} ],
"soplex800-unbounded" : [ {
Key.Solver: "SoPlex",
Key.Version: "8.0.0",
Expand All @@ -648,8 +648,8 @@ class SolverTest(unittest.TestCase):
"OriginalProblem_InitialNCons": 1,
"PresolvedProblem_Vars": 1,
"PresolvedProblem_InitialNCons": 1 }, {
Key.PrimalBound: -1e+100,
Key.DualBound: -1e+100} ],
Key.PrimalBound: -1e+20,
Key.DualBound: -1e+20} ],
"soplex800-primalfeasible" : [ {
Key.Solver: "SoPlex",
Key.Version: "8.0.0",
Expand Down
Loading