Store solution into instance object after solving

This commit is contained in:
2020-02-22 19:32:21 -06:00
parent 4bf7636f51
commit 141c8f0fdf
2 changed files with 35 additions and 5 deletions

View File

@@ -18,6 +18,13 @@ def test_solver():
instance = _get_instance()
solver = LearningSolver()
solver.solve(instance)
assert instance.solution["x"][0] == 1.0
assert instance.solution["x"][1] == 0.0
assert instance.solution["x"][2] == 1.0
assert instance.solution["x"][3] == 1.0
assert instance.lower_bound == 1183.0
assert instance.upper_bound == 1183.0
solver.fit()
solver.solve(instance)
@@ -52,3 +59,6 @@ def test_parallel_solve():
assert len(solver.components["warm-start"].x_train["default"]) == 40
assert len(solver.components["warm-start"].y_train["default"]) == 40
for instance in instances:
assert len(instance.solution["x"].keys()) == 4