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:
They can be parameterized by passing in optional arguments in the constructor. This should be reflected in the
name!The
EventBusspawns a thread for eachon_*method and calls them when a correspondingEventoccurs.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.
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 benumpy.ndarrayof floats.Additionally, the can get hold of other heuristics or anayzers via the strategy instance.
The
EventBusinside 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:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- __init__(strategy: StrategyBase, name: str | None = None, cap: int | None = None) None[source]#
- Parameters:
strategy (StrategyBase)
name (str)
@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.
emit(points)This is used to send out new search points for evaluation.
get_points([limit])Drain the output queue until
limitpoints are removed or it is empty.Attributes
This is queried by the strategy to determine, if it should still consider it.
eventbusnameThe module's name.
problemresultsstrategy