mamut_routing_lib.solvers.external.descriptor¶
Declarative description of an external solver executable.
A descriptor says how to call a solver (argv template), what it reads and
writes, its numeric limits and its capabilities; ExternalSolver does the
rest. Built-ins live in catalog; users add or override descriptors in the
solvers config (config).
argv placeholders: {executable} (absolute path: the native executable, or
the script of a runtime = "python" solver), {java}, {jar},
{python} (this interpreter), {problem}, {params}, {solution},
{workdir} (absolute paths), {seed}, {time_limit_s} (30 or
12.5), {time_limit_int} (whole seconds, at least 1), {vehicles}.
fleet_args are appended (formatted) when the instance has a fixed fleet,
then extra_args -- except with input_format = "lkh", where extra_args
are literal lines appended to the parameter file, whatever the argv. Such a
line cannot set a parameter that the runner writes for the run (the files, the
seed, the time limit, the precision): the descriptor is refused.
id_convention says how a cvrplib-sol solution file numbers its stops. It
is declared, not guessed: a file Route #1: 0 1 2 for 3 customers is complete
if customers are numbered from 0, and misses customer 3 if they are numbered
from 1 with the depot written as 0.
InputFormat
module-attribute
¶
ExternalSolverDescriptor
dataclass
¶
ExternalSolverDescriptor(
name: str,
label: str,
method: str,
argv: tuple[str, ...],
input_format: InputFormat,
output_format: OutputFormat,
capabilities: SolverCapabilities,
executable: str | None = None,
executable_names: tuple[str, ...] = (),
runtime: Literal["native", "java", "python"] = "native",
jar: str | None = None,
java: str = "java",
java_options: tuple[str, ...] = (),
solution_file: str = "solution.sol",
distance_model: Literal[
"float", "nint", "integer"
] = "float",
coordinate_scales: tuple[float, ...] = (1.0,),
matrix_scales: tuple[float, ...] = (
1.0,
0.1,
0.01,
0.001,
),
limits: Limits = Limits(),
require_exact_scale: bool = False,
fleet_args: tuple[str, ...] = (),
extra_args: tuple[str, ...] = (),
vehicles_factor: float = 1.2,
vrptw_vehicles_factor: float = 2.0,
timeout_grace_s: float = 30.0,
timeout_grace_fraction: float = 0.1,
term_grace_s: float = 2.0,
progress_pattern: str | None = None,
version: str | None = None,
env: Mapping[str, str] = dict(),
requires_note: str | None = None,
homepage: str | None = None,
source: str = "builtin",
*,
id_convention: IdConvention = "one-based",
)
runtime
class-attribute
instance-attribute
¶
id_convention
class-attribute
instance-attribute
¶
distance_model
class-attribute
instance-attribute
¶
coordinate_scales
class-attribute
instance-attribute
¶
matrix_scales
class-attribute
instance-attribute
¶
with_overrides
¶
to_json
¶
Source code in MAMUT-routing-lib/src/mamut_routing_lib/solvers/external/descriptor.py
sha256
¶
Hash of everything that shapes a run (not the source label).