public interface ICostConverger
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();
}
Modifier and Type | Method and Description |
---|---|
void |
addExecutionAlgorithm(String exectutionAlgo)
Defines where the
Optimization can be stopped by the Converger . |
double |
getConvergenceCost(IOptimizationProgress curP) |
CompletableFuture<Void> |
onConverged(IOptimization opti) |
void |
onDone(IOptimization opti) |
void |
setConvergenceThreshold(int numProgressSteps)
Sets the convergence threshold X.
|
void |
setOnConvergedTimeOut(long onConvergedtimeout,
TimeUnit onConvergedTimeUnit) |
void setConvergenceThreshold(int numProgressSteps)
numProgressSteps
- the new convergence thresholdvoid addExecutionAlgorithm(String exectutionAlgo)
Optimization
can be stopped by the Converger
. For
implementation example please see ICostConverger
.
Possible values are "GeneticEvolution"
and "SimulatedAnnealing"
.
exectutionAlgo
- the string of the algorithm in which the optimization can be stopped
safelydouble getConvergenceCost(IOptimizationProgress curP)
void onDone(IOptimization opti)
CompletableFuture<Void> onConverged(IOptimization opti)
void setOnConvergedTimeOut(long onConvergedtimeout, TimeUnit onConvergedTimeUnit)
Copyright © 2017–2023 DNA Evolutions GmbH. All rights reserved.