panobbgo.core.Heuristic#

class panobbgo.core.Heuristic(strategy: StrategyBase, name: str | None = None, cap: int | None = None)[source]#

This is the “abstract” parent class for all types of point generating classes, which we call collectively “Heuristics”.

Such a heuristic is capable of the following:

  1. They can be parameterized by passing in optional arguments in the constructor. This should be reflected in the name!

  2. The EventBus spawns a thread for each on_* method and calls them when a corresponding Event occurs.

  3. Of course, they are capable of storing their state in the instance. This is also the way of how information is shared between those threads.

  4. The main purpose of a heuristic is to emit new search points by calling either emit() or returning a list of points. The datatype must be numpy.ndarray of floats.

  5. Additionally, the can get hold of other heuristics or anayzers via the strategy instance.

  6. The EventBus inside this strategy instance allows them to publish their own events, too. This can be used to signal related heuristics something or to queue up tasks for itself.

Parameters:

@type strategy: StrategyBase

__init__(strategy: StrategyBase, name: str | None = None, cap: int | None = None) → None[source]#
Parameters:

@type strategy: StrategyBase

Methods

__init__(strategy[, name, cap])

check_dependencies(analyzers, heuristics)

This method is called by the core initialization to assess, if the dependencies for the given module are met.

clear_output()

emit(points)

This is used to send out new search points for evaluation.

get_points([limit])

Drain the output queue until limit points are removed or it is empty.

Attributes

active

This is queried by the strategy to determine, if it should still consider it.

eventbus

name

The module's name.

problem

results

strategy