/**
     * @param data Statistics about the state of the current generation
     * @return final statistics of the generation of solutions
     */
    public static String populationUpdates(PopulationData<? extends String> data) {

      String time = getElapsedTime(data.getElapsedTime()); // converting the time to H:M:SS:Mil

      EvolutionStalker.output = data;

      return "Gen: "
          + data.getGenerationNumber()
          + " |"
          + "fitness: "
          + data.getBestCandidate()
          + " |"
          + "pop size"
          + data.getPopulationSize()
          + " | "
          + "Time"
          + time
          + "|"
          + "Time (Millisec)"
          + data.getElapsedTime();
    }
Exemple #2
0
 public <S> void islandPopulationUpdate(int islandIndex, final PopulationData<S> populationData) {
   islandPopulationSize.compareAndSet(-1, populationData.getPopulationSize());
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           // Only update the label if the time has advanced.  Sometimes, due to threading
           // variations, later updates have shorter elapsed times.
           if (populationData.getElapsedTime() > epochTime) {
             epochTime = populationData.getElapsedTime();
             timeLabel.setText(formatTime(elapsedTime + epochTime));
           }
         }
       });
 }