mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
Add types to remaining files; activate mypy's disallow_untyped_defs
This commit is contained in:
3
tests/fixtures/infeasible.py
vendored
3
tests/fixtures/infeasible.py
vendored
@@ -36,8 +36,9 @@ class InfeasibleGurobiInstance(Instance):
|
||||
return model
|
||||
|
||||
|
||||
def get_infeasible_instance(solver):
|
||||
def get_infeasible_instance(solver: Any) -> Instance:
|
||||
if _is_subclass_or_instance(solver, BasePyomoSolver):
|
||||
return InfeasiblePyomoInstance()
|
||||
if _is_subclass_or_instance(solver, GurobiSolver):
|
||||
return InfeasibleGurobiInstance()
|
||||
assert False
|
||||
|
||||
5
tests/fixtures/knapsack.py
vendored
5
tests/fixtures/knapsack.py
vendored
@@ -1,6 +1,9 @@
|
||||
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization
|
||||
# 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 List, Any, Tuple
|
||||
|
||||
from miplearn.instance.base import Instance
|
||||
from miplearn.problems.knapsack import KnapsackInstance, GurobiKnapsackInstance
|
||||
from miplearn.solvers.gurobi import GurobiSolver
|
||||
@@ -10,7 +13,7 @@ from miplearn.solvers.pyomo.base import BasePyomoSolver
|
||||
from tests.solvers import _is_subclass_or_instance
|
||||
|
||||
|
||||
def get_test_pyomo_instances():
|
||||
def get_test_pyomo_instances() -> Tuple[List[Instance], List[Any]]:
|
||||
instances = [
|
||||
KnapsackInstance(
|
||||
weights=[23.0, 26.0, 20.0, 18.0],
|
||||
|
||||
3
tests/fixtures/redundant.py
vendored
3
tests/fixtures/redundant.py
vendored
@@ -34,8 +34,9 @@ class GurobiInstanceWithRedundancy(Instance):
|
||||
return model
|
||||
|
||||
|
||||
def get_instance_with_redundancy(solver):
|
||||
def get_instance_with_redundancy(solver: Any) -> Instance:
|
||||
if _is_subclass_or_instance(solver, BasePyomoSolver):
|
||||
return PyomoInstanceWithRedundancy()
|
||||
if _is_subclass_or_instance(solver, GurobiSolver):
|
||||
return GurobiInstanceWithRedundancy()
|
||||
assert False
|
||||
|
||||
Reference in New Issue
Block a user