Reformat; remove unused imports

dev
Alinson S. Xavier 2 years ago
parent 8c2c45417b
commit d2faa15079

@ -166,7 +166,7 @@
"\n",
" # Extract and print constraint features\n",
" x3 = ext.get_constr_features(h5)\n",
" print(\"constraint features\", x3.shape, \"\\n\", x3)\n"
" print(\"constraint features\", x3.shape, \"\\n\", x3)"
]
},
{

@ -120,7 +120,7 @@
" extractor=H5FieldsExtractor(instance_fields=[\"static_var_obj_coeffs\"]),\n",
" constructor=MergeTopSolutions(k=3, thresholds=[0.25, 0.75]),\n",
" action=EnforceProximity(3),\n",
")\n"
")"
]
},
{
@ -175,7 +175,7 @@
" ),\n",
" extractor=AlvLouWeh2017Extractor(),\n",
" action=SetWarmStart(),\n",
")\n"
")"
]
},
{
@ -230,7 +230,7 @@
" instance_fields=[\"static_var_obj_coeffs\"],\n",
" ),\n",
" action=SetWarmStart(),\n",
")\n"
")"
]
},
{
@ -263,7 +263,7 @@
"# Configures an expert primal component, which reads a pre-computed\n",
"# optimal solution from the HDF5 file and provides it to the solver\n",
"# as warm start.\n",
"comp = ExpertPrimalComponent(action=SetWarmStart())\n"
"comp = ExpertPrimalComponent(action=SetWarmStart())"
]
}
],

@ -194,7 +194,7 @@
"\n",
"# Optimize first instance\n",
"model = build_binpack_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -397,7 +397,7 @@
"\n",
"# Build model and optimize\n",
"model = build_multiknapsack_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -577,7 +577,7 @@
"\n",
"# Build and optimize model\n",
"model = build_pmedian_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -726,7 +726,7 @@
"\n",
"# Build and optimize model\n",
"model = build_setcover_model_gurobipy(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -862,7 +862,7 @@
"\n",
"# Build and optimize model\n",
"model = build_setpack_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -999,7 +999,7 @@
"\n",
"# Load and optimize the first instance\n",
"model = build_stab_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -1174,7 +1174,7 @@
"\n",
"# Load and optimize the first instance\n",
"model = build_tsp_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -1412,7 +1412,7 @@
"\n",
"# Load and optimize the first instance\n",
"model = build_uc_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{
@ -1553,7 +1553,7 @@
"\n",
"# Load and optimize the first instance\n",
"model = build_vertexcover_model(data[0])\n",
"model.optimize()\n"
"model.optimize()"
]
},
{

@ -2,30 +2,16 @@
# Copyright (C) 2020-2023, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
from typing import Any, List, Hashable, Dict
from typing import Any, List, Dict
from unittest.mock import Mock
import gurobipy as gp
import networkx as nx
from gurobipy import GRB, quicksum
from sklearn.dummy import DummyClassifier
from sklearn.neighbors import KNeighborsClassifier
from miplearn.components.cuts.mem import MemorizingCutsComponent
from miplearn.extractors.abstract import FeaturesExtractor
from miplearn.problems.stab import build_stab_model
from miplearn.solvers.gurobi import GurobiModel
from miplearn.solvers.learning import LearningSolver
import numpy as np
# def test_usage() -> None:
# model = _build_cut_model()
# solver = LearningSolver(components=[])
# solver.optimize(model)
# assert model.cuts_ is not None
# assert len(model.cuts_) > 0
# assert False
def test_mem_component(

Loading…
Cancel
Save