This is an automated email from the ASF dual-hosted git repository. erans pushed a commit to branch feature__MATH-1563__genetic_algorithm in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit 02d4592c7bfd842c7e7669c88282cc158ea7449d Merge: 464f9dc 07deb60 Author: avbasak1 <avbas...@in.ibm.com> AuthorDate: Sat Feb 5 14:37:09 2022 +0530 Remove GUI codes in example applications. .../examples-ga-math-functions-adaptive/pom.xml | 65 ++++----- .../adaptive/ConvergenceGraphPlotter.java | 145 --------------------- .../ga/mathfunctions/adaptive/StandAlone.java | 2 - .../examples-ga-math-functions-legacy/pom.xml | 69 +++++----- .../examples-ga/examples-ga-math-functions/pom.xml | 65 ++++----- .../ga/mathfunctions/ConvergenceGraphPlotter.java | 145 --------------------- .../examples/ga/mathfunctions/StandAlone.java | 2 - .../examples-ga/examples-ga-tsp-legacy/pom.xml | 78 +++++------ .../examples-ga/examples-ga-tsp/pom.xml | 70 ++++------ .../examples/ga/tsp/ConvergenceGraphPlotter.java | 144 -------------------- .../commons/math4/examples/ga/tsp/StandAlone.java | 2 - commons-math-examples/examples-ga/pom.xml | 76 ++++++----- commons-math-examples/pom.xml | 22 ++++ commons-math-ga/pom.xml | 111 ++++++++-------- .../ga/listener/PopulationStatisticsLogger.java | 2 +- 15 files changed, 270 insertions(+), 728 deletions(-) diff --cc commons-math-examples/examples-ga/examples-ga-math-functions-adaptive/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/adaptive/ConvergenceGraphPlotter.java index fff8a80,fff8a80..0000000 deleted file mode 100644,100644 --- a/commons-math-examples/examples-ga/examples-ga-math-functions-adaptive/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/adaptive/ConvergenceGraphPlotter.java +++ /dev/null @@@ -1,145 -1,145 +1,0 @@@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one or more -- * contributor license agreements. See the NOTICE file distributed with -- * this work for additional information regarding copyright ownership. -- * The ASF licenses this file to You under the Apache License, Version 2.0 -- * (the "License"); you may not use this file except in compliance with -- * the License. You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- */ -- --package org.apache.commons.math4.examples.ga.mathfunctions.adaptive; -- --import java.awt.BorderLayout; --import java.util.List; -- --import javax.swing.JFrame; --import javax.swing.JPanel; -- --import org.apache.commons.math4.ga.internal.stats.PopulationStatisticalSummaryImpl; --import org.apache.commons.math4.ga.listener.ConvergenceListener; --import org.apache.commons.math4.ga.population.Population; --import org.apache.commons.math4.ga.stats.PopulationStatisticalSummary; --import org.jfree.chart.ChartFactory; --import org.jfree.chart.ChartPanel; --import org.jfree.chart.JFreeChart; --import org.jfree.chart.plot.PlotOrientation; --import org.jfree.chart.plot.XYPlot; --import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; --import org.jfree.data.xy.XYSeries; --import org.jfree.data.xy.XYSeriesCollection; -- --/** -- * This class represents the graph plotter during optimization. -- */ --public class ConvergenceGraphPlotter extends JFrame implements ConvergenceListener<Coordinate> { -- -- /** -- * Generated serialversionId. -- */ -- private static final long serialVersionUID = -5683904006424006584L; -- -- /** collection of 2-D series. **/ -- private final XYSeriesCollection dataset = new XYSeriesCollection(); -- -- /** -- * constructor. -- * @param plotSubject subject of plot -- * @param xAxisLabel x axis label -- * @param yAxisLabel y axis label -- */ -- public ConvergenceGraphPlotter(String plotSubject, String xAxisLabel, String yAxisLabel) { -- super(plotSubject); -- -- final JPanel chartPanel = createChartPanel(plotSubject, xAxisLabel, yAxisLabel); -- add(chartPanel, BorderLayout.CENTER); -- -- setSize(640, 480); -- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -- setLocationRelativeTo(null); -- -- setVisible(true); -- } -- -- /** -- * Adds data point to graph. -- * @param graphName name of graph -- * @param generation generation, to be plotted along x axis -- * @param value value, to be plotted along y axis -- */ -- private void addDataPoint(String graphName, int generation, double value) { -- XYSeries series = null; -- -- if (!containsGraph(graphName)) { -- series = new XYSeries(graphName); -- dataset.addSeries(series); -- } else { -- series = dataset.getSeries(graphName); -- } -- series.add(generation, value); -- -- setVisible(true); -- } -- -- /** -- * Checks if the graph with the given name already exists. -- * @param graphName name of the graph -- * @return true/false -- */ -- @SuppressWarnings("unchecked") -- private boolean containsGraph(String graphName) { -- final List<XYSeries> seriesList = dataset.getSeries(); -- if (seriesList == null || seriesList.isEmpty()) { -- return false; -- } -- for (XYSeries series : seriesList) { -- if (series.getKey().compareTo(graphName) == 0) { -- return true; -- } -- } -- return false; -- } -- -- /** -- * Creates chart panel. -- * @param chartTitle chart title -- * @param xAxisLabel x axis label -- * @param yAxisLabel y axis label -- * @return panel -- */ -- private JPanel createChartPanel(String chartTitle, String xAxisLabel, String yAxisLabel) { -- -- final boolean showLegend = true; -- final boolean createURL = false; -- final boolean createTooltip = false; -- -- final JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset, -- PlotOrientation.VERTICAL, showLegend, createTooltip, createURL); -- final XYPlot plot = chart.getXYPlot(); -- final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); -- -- plot.setRenderer(renderer); -- -- return new ChartPanel(chart); -- -- } -- -- /** -- * {@inheritDoc} -- */ -- @Override -- public void notify(int generation, Population<Coordinate> population) { -- PopulationStatisticalSummary<Coordinate> populationStatisticalSummary = -- new PopulationStatisticalSummaryImpl<>(population); -- this.addDataPoint("Average", generation, populationStatisticalSummary.getMeanFitness()); -- this.addDataPoint("Best", generation, populationStatisticalSummary.getMaxFitness()); -- } -- --} diff --cc commons-math-examples/examples-ga/examples-ga-math-functions-adaptive/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/adaptive/StandAlone.java index 0b55f20,0b55f20..1452483 --- a/commons-math-examples/examples-ga/examples-ga-math-functions-adaptive/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/adaptive/StandAlone.java +++ b/commons-math-examples/examples-ga/examples-ga-math-functions-adaptive/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/adaptive/StandAlone.java @@@ -88,8 -88,8 +88,6 @@@ public class StandAlone implements Runn final ConvergenceListenerRegistry<Coordinate> convergenceListenerRegistry = ConvergenceListenerRegistry .getInstance(); convergenceListenerRegistry.addConvergenceListener(new PopulationStatisticsLogger<Coordinate>()); -- convergenceListenerRegistry -- .addConvergenceListener(new ConvergenceGraphPlotter("Convergence Stats", "generation", "fitness")); optimizer.optimize(dimension, minCrossoverRate, maxCrossoverRate, minMutationRate, maxMutationRate, elitismRate, tournamentSize, generationsEvolvedWithUnchangedBestFitness, populationSize); diff --cc commons-math-examples/examples-ga/examples-ga-math-functions/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/ConvergenceGraphPlotter.java index a6aae42,a6aae42..0000000 deleted file mode 100644,100644 --- a/commons-math-examples/examples-ga/examples-ga-math-functions/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/ConvergenceGraphPlotter.java +++ /dev/null @@@ -1,145 -1,145 +1,0 @@@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one or more -- * contributor license agreements. See the NOTICE file distributed with -- * this work for additional information regarding copyright ownership. -- * The ASF licenses this file to You under the Apache License, Version 2.0 -- * (the "License"); you may not use this file except in compliance with -- * the License. You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- */ -- --package org.apache.commons.math4.examples.ga.mathfunctions; -- --import java.awt.BorderLayout; --import java.util.List; -- --import javax.swing.JFrame; --import javax.swing.JPanel; -- --import org.apache.commons.math4.ga.internal.stats.PopulationStatisticalSummaryImpl; --import org.apache.commons.math4.ga.listener.ConvergenceListener; --import org.apache.commons.math4.ga.population.Population; --import org.apache.commons.math4.ga.stats.PopulationStatisticalSummary; --import org.jfree.chart.ChartFactory; --import org.jfree.chart.ChartPanel; --import org.jfree.chart.JFreeChart; --import org.jfree.chart.plot.PlotOrientation; --import org.jfree.chart.plot.XYPlot; --import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; --import org.jfree.data.xy.XYSeries; --import org.jfree.data.xy.XYSeriesCollection; -- --/** -- * This class represents the graph plotter during optimization. -- */ --public class ConvergenceGraphPlotter extends JFrame implements ConvergenceListener<Coordinate> { -- -- /** -- * Generated serialversionId. -- */ -- private static final long serialVersionUID = -5683904006424006584L; -- -- /** collection of 2-D series. **/ -- private final XYSeriesCollection dataset = new XYSeriesCollection(); -- -- /** -- * constructor. -- * @param plotSubject subject of plot -- * @param xAxisLabel x axis label -- * @param yAxisLabel y axis label -- */ -- public ConvergenceGraphPlotter(String plotSubject, String xAxisLabel, String yAxisLabel) { -- super(plotSubject); -- -- final JPanel chartPanel = createChartPanel(plotSubject, xAxisLabel, yAxisLabel); -- add(chartPanel, BorderLayout.CENTER); -- -- setSize(640, 480); -- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -- setLocationRelativeTo(null); -- -- setVisible(true); -- } -- -- /** -- * Adds data point to graph. -- * @param graphName name of graph -- * @param generation generation, to be plotted along x axis -- * @param value value, to be plotted along y axis -- */ -- private void addDataPoint(String graphName, int generation, double value) { -- XYSeries series = null; -- -- if (!containsGraph(graphName)) { -- series = new XYSeries(graphName); -- dataset.addSeries(series); -- } else { -- series = dataset.getSeries(graphName); -- } -- series.add(generation, value); -- -- setVisible(true); -- } -- -- /** -- * Checks if the graph with the given name already exists. -- * @param graphName name of the graph -- * @return true/false -- */ -- @SuppressWarnings("unchecked") -- private boolean containsGraph(String graphName) { -- final List<XYSeries> seriesList = dataset.getSeries(); -- if (seriesList == null || seriesList.isEmpty()) { -- return false; -- } -- for (XYSeries series : seriesList) { -- if (series.getKey().compareTo(graphName) == 0) { -- return true; -- } -- } -- return false; -- } -- -- /** -- * Creates chart panel. -- * @param chartTitle chart title -- * @param xAxisLabel x axis label -- * @param yAxisLabel y axis label -- * @return panel -- */ -- private JPanel createChartPanel(String chartTitle, String xAxisLabel, String yAxisLabel) { -- -- final boolean showLegend = true; -- final boolean createURL = false; -- final boolean createTooltip = false; -- -- final JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset, -- PlotOrientation.VERTICAL, showLegend, createTooltip, createURL); -- final XYPlot plot = chart.getXYPlot(); -- final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); -- -- plot.setRenderer(renderer); -- -- return new ChartPanel(chart); -- -- } -- -- /** -- * {@inheritDoc} -- */ -- @Override -- public void notify(int generation, Population<Coordinate> population) { -- PopulationStatisticalSummary<Coordinate> populationStatisticalSummary = -- new PopulationStatisticalSummaryImpl<>(population); -- this.addDataPoint("Average", generation, populationStatisticalSummary.getMeanFitness()); -- this.addDataPoint("Best", generation, populationStatisticalSummary.getMaxFitness()); -- } -- --} diff --cc commons-math-examples/examples-ga/examples-ga-math-functions/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/StandAlone.java index c096ead,c096ead..46a5811 --- a/commons-math-examples/examples-ga/examples-ga-math-functions/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/StandAlone.java +++ b/commons-math-examples/examples-ga/examples-ga-math-functions/src/main/java/org/apache/commons/math4/examples/ga/mathfunctions/StandAlone.java @@@ -75,8 -75,8 +75,6 @@@ public class StandAlone implements Runn final ConvergenceListenerRegistry<Coordinate> convergenceListenerRegistry = ConvergenceListenerRegistry .getInstance(); convergenceListenerRegistry.addConvergenceListener(new PopulationStatisticsLogger<Coordinate>()); -- convergenceListenerRegistry -- .addConvergenceListener(new ConvergenceGraphPlotter("Convergence Stats", "generation", "fitness")); optimizer.optimize(dimension, crossoverRate, mutationRate, elitismRate, tournamentSize, generationsEvolvedWithUnchangedBestFitness, populationSize); diff --cc commons-math-examples/examples-ga/examples-ga-tsp/src/main/java/org/apache/commons/math4/examples/ga/tsp/ConvergenceGraphPlotter.java index 1d2c454,1d2c454..0000000 deleted file mode 100644,100644 --- a/commons-math-examples/examples-ga/examples-ga-tsp/src/main/java/org/apache/commons/math4/examples/ga/tsp/ConvergenceGraphPlotter.java +++ /dev/null @@@ -1,144 -1,144 +1,0 @@@ --/* -- * Licensed to the Apache Software Foundation (ASF) under one or more -- * contributor license agreements. See the NOTICE file distributed with -- * this work for additional information regarding copyright ownership. -- * The ASF licenses this file to You under the Apache License, Version 2.0 -- * (the "License"); you may not use this file except in compliance with -- * the License. You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- */ --package org.apache.commons.math4.examples.ga.tsp; -- --import java.awt.BorderLayout; --import java.util.List; -- --import javax.swing.JFrame; --import javax.swing.JPanel; -- --import org.apache.commons.math4.ga.internal.stats.PopulationStatisticalSummaryImpl; --import org.apache.commons.math4.ga.listener.ConvergenceListener; --import org.apache.commons.math4.ga.population.Population; --import org.apache.commons.math4.ga.stats.PopulationStatisticalSummary; --import org.jfree.chart.ChartFactory; --import org.jfree.chart.ChartPanel; --import org.jfree.chart.JFreeChart; --import org.jfree.chart.plot.PlotOrientation; --import org.jfree.chart.plot.XYPlot; --import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; --import org.jfree.data.xy.XYSeries; --import org.jfree.data.xy.XYSeriesCollection; -- --/** -- * This class represents the graph plotter during optimization. -- */ --public class ConvergenceGraphPlotter extends JFrame implements ConvergenceListener<List<City>> { -- -- /** -- * Generated serialversionId. -- */ -- private static final long serialVersionUID = -5683904006424006584L; -- -- /** collection of 2-D series. **/ -- private final XYSeriesCollection dataset = new XYSeriesCollection(); -- -- /** -- * constructor. -- * @param plotSubject subject of plot -- * @param xAxisLabel x axis label -- * @param yAxisLabel y axis label -- */ -- public ConvergenceGraphPlotter(String plotSubject, String xAxisLabel, String yAxisLabel) { -- super(plotSubject); -- -- final JPanel chartPanel = createChartPanel(plotSubject, xAxisLabel, yAxisLabel); -- add(chartPanel, BorderLayout.CENTER); -- -- setSize(640, 480); -- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -- setLocationRelativeTo(null); -- -- setVisible(true); -- } -- -- /** -- * Adds data point to graph. -- * @param graphName name of graph -- * @param generation generation, to be plotted along x axis -- * @param value value, to be plotted along y axis -- */ -- private void addDataPoint(String graphName, int generation, double value) { -- XYSeries series = null; -- -- if (!containsGraph(graphName)) { -- series = new XYSeries(graphName); -- dataset.addSeries(series); -- } else { -- series = dataset.getSeries(graphName); -- } -- series.add(generation, value); -- -- setVisible(true); -- } -- -- /** -- * Checks if the graph with the given name already exists. -- * @param graphName name of the graph -- * @return true/false -- */ -- @SuppressWarnings("unchecked") -- private boolean containsGraph(String graphName) { -- final List<XYSeries> seriesList = dataset.getSeries(); -- if (seriesList == null || seriesList.isEmpty()) { -- return false; -- } -- for (XYSeries series : seriesList) { -- if (series.getKey().compareTo(graphName) == 0) { -- return true; -- } -- } -- return false; -- } -- -- /** -- * Creates chart panel. -- * @param chartTitle chart title -- * @param xAxisLabel x axis label -- * @param yAxisLabel y axis label -- * @return panel -- */ -- private JPanel createChartPanel(String chartTitle, String xAxisLabel, String yAxisLabel) { -- -- final boolean showLegend = true; -- final boolean createURL = false; -- final boolean createTooltip = false; -- -- final JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset, -- PlotOrientation.VERTICAL, showLegend, createTooltip, createURL); -- final XYPlot plot = chart.getXYPlot(); -- final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); -- -- plot.setRenderer(renderer); -- -- return new ChartPanel(chart); -- -- } -- -- /** -- * {@inheritDoc} -- */ -- @Override -- public void notify(int generation, Population<List<City>> population) { -- PopulationStatisticalSummary<List<City>> populationStatisticalSummary = new PopulationStatisticalSummaryImpl<>( -- population); -- this.addDataPoint("Average", generation, populationStatisticalSummary.getMeanFitness()); -- this.addDataPoint("Best", generation, populationStatisticalSummary.getMaxFitness()); -- } -- --} diff --cc commons-math-examples/examples-ga/examples-ga-tsp/src/main/java/org/apache/commons/math4/examples/ga/tsp/StandAlone.java index 55b5285,55b5285..6ac48e1 --- a/commons-math-examples/examples-ga/examples-ga-tsp/src/main/java/org/apache/commons/math4/examples/ga/tsp/StandAlone.java +++ b/commons-math-examples/examples-ga/examples-ga-tsp/src/main/java/org/apache/commons/math4/examples/ga/tsp/StandAlone.java @@@ -79,8 -79,8 +79,6 @@@ public class StandAlone implements Runn final ConvergenceListenerRegistry<List<City>> convergenceListenerRegistry = ConvergenceListenerRegistry .getInstance(); convergenceListenerRegistry.addConvergenceListener(new PopulationStatisticsLogger<List<City>>()); -- convergenceListenerRegistry -- .addConvergenceListener(new ConvergenceGraphPlotter("Convergence Stats", "generation", "fitness")); optimizer.optimize(CITIES, crossoverRate, mutationRate, elitismRate, tournamentSize, generationsEvolvedWithUnchangedBestFitness, populationSize); diff --cc commons-math-examples/examples-ga/pom.xml index dc91479,4c9e189..dec86ca --- a/commons-math-examples/examples-ga/pom.xml +++ b/commons-math-examples/examples-ga/pom.xml @@@ -16,34 -16,53 +16,48 @@@ limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.commons</groupId> - <artifactId>commons-math-examples</artifactId> - <version>4.0-SNAPSHOT</version> - </parent> - <artifactId>examples-ga</artifactId> - <packaging>pom</packaging> - <name>examples-genetic-algorithm</name> - - <properties> - <!-- Workaround to avoid duplicating config files. --> - <math.parent.dir>${basedir}/../..</math.parent.dir> - </properties> - - <dependencies> - <dependency> - <groupId>info.picocli</groupId> - <artifactId>picocli</artifactId> - </dependency> - </dependencies> - <modules> - <module>examples-ga-math-functions</module> - <module>examples-ga-math-functions-adaptive</module> - <module>examples-ga-math-functions-legacy</module> - <module>examples-ga-tsp</module> - <module>examples-ga-tsp-legacy</module> - </modules> - </project> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.commons</groupId> + <artifactId>commons-math-examples</artifactId> + <version>4.0-SNAPSHOT</version> + </parent> + <artifactId>examples-ga</artifactId> + <packaging>pom</packaging> + <name>GA</name> + + <properties> + <!-- Workaround to avoid duplicating config files. --> + <math.parent.dir>${basedir}/../..</math.parent.dir> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-math4-ga</artifactId> + </dependency> + + <dependency> + <groupId>info.picocli</groupId> + <artifactId>picocli</artifactId> + </dependency> + + <dependency> - <groupId>org.jfree</groupId> - <artifactId>jfreechart</artifactId> - </dependency> - - <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + + </dependencies> + + <modules> + <module>examples-ga-math-functions</module> + <module>examples-ga-math-functions-adaptive</module> + <module>examples-ga-math-functions-legacy</module> + <module>examples-ga-tsp</module> + <module>examples-ga-tsp-legacy</module> + </modules> + + </project> diff --cc commons-math-ga/pom.xml index a2a3689,eddae3c..6669845 --- a/commons-math-ga/pom.xml +++ b/commons-math-ga/pom.xml @@@ -1,54 -1,64 +1,59 @@@ - <?xml version="1.0"?> - <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor - license agreements. See the NOTICE file distributed with this work for additional - information regarding copyright ownership. The ASF licenses this file to - You under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of - the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. --> + <?xml version="1.0" encoding="UTF-8"?> + <!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.commons</groupId> - <artifactId>commons-math-parent</artifactId> - <version>4.0-SNAPSHOT</version> - </parent> - <artifactId>commons-math-ga</artifactId> - <name>genetic algorithm</name> - - <description /> - - <properties> - <!-- The Java Module System Name --> - <commons.module.name>org.apache.commons.math4.ga</commons.module.name> - <!-- This value must reflect the current name of the base package. --> - <commons.osgi.symbolicName>org.apache.commons.math4.ga</commons.osgi.symbolicName> - <!-- OSGi --> - <commons.osgi.export>org.apache.commons.math4.ga</commons.osgi.export> - <!-- Workaround to avoid duplicating config files. --> - <math.parent.dir>${basedir}/..</math.parent.dir> - <slf4jVersion>1.7.32</slf4jVersion> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-numbers-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-rng-simple</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4jVersion}</version> - </dependency> - </dependencies> - - </project> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.commons</groupId> + <artifactId>commons-math-parent</artifactId> + <version>4.0-SNAPSHOT</version> + </parent> + <artifactId>commons-math4-ga</artifactId> + <name>Genetic Algorithms</name> + + <description>Genetic Algorithms</description> + + <properties> + <!-- The Java Module System Name --> + <commons.module.name>org.apache.commons.math4.ga</commons.module.name> + <!-- This value must reflect the current name of the base package. --> + <commons.osgi.symbolicName>org.apache.commons.math4.ga</commons.osgi.symbolicName> + <!-- OSGi --> + <commons.osgi.export>org.apache.commons.math4.ga</commons.osgi.export> + <!-- Workaround to avoid duplicating config files. --> + <math.parent.dir>${basedir}/..</math.parent.dir> + <math.slf4j.version>1.7.32</math.slf4j.version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.commons</groupId> - <artifactId>commons-numbers-core</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> + <artifactId>commons-rng-simple</artifactId> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${math.slf4j.version}</version> + </dependency> + + </dependencies> + + </project> diff --cc commons-math-ga/src/main/java/org/apache/commons/math4/ga/listener/PopulationStatisticsLogger.java index b0f7276,b0f7276..27887f3 --- a/commons-math-ga/src/main/java/org/apache/commons/math4/ga/listener/PopulationStatisticsLogger.java +++ b/commons-math-ga/src/main/java/org/apache/commons/math4/ga/listener/PopulationStatisticsLogger.java @@@ -41,7 -41,7 +41,7 @@@ public final class PopulationStatistics final PopulationStatisticalSummary<P> populationStatisticalSummary = new PopulationStatisticalSummaryImpl<>( population); LOGGER.info( -- "Population statistics for generation %d ::: Mean Fitness: %f, Max Fitness: %f, Fitness Variance: %f", ++ "Population statistics for generation {} ::: Mean Fitness: {}, Max Fitness: {}, Fitness Variance: {}", generation, populationStatisticalSummary.getMeanFitness(), populationStatisticalSummary.getMaxFitness(), populationStatisticalSummary.getFitnessVariance()); }