mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-11 20:08:52 -06:00
MIPLearn v0.3
This commit is contained in:
21
tests/problems/test_vertexcover.py
Normal file
21
tests/problems/test_vertexcover.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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 networkx as nx
|
||||
import numpy as np
|
||||
|
||||
from miplearn.problems.vertexcover import (
|
||||
MinWeightVertexCoverData,
|
||||
build_vertexcover_model,
|
||||
)
|
||||
|
||||
|
||||
def test_stab() -> None:
|
||||
data = MinWeightVertexCoverData(
|
||||
graph=nx.cycle_graph(5),
|
||||
weights=np.array([1.0, 1.0, 1.0, 1.0, 1.0]),
|
||||
)
|
||||
model = build_vertexcover_model(data)
|
||||
model.optimize()
|
||||
assert model.inner.objVal == 3.0
|
||||
Reference in New Issue
Block a user