advent-of-code/typings/docplex/mp/solution.pyi
Mikael CAPELLE acb767184e Fix linting.
2024-12-03 14:11:29 +01:00

50 lines
1.6 KiB
Python

from __future__ import annotations
from collections.abc import Iterable, Mapping
from typing import Literal, Sequence, TypeVar
from docplex.mp.constants import WriteLevel
from docplex.mp.dvar import Var
from docplex.mp.model import Model
from docplex.mp.sdetails import SolveDetails
from typing_extensions import TypeAlias
_Key = TypeVar("_Key")
_SolvedBy: TypeAlias = Literal["cplex_local", "cplex_cloud"] | None
class SolveSolution:
def __init__(
self,
model: Model,
var_value_map: Mapping[Var, float] | None = None,
obj: Sequence[float] | float | None = None,
blended_obj_by_priority: Sequence[float] | None = None,
name: str | None = None,
solved_by: _SolvedBy = None,
keep_zeros: bool = True,
) -> None: ...
@property
def problem_name(self) -> str: ...
@property
def solved_by(self) -> _SolvedBy: ...
@property
def name(self) -> str: ...
@property
def solve_details(self) -> SolveDetails: ...
def get_objective_value(self) -> float | list[float]: ...
def get_value(self, arg: Var) -> float: ...
def get_values(self, var_seq: Iterable[Var]) -> list[float]: ...
def get_value_list(self, dvars: Iterable[Var]) -> list[float]: ...
def get_value_dict(
self,
var_dict: Mapping[_Key, Var],
keep_zeros: bool = True,
precision: float = 1e-6,
) -> dict[_Key, float]: ...
def as_mip_start(
self,
write_level: WriteLevel = ...,
complete_vars: bool = False,
eps_zero: float = 1e-6,
) -> SolveSolution: ...