mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Remove unused classes and methods
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any, List
|
||||
|
||||
from miplearn.features import Constraint, VariableFeatures, ConstraintFeatures
|
||||
from miplearn.features import VariableFeatures, ConstraintFeatures
|
||||
from miplearn.solvers.internal import InternalSolver
|
||||
|
||||
inf = float("inf")
|
||||
@@ -13,14 +13,6 @@ inf = float("inf")
|
||||
# This file is in the main source folder, so that it can be called from Julia.
|
||||
|
||||
|
||||
def _round_constraints(constraints: Dict[str, Constraint]) -> Dict[str, Constraint]:
|
||||
for (cname, c) in constraints.items():
|
||||
for attr in ["slack", "dual_value"]:
|
||||
if getattr(c, attr) is not None:
|
||||
setattr(c, attr, round(getattr(c, attr), 6))
|
||||
return constraints
|
||||
|
||||
|
||||
def _round(obj: Any) -> Any:
|
||||
if obj is None:
|
||||
return None
|
||||
@@ -46,20 +38,6 @@ def _filter_attrs(allowed_keys: List[str], obj: Any) -> Any:
|
||||
return obj
|
||||
|
||||
|
||||
def _remove_unsupported_constr_attrs(
|
||||
solver: InternalSolver,
|
||||
constraints: Dict[str, Constraint],
|
||||
) -> Dict[str, Constraint]:
|
||||
for (cname, c) in constraints.items():
|
||||
to_remove = []
|
||||
for k in c.__dict__.keys():
|
||||
if k not in solver.get_constraint_attrs():
|
||||
to_remove.append(k)
|
||||
for k in to_remove:
|
||||
setattr(c, k, None)
|
||||
return constraints
|
||||
|
||||
|
||||
def run_internal_solver_tests(solver: InternalSolver) -> None:
|
||||
run_basic_usage_tests(solver.clone())
|
||||
run_warm_start_tests(solver.clone())
|
||||
|
||||
Reference in New Issue
Block a user