from __future__ import annotations from collections.abc import Callable, Iterable from typing import Any, Iterator, Literal, Sequence, TextIO, TypeVar, overload from docplex.mp.basic import Expr from docplex.mp.constants import EffortLevel, ObjectiveSense, WriteLevel from docplex.mp.constr import AbstractConstraint from docplex.mp.context import Context from docplex.mp.dvar import Var from docplex.mp.functional import ( AbsExpr, LogicalAndExpr, LogicalNotExpr, LogicalOrExpr, MaximumExpr, MinimumExpr, ) from docplex.mp.linear import AbstractLinearExpr, ConstantExpr, LinearExpr, ZeroExpr from docplex.mp.operand import LinearOperand from docplex.mp.params.parameters import RootParameterGroup from docplex.mp.progress import ProgressListener from docplex.mp.solution import SolveSolution from typing_extensions import TypeAlias _Key = TypeVar("_Key") _Val = TypeVar("_Val") _MethodDictArg: TypeAlias = ( dict[_Key, _Val] | list[_Val] | Callable[[_Key], _Val] | _Val ) _ObjectiveSense: TypeAlias = ( ObjectiveSense | Literal["min", "max", "minimize", "maximize", -1, 1] ) class Model: def __init__( self, name: str | None = None, context: Context | None = None, **kwargs: Any ) -> None: ... def binary_var(self, name: str | None = None) -> Var: ... def binary_var_list( self, keys: int | Sequence[_Key], name: _MethodDictArg[_Key, str] | None = None, key_format: str | None = None, ) -> list[Var]: ... def binary_var_dict( self, keys: Iterable[_Key], name: _MethodDictArg[_Key, str] | None = None, key_format: str | None = None, ) -> dict[_Key, Var]: ... def integer_var( self, lb: int | None = None, ub: int | None = None, name: str | None = None ) -> Var: ... def integer_var_list( self, keys: int | Sequence[_Key], lb: _MethodDictArg[_Key, int] | None = None, ub: _MethodDictArg[_Key, int] | None = None, name: _MethodDictArg[_Key, str] | None = None, key_format: str | None = None, ) -> list[Var]: ... def integer_var_dict( self, keys: Iterable[_Key], lb: _MethodDictArg[_Key, int] | None = None, ub: _MethodDictArg[_Key, int] | None = None, name: _MethodDictArg[_Key, str] | None = None, key_format: str | None = None, ) -> dict[_Key, Var]: ... def continuous_var( self, lb: float | None = None, ub: float | None = None, name: str | None = None ) -> Var: ... def continuous_var_list( self, keys: int | Sequence[_Key], lb: _MethodDictArg[_Key, float] | None = None, ub: _MethodDictArg[_Key, float] | None = None, name: _MethodDictArg[_Key, str] | None = None, key_format: str | None = None, ) -> list[Var]: ... def continuous_var_dict( self, keys: Iterable[_Key], lb: _MethodDictArg[_Key, float] | None = None, ub: _MethodDictArg[_Key, float] | None = None, name: _MethodDictArg[_Key, str] | None = None, key_format: str | None = None, ) -> dict[_Key, Var]: ... def sum(self, args: Iterable[LinearOperand | float]) -> LinearExpr | ZeroExpr: ... def sums(self, *args: LinearOperand | float) -> LinearExpr | ZeroExpr: ... def add_constraint( self, ct: AbstractConstraint, ctname: str | None = None ) -> AbstractConstraint: ... def add_constraints( self, ct: Iterable[AbstractConstraint], names: Iterable[str] | None = None ) -> list[AbstractConstraint]: ... def remove_constraints( self, cts: Iterable[AbstractConstraint], error: Literal["raise", "warn"] = "warn", ) -> list[AbstractConstraint]: ... @overload def add( self, ct: AbstractConstraint, name: str | None = None ) -> AbstractConstraint: ... @overload def add( self, ct: Iterable[AbstractConstraint], name: Iterable[str] | None = None ) -> list[AbstractConstraint]: ... def solve(self, **kwargs: Any) -> SolveSolution | None: ... def set_objective(self, sense: _ObjectiveSense, expr: Expr | Var) -> None: ... def set_objective_sense(self, sense: _ObjectiveSense) -> None: ... def set_objective_expr(self, expr: Expr | Var) -> None: ... def set_lex_multi_objective( self, sense: _ObjectiveSense, exprs: Iterable[Expr | Var], abstols: float | None = None, reltols: float | None = None, names: Iterable[str] | None = None, ) -> None: ... def get_objective_expr(self) -> Expr: ... def add_mip_start( self, mip_start_sol: SolveSolution, effort_level: EffortLevel | None = None, write_level: WriteLevel | None = None, complete_vars: bool = False, eps_zero: float = 1e-6, ) -> SolveSolution: ... @property def log_output(self) -> TextIO | bool: ... @log_output.setter def log_output(self, out: TextIO | bool) -> None: ... def set_log_output(self, out: TextIO) -> None: ... @property def parameters(self) -> RootParameterGroup: ... def problem_type(self) -> Literal["LP", "MILP", "QP", "MIQP", "QCP", "MIQCP"]: ... def print_information(self) -> None: ... def logical_and( self, *args: Var | Expr | LinearOperand ) -> Var | AbstractLinearExpr | ConstantExpr | LogicalAndExpr: ... def logical_or( self, *args: Var | Expr | LinearOperand ) -> Var | AbstractLinearExpr | ConstantExpr | LogicalOrExpr: ... def logical_not(self, other: Var | Expr) -> LogicalNotExpr: ... def abs(self, e: Var | Expr | float) -> AbsExpr: ... def min(self, *args: Var | Expr | Sequence[Var | Expr]) -> MinimumExpr: ... def max(self, *args: Var | Expr | Sequence[Var | Expr]) -> MaximumExpr: ... def if_then( self, if_ct: AbstractConstraint, then_ct: AbstractConstraint, negate: bool = ..., ) -> AbstractConstraint: ... def indicator_constraint( self, binary_var: Var, linear_ct: AbstractConstraint, active_value: Literal[0, 1] = ..., name: str | None = ..., ) -> AbstractConstraint: ... def add_indicator( self, binary_var: Var, linear_ct: AbstractConstraint, active_value: Literal[0, 1] = ..., name: str | None = ..., ) -> AbstractConstraint: ... def add_progress_listener(self, listener: ProgressListener) -> None: ... def remove_progress_listener(self, listener: ProgressListener) -> None: ... @property def number_of_progress_listeners(self) -> int: ... def iter_progress_listeners(self) -> Iterator[ProgressListener]: ... def clear_progress_listeners(self) -> None: ...