Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

run

minto.run

Module for managing experiment runs.

This module provides the Run class for managing individual experiment runs. The Run class allows users to log parameters, solutions, samplesets, and other run-specific data to a database.

Classes

Run

Run()

Class to manage individual experiment runs.

This class provides a structured way to manage run-specific data within an optimization experiment, including logging of parameters, solutions, samplesets, and other run-specific data.

Attributes:

NameTypeDescription
_datastoreminto.v1.datastore.DataStoreThe underlying data storage for this run.
_experimenttyping.OptionalReference to the parent experiment.
_run_idintUnique identifier for this run.
_start_timedatetime.datetimeStart time of the run.
_closedboolFlag indicating if the run has been closed.

Methods

log_parameter
log_parameter(name: str, value: float | int | str | np.ndarray)

Log a parameter to this run.

Parameters:

NameTypeDescription
namestrName of the parameter.
value`floatint

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
log_params
log_params(params: dict)

Log multiple parameters to this run.

Parameters:

NameTypeDescription
paramsdictDictionary of parameter names and values. None values are automatically skipped.

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
log_object
log_object(name: str, value: dict)

Log a custom object to this run.

Parameters:

NameTypeDescription
namestrName of the object
valuedictDictionary containing the object data

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
log_problem
log_problem(problem_name: str | jm.Problem, problem: typing.Optional = None)

Log an optimization problem to this run.

Parameters:

NameTypeDescription
problem_name`strjm.Problem`
problemtyping.OptionalProblem object (if problem_name is a string).

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
log_instance
log_instance(instance_name: str | ommx_v1.Instance, instance: typing.Optional = None)

Log an optimization problem instance to this run.

Parameters:

NameTypeDescription
instance_name`strommx_v1.Instance`
instancetyping.OptionalInstance object (if instance_name is a string).

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
log_solution
log_solution(solution_name: str | ommx_v1.Solution, solution: typing.Optional = None)

Log an optimization solution to this run.

Parameters:

NameTypeDescription
solution_name`strommx_v1.Solution`
solutiontyping.OptionalSolution object (if solution_name is a string).

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
log_sampleset
log_sampleset(name: str | ommx_v1.SampleSet, value: typing.Optional = None)

Log a SampleSet to this run.

Parameters:

NameTypeDescription
name`strommx_v1.SampleSet`
valuetyping.OptionalSampleSet object (if name is a string).

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
TypeErrorIf value is not an OMMX SampleSet.
log_solver
log_solver(solver_name: str | typ.Callable[P, R], solver: typing.Optional = None, exclude_params: typing.Optional = None) -> typing.Callable

Log solver name and parameters to this run.

When the wrapped solver function is called, the following actions are performed:

Parameters:

NameTypeDescription
solver_name`strtyp.Callable[P, R]`
solvertyping.OptionalSolver function (if solver_name is a string).
exclude_paramstyping.OptionalList of parameter names to exclude from logging.

Returns:

TypeDescription
typing.CallableWrapped solver function.

Raises:

ExceptionDescription
RuntimeErrorIf the run has been closed.
TypeErrorIf solver_name or solver have incorrect types.
close
close()

Close this run and log elapsed time.

Once closed, the run cannot be used for further logging.