Interface ICostConverger

All Known Implementing Classes:
AbstractCostConverger, JoinedCostConverger, JoinedCostConvergerWithFinalAutoFilterStep

public interface ICostConverger
This interface of the converger allows to set an iteration treshold after which the Optimisation is stopped if the cost does not change. The converger can be customized to stop the Optimisation if the distance or time do not change even tough the cost is still fluctuating.

Implementation example:


 // Create external CostConverger
 ICostConverger myJoinedCostConverger = new JoinedCostConverger(this);
 myJoinedCostConverger.addExecutionAlgorithm(GeneticEvolutionAlgo.MY_TITLE);
 myJoinedCostConverger.setConvergenceThreshold(5);

 CompletableFuture<IOptimizationResult> resultFuture = this.startRunAsync();

 // It is important to block the call, otherwise optimization will be terminated
 try {
   resultFuture.get();
 } catch (InterruptedException | ExecutionException e) {
   e.printStackTrace();
 }
 
Since:
03/08/2019
Version:
13/09/2019
Author:
DNA
  • Method Details

    • setConvergenceThreshold

      void setConvergenceThreshold(int numProgressSteps)
      Sets the convergence threshold X. If the convergence cost did not change for X iterations in % the converger stops the optimizations.
      Parameters:
      numProgressSteps - the new convergence threshold
    • addExecutionAlgorithm

      void addExecutionAlgorithm(String exectutionAlgo)
      Defines where the Optimization can be stopped by the Converger. For implementation example please see ICostConverger.

      Possible values are "GeneticEvolution" and "SimulatedAnnealing".

      Parameters:
      exectutionAlgo - the string of the algorithm in which the optimization can be stopped safely
    • getConvergenceCost

      double getConvergenceCost(IOptimizationProgress curP)
    • onDone

      void onDone(IOptimization opti)
    • onConverged

      CompletableFuture<Void> onConverged(IOptimization opti)
    • setOnConvergedTimeOut

      void setOnConvergedTimeOut(long onConvergedtimeout, TimeUnit onConvergedTimeUnit)