Scenario Runner

class discopygal.experiments.scenarios_runner.Scenario(solver_class, scene_path, parameters, time_limit, repetitions)

A type that defines a scenario - All the info required to run a solver on a scene.

solver_class
Solver class to use.
Required parameter
scene_path
Path to json scene file to use.
Required parameter
parameters
Parameters to pass to solver as dict: {<parameter_name>: <parameter_value>}.
For parameters that won’t be explicitly specified, their default value as defined in the solver will be used.
Optional - default is {}, e.g. the default args of the solver
time_limit
Max time to allow the solver to run (in seconds).
If solver exceeds this time it stops and regarded as it failed.
Optional - default is None - e.g. no time limit
repetitions
Number of times to repeat this scenario.
Results of the scenario are average of all there repetitions.
Optional - default is 10.
parameters

Alias for field number 2

repetitions

Alias for field number 4

scene_path

Alias for field number 1

solver_class

Alias for field number 0

time_limit

Alias for field number 3

exception discopygal.experiments.scenarios_runner.TimeoutException
discopygal.experiments.scenarios_runner.run_scenarios(scenarios, results_root_path, extra_result_handlers=None, resume_latest=False)

Run given scenarios and outputs the results to given file as csv

Parameters:
  • scenarios ([Scenario]) – List of scenarios to run

  • results_root_path (dict) – Output root dir for the results

  • extra_result_handlers

    More custom handlers that can run on the result of each solution and perform further calculations.
    A dict of {“<field_name>”: handler} where handler is a function that receives the path_collection and solver object and returns a number.

  • resume_latest (bool) –

    Resume the last experiment in result_root_path (according to the date in the name of the dir).
    All parameters (scenarios, extra_result_handlers) must be the same as the original experiment.
    If no experiments in result_root_path this parameter is ignored.