private void accept(final EvolutionDurations durations) { final double selection = toSeconds(durations.getOffspringSelectionDuration()) + toSeconds(durations.getSurvivorsSelectionDuration()); final double alter = toSeconds(durations.getOffspringAlterDuration()) + toSeconds(durations.getOffspringFilterDuration()); _selectionDuration.accept(selection); _alterDuration.accept(alter); _evaluationDuration .accept(toSeconds(durations.getEvaluationDuration())); _evolveDuration .accept(toSeconds(durations.getEvolveDuration())); }
final Duration evolveDuration ) { return new EvolutionDurations( offspringSelectionDuration, survivorsSelectionDuration,
void update(final EvolutionResult<?, Double> result) { final String generation = Long.toString(result.getGeneration()); final String bestFitness = _format.format(result.getBestFitness()); final double age = result.getPopulation().stream() .collect(averagingLong(p -> p.getAge(result.getGeneration()))); _generationTextField.setText(generation); _bestFitnessTextField.setText(bestFitness); _populationAgeTextField.setText(_format.format(age)); _evaluationTimeTextField.setText(format( result.getDurations().getEvaluationDuration() )); }
/** * Returns a copy of this duration with the specified duration added. * <p> * This instance is immutable and unaffected by this method call. * * @param other the duration to add * @return a {@code EvolutionDurations} based on this duration with the * specified duration added * @throws NullPointerException if the {@code other} duration is {@code null} * @throws ArithmeticException if numeric overflow occurs */ public EvolutionDurations plus(final EvolutionDurations other) { requireNonNull(other); return of( _offspringSelectionDuration.plus(other._offspringSelectionDuration), _survivorsSelectionDuration.plus(other._survivorsSelectionDuration), _offspringAlterDuration.plus(other._offspringAlterDuration), _offspringFilterDuration.plus(other._offspringFilterDuration), _survivorFilterDuration.plus(other._survivorFilterDuration), _evaluationDuration.plus(other._evaluationDuration), _evolveDuration.plus(other._evolveDuration) ); }
final EvolutionDurations durations = EvolutionDurations.of( offspring.join().duration, survivors.join().duration,