merging rev 80 of mkron branch (SimpleProblemWrapper update)
This commit is contained in:
parent
a31beb8fa1
commit
10bfb25e4b
@ -25,6 +25,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
|||||||
private int repaintMinWait = 20;
|
private int repaintMinWait = 20;
|
||||||
private int repaintCnt = 0;
|
private int repaintCnt = 0;
|
||||||
transient Plot m_plot = null;
|
transient Plot m_plot = null;
|
||||||
|
transient AbstractEAIndividual bestIndy = null;
|
||||||
String plotFunc = "plotBest";
|
String plotFunc = "plotBest";
|
||||||
transient private boolean resetTemplate = true;
|
transient private boolean resetTemplate = true;
|
||||||
|
|
||||||
@ -78,15 +79,21 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
|||||||
openPlot();
|
openPlot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void evaluatePopulationEnd(Population population) {
|
public void evaluatePopulationEnd(Population population) {
|
||||||
super.evaluatePopulationEnd(population);
|
super.evaluatePopulationEnd(population);
|
||||||
repaintCnt += population.size();
|
repaintCnt += population.size();
|
||||||
if (m_plot != null) {
|
if (m_plot != null) {
|
||||||
if (repaintCnt >= repaintMinWait) { // dont repaint always for small pops
|
if (repaintCnt >= repaintMinWait) { // dont repaint always for small pops
|
||||||
|
if ((bestIndy == null) || (population.getBestEAIndividual().isDominant(bestIndy.getFitness()))) {
|
||||||
|
// only paint improvement
|
||||||
|
bestIndy = population.getBestEAIndividual();
|
||||||
Object[] args = new Object[2];
|
Object[] args = new Object[2];
|
||||||
args[0] = m_plot;
|
args[0] = m_plot;
|
||||||
args[1] = population.getBestEAIndividual();
|
args[1] = bestIndy;
|
||||||
|
System.out.println(population.getBestEAIndividual().getStringRepresentation());
|
||||||
BeanInspector.callIfAvailable(simProb, plotFunc, args);
|
BeanInspector.callIfAvailable(simProb, plotFunc, args);
|
||||||
|
}
|
||||||
repaintCnt = 0;
|
repaintCnt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,6 +119,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initProblem() {
|
public void initProblem() {
|
||||||
|
bestIndy = null;
|
||||||
initTemplate();
|
initTemplate();
|
||||||
setSimpleProblem(getSimpleProblem()); // possibly create plot
|
setSimpleProblem(getSimpleProblem()); // possibly create plot
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user