mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
Make assert_equals work with np.ndarray
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
from typing import Any, List
|
||||
|
||||
import numpy as np
|
||||
|
||||
from miplearn.features import VariableFeatures, ConstraintFeatures
|
||||
from miplearn.solvers.internal import InternalSolver
|
||||
|
||||
@@ -282,4 +284,8 @@ def run_lazy_cb_tests(solver: InternalSolver) -> None:
|
||||
|
||||
|
||||
def assert_equals(left: Any, right: Any) -> None:
|
||||
if isinstance(left, np.ndarray):
|
||||
left = left.tolist()
|
||||
if isinstance(right, np.ndarray):
|
||||
right = right.tolist()
|
||||
assert left == right, f"left:\n{left}\nright:\n{right}"
|
||||
|
||||
Reference in New Issue
Block a user