Skip to content

OptimizationProcess.BestPass

property · OptimizationProcess · cAlgo.API Since 5.9

DesktopCLICloud

Gets the best pass by the configured criteria or custom fitness, or null if no pass has 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

OptimizationPass BestPass {get;}
optimizationProcess.BestPass: OptimizationPass

Returns OptimizationPass

Examples

Optimization.PassCompleted += args =>
{
    var bestPass = args.Process.BestPass;
    if (bestPass != null)
        Print("Current best pass: {0}, fitness {1}", bestPass.Id, bestPass.Fitness);
};
def on_start(self):
    api.Optimization.PassCompleted += self.on_pass_completed

def on_pass_completed(self, args):
    bestPass = args.Process.BestPass
    if bestPass is not None:
        api.Print(f"Current best pass: {bestPass.Id}, fitness {bestPass.Fitness}")