Skip to content

Commit

Permalink
test ipopt version before trying get_current_iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbybp committed Aug 13, 2024
1 parent 6820db3 commit 58b5df8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# We don't raise unittest.SkipTest if not cyipopt_available as there is a
# test below that tests an exception when cyipopt is unavailable.
cyipopt_ge_1_3 = hasattr(cyipopt, "CyIpoptEvaluationError")
ipopt_ge_3_14 = cyipopt.IPOPT_VERSION >= (3, 14, 0)


def create_model1():
Expand Down Expand Up @@ -369,11 +370,12 @@ def intermediate(
# only has access to the *previous iteration's* dual values.

# The 13-arg callback works with cyipopt < 1.3, but we will use the
# get_current_iterate method, which is only available in 1.3+
# get_current_iterate method, which is only available in 1.3+ and IPOPT 3.14+
@unittest.skipIf(
not cyipopt_available or not cyipopt_ge_1_3, "cyipopt version < 1.3.0"
not cyipopt_available or not cyipopt_ge_1_3 or not ipopt_ge_3_14,
"cyipopt version < 1.3.0",
)
def test_solve_13arg_callback(self):
def test_solve_get_current_iterate(self):
m = create_model1()

iterate_data = []
Expand Down

0 comments on commit 58b5df8

Please sign in to comment.