Skip to content

OptimizationCompletedEventArgs.BestPass

property · OptimizationCompletedEventArgs · cAlgo.API Since 5.9

DesktopCLICloud

Gets the best pass by the configured criteria or custom fitness, or null if no pass completed.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

public OptimizationPass BestPass {get;}
optimizationCompletedEventArgs.BestPass: OptimizationPass

Returns OptimizationPass

Examples

protected override void OnStart()
{
    Optimization.Completed += OnOptimizationCompleted;
}

private void OnOptimizationCompleted(OptimizationCompletedEventArgs args)
{
    var bestPass = args.BestPass;
    if (bestPass == null)
        return;
    foreach (var parameter in bestPass.ParameterValues)
        Print("Best {0} = {1}", parameter.Key, parameter.Value);
}
def on_start(self):
    api.Optimization.Completed += self.on_optimization_completed

def on_optimization_completed(self, args):
    bestPass = args.BestPass
    if bestPass is None:
        return
    for parameter in bestPass.ParameterValues:
        api.Print(f"Best {parameter.Key} = {parameter.Value}")