Refer to variables by varname instead of (vname, index)

This commit is contained in:
2021-04-07 10:56:31 -05:00
parent 856b595d5e
commit 1cf6124757
22 changed files with 467 additions and 516 deletions

View File

@@ -2,7 +2,7 @@
# 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 Optional, Dict, Callable, Any, Union, Tuple, TYPE_CHECKING
from typing import Optional, Dict, Callable, Any, Union, Tuple, TYPE_CHECKING, Hashable
from mypy_extensions import TypedDict
@@ -10,9 +10,15 @@ if TYPE_CHECKING:
# noinspection PyUnresolvedReferences
from miplearn.solvers.learning import InternalSolver
VarIndex = Union[str, int, Tuple[Union[str, int]]]
Solution = Dict[str, Dict[VarIndex, Optional[float]]]
BranchPriorities = Dict[str, Optional[float]]
Category = Hashable
Constraint = Any
IterationCallback = Callable[[], bool]
LazyCallback = Callable[[Any, Any], None]
SolverParams = Dict[str, Any]
UserCutCallback = Callable[["InternalSolver", Any], None]
VariableName = str
Solution = Dict[VariableName, Optional[float]]
LPSolveStats = TypedDict(
"LPSolveStats",
@@ -65,17 +71,3 @@ LearningSolveStats = TypedDict(
},
total=False,
)
IterationCallback = Callable[[], bool]
LazyCallback = Callable[[Any, Any], None]
UserCutCallback = Callable[["InternalSolver", Any], None]
SolverParams = Dict[str, Any]
BranchPriorities = Solution
class Constraint:
pass