panobbgo.analyzers.convergence.Convergence#

class panobbgo.analyzers.convergence.Convergence(strategy, window_size=None, threshold=None, mode=None, min_evaluations=None)[source]#

Analyzes the progress of the optimization to detect convergence or stagnation.

It listens to new_results events and tracks the history of the best objective function values. If the improvement over a specified window of evaluations is below a threshold, or if the standard deviation of the best values in the window is small enough, it publishes a converged event.

Configuration parameters: a keyword argument wins; otherwise the strategy.config attribute in parentheses is used when it exists and is not None; otherwise the default. 0 / 0.0 are honoured.

  • window_size (convergence_window_size, int >= 1): Number of recent best values to consider (default: 50).

  • min_evaluations (convergence_min_evaluations, int): Minimum number of evaluations before checking convergence (default: window_size).

  • threshold (convergence_threshold, float): Threshold for relative improvement or std dev (default: 1e-6).

  • mode (convergence_mode, str): ‘std’ (standard deviation), ‘improv’ (relative improvement), or ‘slope’ (linear regression slope) (default: ‘std’).

  • (convergence_require_feasibility, bool): only converge on a feasible incumbent (default: False).

Events published: - converged: When convergence criteria are met.

The event carries reason (str) and stats (dict) with details.

Parameters:

@type strategy: StrategyBase

__init__(strategy, window_size=None, threshold=None, mode=None, min_evaluations=None)[source]#
Parameters:

@type strategy: StrategyBase

Methods

__init__(strategy[, window_size, threshold, ...])

check_dependencies(analyzers, heuristics)

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

on_new_results(results)

Listen to all results to detect stagnation (no improvement for many evaluations).

Attributes

eventbus

name

The module's name.

problem

results

strategy