Commiting consolidation changes from MK branch rev. 252.

This commit is contained in:
Marcel Kronfeld 2009-03-17 18:12:37 +00:00
parent abafb57679
commit 8bb6f38c79
3 changed files with 59 additions and 5 deletions

View File

@ -131,11 +131,43 @@ public class FunctionArea extends DArea implements Serializable {
* @param graphID
*/
public void drawCircle(String label, double[] position, int graphID) {
drawIcon(new Chart2DDPointIconCircle(), label, position, graphID);
}
/**
* Plot an icon to the function area which is annotated with a char and
* a double value. The color corresponds to the color of the graph with given ID
* Icon types are 0: circle, 1: cross, otherwise: point.
*
* @param label
* @param position
* @param graphID
*/
public void drawIcon(int iconType, String label, double[] position, int graphID) {
DPointIcon theIcon;
switch (iconType) {
case 0: theIcon = new Chart2DDPointIconCircle(); break;
case 1: theIcon = new Chart2DDPointIconCross(); break;
default:
case 2: theIcon = new Chart2DDPointIconPoint(); break;
}
drawIcon(theIcon, label, position, graphID);
}
/**
* Plot a circle icon to the function area which is annotated with a char and
* a double value. The color corresponds to the color of the graph with given ID
*
* @param label
* @param position
* @param graphID
*/
public void drawIcon(DPointIcon theIcon, String label, double[] position, int graphID) {
DPointSet popRep;
popRep = new DPointSet();
popRep.addDPoint(new DPoint(position[0], position[1]));
DPointIcon icon = new Chart2DDPointIconText(label);
((Chart2DDPointIconText)icon).setIcon(new Chart2DDPointIconCircle());
((Chart2DDPointIconText)icon).setIcon(theIcon);
((Chart2DDPointIconText)icon).setColor(getGraphPointSet(graphID).getColor());
popRep.setIcon(icon);
addDElement(popRep);

View File

@ -4,12 +4,34 @@ import eva2.server.go.populations.Population;
/**
* An interface for a mutation operator which is updated on a generational basis, such as
* the 1/5-success rule.
* the 1/5-success rule. Mind that not all EA use dogmatic selection and thus not all
* will inform this interface. So far, only ES and GA will.
*
* @author mkron
*
*/
public interface InterfaceMutationGenerational extends InterfaceMutation {
public void adaptAfterSelection(Population oldGen, Population selected);
public void adaptGenerational(Population selectedPop, Population parentPop, Population newPop, boolean updateSelected);
/**
* Perform adaption of the operator based on the selection performed by an EA.
*
* @param oldPop the initial population for the developmental step
* @param selectedPop the sup-population selected as parents for the new generation
*/
public void adaptAfterSelection(Population oldPop, Population selectedPop);
/**
* Perform adaption of the operator based on the developmental step performed by an EA.
* The data provided for this call are the old population, the individuals selected as
* parents, and the new population created from the selected individuals.
* Usually, only the instances within the new population must be adapted. An additional tag
* indicates whether the instances of the selected population should be adapted as well,
* e.g., if they survive as elite (or in an ES "plus" strategy).
*
* @param oldPop the initial population for the developmental step
* @param selectedPop the sup-population selected as parents for the new generation
* @param newPop the new population created by the EA, should already be evaluated
* @param updateSelected if true, the selected population should be adapted as well
*/
public void adaptGenerational(Population oldPop, Population selectedPop, Population newPop, boolean updateSelected);
}

View File

@ -228,7 +228,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
indy = (AbstractEAIndividual)(pop.getEAIndividual(firstParentIndex)).getClone();
esIndy = (InterfaceDataTypeDouble)indy;
} catch (java.lang.ClassCastException e) {
System.err.println("Differential Evolution currently requires InterfaceESIndividual as basic data type!");
EVAERROR.errorMsgOnce("Differential Evolution currently requires InterfaceESIndividual as basic data type!");
return (AbstractEAIndividual)((AbstractEAIndividual)pop.get(RNG.randomInt(0, pop.size()-1))).getClone();
}
double[] nX, vX, oX;