pyepo.func.runtime

Framework-neutral runtime setup for differentiable optimization modules.

Attributes

Classes

RuntimeState

Validated state shared by the Torch and JAX frontends.

Functions

bind_runtime_state(→ None)

Attach validated runtime state to a frontend module.

normalize_processes(→ int)

Validate and normalize a requested solver-process count.

create_solver_pool(...)

Create a worker pool, optionally tied to an owner's lifetime.

init_solution_pool(→ T | None)

Initialize a frontend-specific solution pool from an optDataset when needed.

init_runtime(→ RuntimeState)

Validate common module arguments and initialize solver runtime state.

Module Contents

pyepo.func.runtime.Reduction
pyepo.func.runtime.T
class pyepo.func.runtime.RuntimeState

Validated state shared by the Torch and JAX frontends.

optmodel: pyepo.model.opt.optModel
processes: int
pool: pathos.multiprocessing.ProcessingPool | None
solve_ratio: float
reduction: Reduction
branch_rng: numpy.random.RandomState
pyepo.func.runtime.bind_runtime_state(owner: Any, runtime: RuntimeState) None

Attach validated runtime state to a frontend module.

pyepo.func.runtime.normalize_processes(optmodel: pyepo.model.opt.optModel, processes: int, logger: logging.Logger) int

Validate and normalize a requested solver-process count.

pyepo.func.runtime.create_solver_pool(optmodel: pyepo.model.opt.optModel, processes: int, *, owner=None) pathos.multiprocessing.ProcessingPool | None

Create a worker pool, optionally tied to an owner’s lifetime.

pyepo.func.runtime.init_solution_pool(dataset: pyepo.data.dataset.optDataset | None, solve_ratio: float, require_solpool: bool, unique: Callable[[object], T]) T | None

Initialize a frontend-specific solution pool from an optDataset when needed.

pyepo.func.runtime.init_runtime(owner, optmodel: pyepo.model.opt.optModel, processes: int, solve_ratio: float, reduction: str, seed: int | None, logger: logging.Logger) RuntimeState

Validate common module arguments and initialize solver runtime state.