mamut_routing_lib.solvers.registry¶
Solvers by name.
Three sources, in increasing precedence:
- built-ins:
pyvrp,kayrosand the external executables ofsolvers.external.catalog(filo2,hgs-cvrp,ails2,lkh3); - third-party packages, through the
mamut_routing.solversentry-point group (each entry point loads aSolverinstance, class or zero-argument factory); register_solvercalls, and the user solver config (solvers.external.config: overrides of built-in external solvers and new external solvers).
A built-in is replaced on purpose only. Installing a package is not a purpose:
an entry point that carries a built-in name is ignored with a warning, and so
is a second entry point of a name that another package already provides.
register_solver takes a built-in name with replace=True, and the user
config overrides the built-in external solvers by design.
Importing this module never imports PyVRP or KAYROS: solvers whose extra is
missing are listed and report availability().available == False. The user
config cannot define in-process solvers, so get_solver("pyvrp") and
get_solver("kayros") never read it: a broken config blocks only the
external solvers.
BUILTIN_SOLVERS
module-attribute
¶
UnknownSolverError
¶
Bases: ValueError
No solver of that name; the message lists the known ones.
register_solver
¶
Register a solver instance or zero-argument factory under name (default: its name).
Source code in MAMUT-routing-lib/src/mamut_routing_lib/solvers/registry.py
reload_solvers
¶
Forget cached solver objects, entry points and the parsed user config.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/solvers/registry.py
solver_names
¶
Every known solver name: built-ins first, then plugins, registrations and configured solvers.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/solvers/registry.py
get_solver
¶
The solver called name; UnknownSolverError lists the known names.
Source code in MAMUT-routing-lib/src/mamut_routing_lib/solvers/registry.py
list_solvers
¶
Every known solver, available or not, in solver_names order.