mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-09 02:48:52 -06:00
MIPLearn v0.3
This commit is contained in:
26
tests/problems/test_setpack.py
Normal file
26
tests/problems/test_setpack.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization
|
||||
# Copyright (C) 2020-2022, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
import numpy as np
|
||||
|
||||
from miplearn.problems.setpack import (
|
||||
SetPackData,
|
||||
build_setpack_model,
|
||||
)
|
||||
|
||||
|
||||
def test_setpack() -> None:
|
||||
data = SetPackData(
|
||||
costs=np.array([5, 10, 12, 6, 8]),
|
||||
incidence_matrix=np.array(
|
||||
[
|
||||
[1, 0, 0, 1, 0],
|
||||
[1, 1, 0, 0, 0],
|
||||
[0, 0, 1, 1, 1],
|
||||
],
|
||||
),
|
||||
)
|
||||
model = build_setpack_model(data)
|
||||
model.optimize()
|
||||
assert model.inner.objval == -22.0
|
||||
Reference in New Issue
Block a user