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.

Attributes#

P

R

Classes#

Run

Class to manage individual experiment runs.

Module Contents#

class 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.

_datastore#

The underlying data storage for this run.

Type:

DataStore

_experiment#

Reference to the parent experiment.

_run_id#

Unique identifier for this run.

Type:

int

_start_time#

Start time of the run.

Type:

datetime

_closed#

Flag indicating if the run has been closed.

Type:

bool

close()#

Close this run and log elapsed time.

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

log_instance(instance_name: str | ommx.v1.Instance, instance: ommx.v1.Instance | None = None)#

Log an optimization problem instance to this run.

パラメータ:
  • instance_name -- Name of the instance, or the instance object itself.

  • instance -- Instance object (if instance_name is a string).

例外:

RuntimeError -- If the run has been closed.

log_object(name: str, value: dict[str, Any])#

Log a custom object to this run.

パラメータ:
  • name -- Name of the object

  • value -- Dictionary containing the object data

例外:

RuntimeError -- If the run has been closed.

log_parameter(name: str, value: float | int | str | list | dict | numpy.ndarray)#

Log a parameter to this run.

パラメータ:
  • name (str) -- Name of the parameter.

  • value -- Value of the parameter. Can be scalar or complex data structure.

例外:

RuntimeError -- If the run has been closed.

log_params(params: dict[str, float | int | str])#

Log multiple parameters to this run.

パラメータ:

params -- Dictionary of parameter names and values.

例外:

RuntimeError -- If the run has been closed.

log_problem(problem_name: str | jijmodeling.Problem, problem: jijmodeling.Problem | None = None)#

Log an optimization problem to this run.

パラメータ:
  • problem_name -- Name of the problem, or the problem object itself.

  • problem -- Problem object (if problem_name is a string).

例外:

RuntimeError -- If the run has been closed.

log_sampleset(name: str | ommx.v1.SampleSet, value: ommx.v1.SampleSet | None = None)#

Log a SampleSet to this run.

パラメータ:
  • name -- Name of the sampleset, or the sampleset object itself.

  • value -- SampleSet object (if name is a string).

例外:

RuntimeError -- If the run has been closed.

log_solution(solution_name: str | ommx.v1.Solution, solution: ommx.v1.Solution | None = None)#

Log an optimization solution to this run.

パラメータ:
  • solution_name -- Name of the solution, or the solution object itself.

  • solution -- Solution object (if solution_name is a string).

例外:

RuntimeError -- If the run has been closed.

log_solver(solver_name: str | Callable[P, R], solver: Callable[P, R] | None = None, *, exclude_params: list[str] | None = None) Callable[P, R]#

Log solver name and parameters to this run.

When the wrapped solver function is called, the following actions are performed: - The solver name is logged as a parameter - Each keyword argument is logged as appropriate (parameter, problem, instance) - The result is logged as a sampleset or solution if applicable

パラメータ:
  • solver_name -- Name of the solver or the solver function itself.

  • solver -- Solver function (if solver_name is a string).

  • exclude_params -- List of parameter names to exclude from logging.

戻り値:

Wrapped solver function.

例外:

RuntimeError -- If the run has been closed.

property instances: dict[str, ommx.v1.Instance]#

Get all instances logged to this run.

property is_closed: bool#

Check if the run is closed.

property objects: dict[str, Any]#

Get all objects logged to this run.

property parameters: dict[str, Any]#

Get all parameters logged to this run.

property problems: dict[str, jijmodeling.Problem]#

Get all problems logged to this run.

property run_id: int#

Get the run ID.

property samplesets: dict[str, ommx.v1.SampleSet]#

Get all samplesets logged to this run.

property solutions: dict[str, ommx.v1.Solution]#

Get all solutions logged to this run.

P#
R#