bsmart.tools.toy_targets

Tool to generate example optimisation targets

This tool defines example target functions that are commonly used to test Black Box optimisation algorithms.

The results are stored directly as observables: * Rosenbrock * Rastrigin * Ackley * Himmelblau * Easom

So these can be obtained directly as observables using “FUNCTION”: “Rosenbrock” etc; alternatively they can be obtained in the block TOYTARGETS:

Block TOYTARGETS

1 <> # Rosenbrock function 2 <> # Rastrigin 3 <> # Ackley 4 <> # Himmelblau 5 <> # Easom

But be warned that no SLHA file is read or written for this tool: data is held in memory only.

Note that, since the functions are positive-definite and supposed to be minimised, this is equivelent to a negative-log-likelihood, so they should be declared with scaling “MINUSEXPUSER” (since this would transform the value into a ‘likelihood’ between 0 and 1)

The following parameters can be configured in the settings for this tool: * Rosenbrock a: The ‘a’ parameter for the Rosenbrock function (default: 1.0). * Rosenbrock b: The ‘b’ parameter for the Rosenbrock function (default: 100.0). * Rastrigin A: The ‘A’ parameter for the Rastrigin function (default: 10.0). * Ackley a: The ‘a’ parameter for the Ackley function (default: 20.0). * Ackley b: The ‘b’ parameter for the Ackley function (default: 0.2). * Ackley c: The ‘c’ parameter for the Ackley function (default: 2*pi). * Himmelblau a: The ‘a’ parameter for Himmelblau’s function (default: 11.0). * Himmelblau b: The ‘b’ parameter for Himmelblau’s function (default: 7.0). * Easom center: The [x, y] center for the Easom function (default: [pi, pi]).

Example usage in a BSMArt JSON file: .. code-block:: json

“Codes”: {
“toy_targets”: {

“Run”: “True”, “Rosenbrock a”: 1.5, “Observables”: {

“Rosen”: { “FUNCTION”: “Rosenbrock”, “SCALING” : “MINUSEXPUSER” }, “Rastrigin” : { “SLHA”: [ “TOYTARGETS”, [2]], “SCALING”: “MINUSEXPUSER” }

}

}

Information

BSMArt Name: toy_targets

Requires:

Settings:

  • Rosenbrock a: The ‘a’ parameter for the Rosenbrock function (default: 1.0).

  • Rosenbrock b: The ‘b’ parameter for the Rosenbrock function (default: 100.0).

  • Rastrigin A: The ‘A’ parameter for the Rastrigin function (default: 10.0).

  • Ackley a: The ‘a’ parameter for the Ackley function (default: 20.0).

  • Ackley b: The ‘b’ parameter for the Ackley function (default: 0.2).

  • Ackley c: The ‘c’ parameter for the Ackley function (default: 2*pi).

  • Himmelblau a: The ‘a’ parameter for Himmelblau’s function (default: 11.0).

  • Himmelblau b: The ‘b’ parameter for Himmelblau’s function (default: 7.0).

  • Easom center: The [x, y] center for the Easom function (default: [pi, pi]).

class bsmart.tools.toy_targets.NewTool(name, settings, global_settings=None)[source]

Bases: HepTool

overload the init to initialise variables

run(spc_file, temp_dir, log, data_point)[source]