You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MIPLearn/tests/problems/test_vertexcover.py

22 lines
636 B

# 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