mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
Make lazy constr component compatible with Pyomo+Gurobi
This commit is contained in:
30
tests/fixtures/gen_tsp.py
vendored
30
tests/fixtures/gen_tsp.py
vendored
@@ -5,7 +5,11 @@ from scipy.stats import uniform, randint
|
||||
|
||||
from miplearn.collectors.basic import BasicCollector
|
||||
from miplearn.io import write_pkl_gz
|
||||
from miplearn.problems.tsp import TravelingSalesmanGenerator, build_tsp_model
|
||||
from miplearn.problems.tsp import (
|
||||
TravelingSalesmanGenerator,
|
||||
build_tsp_model_gurobipy,
|
||||
build_tsp_model_pyomo,
|
||||
)
|
||||
|
||||
np.random.seed(42)
|
||||
gen = TravelingSalesmanGenerator(
|
||||
@@ -16,7 +20,27 @@ gen = TravelingSalesmanGenerator(
|
||||
fix_cities=True,
|
||||
round=True,
|
||||
)
|
||||
|
||||
data = gen.generate(3)
|
||||
data_filenames = write_pkl_gz(data, dirname(__file__), prefix="tsp-n20-")
|
||||
|
||||
params = {"seed": 42, "threads": 1}
|
||||
|
||||
# Gurobipy
|
||||
data_filenames = write_pkl_gz(data, dirname(__file__), prefix="tsp-gp-n20-")
|
||||
collector = BasicCollector()
|
||||
collector.collect(data_filenames, build_tsp_model)
|
||||
collector.collect(
|
||||
data_filenames,
|
||||
lambda d: build_tsp_model_gurobipy(d, params=params),
|
||||
progress=True,
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
# Pyomo
|
||||
data_filenames = write_pkl_gz(data, dirname(__file__), prefix="tsp-pyo-n20-")
|
||||
collector = BasicCollector()
|
||||
collector.collect(
|
||||
data_filenames,
|
||||
lambda d: build_tsp_model_pyomo(d, params=params),
|
||||
progress=True,
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
BIN
tests/fixtures/tsp-gp-n20-00000.h5
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00000.h5
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-gp-n20-00000.mps.gz
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00000.mps.gz
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/fixtures/tsp-gp-n20-00001.h5
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00001.h5
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-gp-n20-00001.mps.gz
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00001.mps.gz
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/fixtures/tsp-gp-n20-00002.h5
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00002.h5
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-gp-n20-00002.mps.gz
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00002.mps.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-gp-n20-00002.pkl.gz
vendored
Normal file
BIN
tests/fixtures/tsp-gp-n20-00002.pkl.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-n20-00000.h5
vendored
BIN
tests/fixtures/tsp-n20-00000.h5
vendored
Binary file not shown.
BIN
tests/fixtures/tsp-n20-00001.h5
vendored
BIN
tests/fixtures/tsp-n20-00001.h5
vendored
Binary file not shown.
BIN
tests/fixtures/tsp-n20-00001.mps.gz
vendored
BIN
tests/fixtures/tsp-n20-00001.mps.gz
vendored
Binary file not shown.
BIN
tests/fixtures/tsp-n20-00002.h5
vendored
BIN
tests/fixtures/tsp-n20-00002.h5
vendored
Binary file not shown.
BIN
tests/fixtures/tsp-n20-00002.mps.gz
vendored
BIN
tests/fixtures/tsp-n20-00002.mps.gz
vendored
Binary file not shown.
BIN
tests/fixtures/tsp-n20-00002.pkl.gz
vendored
BIN
tests/fixtures/tsp-n20-00002.pkl.gz
vendored
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00000.h5
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00000.h5
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00000.mps.gz
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00000.mps.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00000.pkl.gz
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00000.pkl.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00001.h5
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00001.h5
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00001.mps.gz
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00001.mps.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00001.pkl.gz
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00001.pkl.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00002.h5
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00002.h5
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00002.mps.gz
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00002.mps.gz
vendored
Normal file
Binary file not shown.
BIN
tests/fixtures/tsp-pyo-n20-00002.pkl.gz
vendored
Normal file
BIN
tests/fixtures/tsp-pyo-n20-00002.pkl.gz
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user