Skip to content

Specs and Values

Sandro Sgier edited this page Nov 18, 2022 · 2 revisions

A spec defines the parameter space of an objective function. It is a tree structure where each node, called a spec node, defines a data type. Specs are provided by the user in YAML.

A value or individual (the two terms are used interchangeably) is a point in the parameter space. Values are instantiated by cambrian and provided to the objective function in form of a JSON.

An intuitive example is shown below. Provided are the content of a spec file, a graphical illustration of the tree structure, and a possible value. Details like the attributes can be ignored here. It suffices to mention here that anon map (anonymous map) is a recursive type, while real, int and bool are leaf types. Anonymous maps define resizable collections of a specific value type, in this case int.

Spec file content:

foo:
    type: real
    init: 0
    scale: 1
bar:
    type: bool
    init: false
baz:
    type: anon map
    valueType:
        type: int
        init: 1
        scale: 2
    initSize: 2

Visual representation of spec tree:

       (root)
      /   |   \
     /    |    \
    /     |     \
   /      |      \
 real    bool  anon map
                   |
                   |
                  int

A possible value generated by cambrian:

{
    "foo": 1.5,
    "bar": false,
    "baz": {
        "0": 2,
        "3": 11,
        "4": 10
    }
}

Some general information on data types:

  • Each type has 0 or more attributes (e.g. scale in type real).
  • Some attributes are mandatory (e.g. scale in type real) while others are optional (e.g. max in type real).
  • Types can be divided into two groups:
    • leaf types: real, int, bool, enum, const
    • recursive types: sub, anon map, variant, optional
  • Each type has its own mutation behavior
  • Recursive types each have their own crossover behavior

Below are links to the detailed explanations of each type, listing all corresponding attributes and describing the crossover (where applicable) and mutation logic. Each explanation will also contain examples for how a spec and a corresponding value might look like, and how the results of crossover and mutation might look like.