Code cleanup through static analysis.
This commit is contained in:
parent
453df310ee
commit
7756ceac4e
@ -102,7 +102,7 @@ public class OptimizerFactory {
|
||||
DifferentialEvolution de = new DifferentialEvolution();
|
||||
de.setProblem(problem);
|
||||
de.getPopulation().setTargetSize(popsize);
|
||||
de.setDEType(DEType.DE2_CurrentToBest);
|
||||
de.setDEType(DEType.CurrentToBest);
|
||||
de.setDifferentialWeight(f);
|
||||
de.setCrossoverRate(CR);
|
||||
de.setLambda(lambda);
|
||||
@ -1443,7 +1443,7 @@ public class OptimizerFactory {
|
||||
public static OptimizationParameters standardDE(
|
||||
AbstractOptimizationProblem problem) {
|
||||
DifferentialEvolution de = new DifferentialEvolution();
|
||||
de.setDEType(DEType.DE2_CurrentToBest); // this sets current-to-best
|
||||
de.setDEType(DEType.CurrentToBest); // this sets current-to-best
|
||||
de.setDifferentialWeight(0.8);
|
||||
de.setCrossoverRate(0.6);
|
||||
de.setLambda(0.6);
|
||||
|
@ -264,7 +264,7 @@ public class OptimizerRunnable implements Runnable {
|
||||
* @param outp
|
||||
*/
|
||||
public void setOutputTo(InterfaceStatisticsParameters.OutputTo outp) {
|
||||
((StatisticsParameters) proc.getStatistics().getStatisticsParameter()).setOutputTo(outp);
|
||||
proc.getStatistics().getStatisticsParameter().setOutputTo(outp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ public final class OptimizationBuilder {
|
||||
// Is the next a value?
|
||||
if (i < args.length - 1 && !args[i+1].startsWith("--")) {
|
||||
argumentMap.put(key, args[i + 1]);
|
||||
i = i + 2;
|
||||
i += 2;
|
||||
} else {
|
||||
argumentMap.put(key, null);
|
||||
i++;
|
||||
|
@ -386,7 +386,7 @@ public class BeanInspector {
|
||||
Object value = getter.invoke(obj, args);
|
||||
System.out.println("Inspecting name = " + name);
|
||||
if (value instanceof Integer) {
|
||||
Object args2[] = {new Integer(999)};
|
||||
Object args2[] = {999};
|
||||
setter.invoke(obj, args2);
|
||||
}
|
||||
showInfo(value);
|
||||
|
@ -44,13 +44,13 @@ public class ExtDesktopManager extends DefaultDesktopManager {
|
||||
public void closeFrame(JInternalFrame internalFrame) {
|
||||
LOGGER.log(Level.FINE, "Closing Internal Frame: {0}", internalFrame.getTitle());
|
||||
super.closeFrame(internalFrame);
|
||||
int index = ((Integer) internalFrame.getClientProperty(INDEX)).intValue() + WINDOW_LIST_START - 1;
|
||||
int index = (Integer) internalFrame.getClientProperty(INDEX) + WINDOW_LIST_START - 1;
|
||||
int i;
|
||||
desktop.getWindowMenu().remove(index);
|
||||
for (i = index; i < Math.min(WINDOW_LIST_START + 9, desktop.getWindowMenu().getItemCount()); i++) {
|
||||
JMenuItem m = desktop.getWindowMenu().getItem(i);
|
||||
JInternalFrame frame = (JInternalFrame) m.getClientProperty(FRAME);
|
||||
frame.putClientProperty(INDEX, new Integer(((Integer) frame.getClientProperty(INDEX)).intValue() - 1));
|
||||
frame.putClientProperty(INDEX, ((Integer) frame.getClientProperty(INDEX)).intValue() - 1);
|
||||
int winIndex = i - WINDOW_LIST_START + 1;
|
||||
m.setText((winIndex) + " " + frame.getTitle());
|
||||
m.setMnemonic((char) (0x30 + winIndex));
|
||||
|
@ -76,21 +76,28 @@ public class JExtMenu extends JMenu {
|
||||
return;
|
||||
}
|
||||
String propertyName = e.getPropertyName();
|
||||
if (propertyName.equals(Action.NAME)) {
|
||||
menuItem.setText((String) e.getNewValue());
|
||||
} else if (propertyName.equals("enabled")) {
|
||||
menuItem.setEnabled(((Boolean) e.getNewValue()).booleanValue());
|
||||
} else if (propertyName.equals(Action.SMALL_ICON)) {
|
||||
Icon icon = (Icon) e.getNewValue();
|
||||
menuItem.setIcon(icon);
|
||||
menuItem.invalidate();
|
||||
menuItem.repaint();
|
||||
} else if (propertyName.equals(ExtAction.MNEMONIC)) {
|
||||
menuItem.setMnemonic(((Character) e.getNewValue()).charValue());
|
||||
} else if (propertyName.equals(ExtAction.TOOLTIP)) {
|
||||
menuItem.setToolTipText((String) e.getNewValue());
|
||||
} else if (propertyName.equals(ExtAction.KEYSTROKE)) {
|
||||
menuItem.setAccelerator((KeyStroke) e.getNewValue());
|
||||
switch (propertyName) {
|
||||
case Action.NAME:
|
||||
menuItem.setText((String) e.getNewValue());
|
||||
break;
|
||||
case "enabled":
|
||||
menuItem.setEnabled(((Boolean) e.getNewValue()).booleanValue());
|
||||
break;
|
||||
case Action.SMALL_ICON:
|
||||
Icon icon = (Icon) e.getNewValue();
|
||||
menuItem.setIcon(icon);
|
||||
menuItem.invalidate();
|
||||
menuItem.repaint();
|
||||
break;
|
||||
case ExtAction.MNEMONIC:
|
||||
menuItem.setMnemonic(((Character) e.getNewValue()).charValue());
|
||||
break;
|
||||
case ExtAction.TOOLTIP:
|
||||
menuItem.setToolTipText((String) e.getNewValue());
|
||||
break;
|
||||
case ExtAction.KEYSTROKE:
|
||||
menuItem.setAccelerator((KeyStroke) e.getNewValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -165,7 +165,7 @@ public class JTextEditorInternalFrame extends JDocFrame {
|
||||
}
|
||||
a.putValue(Action.SMALL_ICON, new ImageIcon("images/EditCut.gif"));
|
||||
a.putValue(ExtAction.CAPTION, "Ausschneiden");
|
||||
a.putValue(ExtAction.MNEMONIC, new Character('a'));
|
||||
a.putValue(ExtAction.MNEMONIC, 'a');
|
||||
a.putValue(ExtAction.TOOLTIP, "Schneidet den markierten Text aus und setzt ihn in die Zwischenablage");
|
||||
mnuEdit.add(a);
|
||||
barEdit.add(a);
|
||||
@ -177,7 +177,7 @@ public class JTextEditorInternalFrame extends JDocFrame {
|
||||
}
|
||||
a.putValue(Action.SMALL_ICON, new ImageIcon("images/EditCopy.gif"));
|
||||
a.putValue(ExtAction.CAPTION, "Kopieren");
|
||||
a.putValue(ExtAction.MNEMONIC, new Character('k'));
|
||||
a.putValue(ExtAction.MNEMONIC, 'k');
|
||||
a.putValue(ExtAction.TOOLTIP, "Kopiert den markierten Text in die Zwischenablage");
|
||||
mnuEdit.add(a);
|
||||
barEdit.add(a);
|
||||
@ -189,7 +189,7 @@ public class JTextEditorInternalFrame extends JDocFrame {
|
||||
}
|
||||
a.putValue(Action.SMALL_ICON, new ImageIcon("images/EditPaste.gif"));
|
||||
a.putValue(ExtAction.CAPTION, "Einf<EFBFBD>gen");
|
||||
a.putValue(ExtAction.MNEMONIC, new Character('e'));
|
||||
a.putValue(ExtAction.MNEMONIC, 'e');
|
||||
a.putValue(ExtAction.TOOLTIP, "F<EFBFBD>gt Text aus der Zwischenablage ein");
|
||||
mnuEdit.add(a);
|
||||
barEdit.add(a);
|
||||
@ -202,7 +202,7 @@ public class JTextEditorInternalFrame extends JDocFrame {
|
||||
a.putValue(ExtAction.KEYSTROKE, keyActions[0]);
|
||||
}
|
||||
a.putValue(ExtAction.CAPTION, "Alles markieren");
|
||||
a.putValue(ExtAction.MNEMONIC, new Character('m'));
|
||||
a.putValue(ExtAction.MNEMONIC, 'm');
|
||||
a.putValue(ExtAction.TOOLTIP, "Markiert das ganze Dokument");
|
||||
mnuEdit.add(a);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import eva2.util.annotation.Hidden;
|
||||
import eva2.util.annotation.Parameter;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.InsetsUIResource;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
@ -32,7 +32,7 @@ class PropertySlider extends JPanel {
|
||||
//s.getAccessibleContext().setAccessibleName(getString("SliderDemo.plain"));
|
||||
//s.getAccessibleContext().setAccessibleDescription(getString("SliderDemo.a_plain_slider"));
|
||||
slider.addChangeListener(new SliderListener());
|
||||
slider.setValue(((Integer) propertyEditor.getValue()).intValue());
|
||||
slider.setValue((Integer) propertyEditor.getValue());
|
||||
slider.setPaintTicks(true);
|
||||
slider.setMajorTickSpacing(20);
|
||||
slider.setMinorTickSpacing(5);
|
||||
@ -68,7 +68,7 @@ class PropertySlider extends JPanel {
|
||||
protected void updateUs() {
|
||||
try {
|
||||
//String x = editor.getAsText();
|
||||
slider.setValue(((Integer) propertyEditor.getValue()).intValue());
|
||||
slider.setValue((Integer) propertyEditor.getValue());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ class PropertySlider extends JPanel {
|
||||
*/
|
||||
protected void updateEditor() {
|
||||
try {
|
||||
propertyEditor.setValue(new Integer(slider.getValue()));
|
||||
propertyEditor.setValue(slider.getValue());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class GenericAreaEditor extends AbstractListSelectionEditor {
|
||||
|
||||
@Override
|
||||
protected boolean isElementSelected(int i) {
|
||||
return areaObject.getBlackList().get(i).booleanValue();
|
||||
return areaObject.getBlackList().get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ public class GraphPointSetLegend {
|
||||
int comp = o1.car().compareTo(o2.car());
|
||||
// Same text; let us see if the color is also identical.
|
||||
return comp == 0 ? comp = Integer.valueOf(o1.cdr().getRGB())
|
||||
.compareTo(Integer.valueOf(o2.cdr().getRGB())) : comp;
|
||||
.compareTo(o2.cdr().getRGB()) : comp;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,52 +1,25 @@
|
||||
package eva2.optimization.enums;
|
||||
|
||||
public enum DEType {
|
||||
DE1_Rand_1, DE2_CurrentToBest, DE_Best_1, DE_Best_2, TrigonometricDE, DE_CurrentToRand;
|
||||
//", "DE2 - DE/current-to-best/1", "DE/best/2", "Trigonometric DE"};
|
||||
RandOne, CurrentToBest, BestOne, BestTwo, Trigonometric, CurrentToRand;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch(this) {
|
||||
case DE1_Rand_1:
|
||||
case RandOne:
|
||||
return "DE/rand/1";
|
||||
case DE2_CurrentToBest:
|
||||
case CurrentToBest:
|
||||
return "DE/current-to-best/1";
|
||||
case DE_Best_1:
|
||||
case BestOne:
|
||||
return "DE/best/1";
|
||||
case DE_Best_2:
|
||||
case BestTwo:
|
||||
return "DE/best/2";
|
||||
case TrigonometricDE:
|
||||
case Trigonometric:
|
||||
return this.name();
|
||||
case DE_CurrentToRand:
|
||||
case CurrentToRand:
|
||||
return "DE/current-to-rand";
|
||||
default:
|
||||
return this.name();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to translate the "old" integer tags into the enum type.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static DEType getFromId(int id) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
return DE1_Rand_1;
|
||||
case 1:
|
||||
return DE2_CurrentToBest;
|
||||
case 2:
|
||||
return DE_Best_1;
|
||||
case 3:
|
||||
return DE_Best_2;
|
||||
case 4:
|
||||
return TrigonometricDE;
|
||||
case 5:
|
||||
return DE_CurrentToRand;
|
||||
default:
|
||||
System.err.println("Error: invalid old DEType ID in DEType getFromId! Using DE_Best_1.");
|
||||
return DE_Best_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -476,8 +476,8 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
|
||||
singleRun = (ArrayList) multiRuns.get(j);
|
||||
for (int p = 0; p < data.length; p++) {
|
||||
tmpD = (Double[]) singleRun.get(p);
|
||||
data[p][0] = tmpD[0].doubleValue();
|
||||
data[p][1] += tmpD[1].doubleValue() / multiRuns.size();
|
||||
data[p][0] = tmpD[0];
|
||||
data[p][1] += tmpD[1] / multiRuns.size();
|
||||
}
|
||||
}
|
||||
// Second run to determine variance
|
||||
@ -485,7 +485,7 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
|
||||
singleRun = (ArrayList) multiRuns.get(j);
|
||||
for (int p = 0; p < data.length; p++) {
|
||||
tmpD = (Double[]) singleRun.get(p);
|
||||
data[p][2] += Math.pow(data[p][1] - tmpD[1].doubleValue(), 2) / multiRuns.size();
|
||||
data[p][2] += Math.pow(data[p][1] - tmpD[1], 2) / multiRuns.size();
|
||||
}
|
||||
}
|
||||
// Now enter this stuff into the graph
|
||||
@ -564,7 +564,7 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
|
||||
tmpLine.append(population.getBestEAIndividual().getFitness(0));
|
||||
tmpLine.append("\t");
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
tmpd += ((AbstractEAIndividual) population.get(i)).getFitness(0) / (double) population.size();
|
||||
tmpd += population.get(i).getFitness(0) / (double) population.size();
|
||||
}
|
||||
tmpLine.append("\t");
|
||||
tmpLine.append(tmpd);
|
||||
@ -575,12 +575,12 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
|
||||
this.writeToFile(tmpLine.toString());
|
||||
|
||||
Double[] tmpData = new Double[2];
|
||||
tmpData[0] = new Double(population.getFunctionCalls());
|
||||
tmpData[0] = (double) population.getFunctionCalls();
|
||||
// instead of adding simply the best fitness value i'll ask the problem what to show
|
||||
tmpData[1] = this.optimizationParameters.getProblem().getDoublePlotValue(population);
|
||||
if (this.plot != null) {
|
||||
if (this.continueFlag) {
|
||||
this.plot.setConnectedPoint(tmpData[0].doubleValue() + this.recentFunctionCalls, tmpData[1].doubleValue(), 1000 + this.currentRun);
|
||||
this.plot.setConnectedPoint(tmpData[0] + this.recentFunctionCalls, tmpData[1].doubleValue(), 1000 + this.currentRun);
|
||||
} else {
|
||||
this.plot.setConnectedPoint(tmpData[0].doubleValue(), tmpData[1].doubleValue(), 1000 + this.currentRun);
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) this.clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (logParents) {
|
||||
result[0].setParent(this);
|
||||
|
@ -123,7 +123,7 @@ public abstract class AbstractGPNode implements InterfaceProgram, java.io.Serial
|
||||
// try to read constant
|
||||
Pair<Double, String> nextState = readDouble(str, true);
|
||||
if (nextState != null) {
|
||||
return new Pair<AbstractGPNode, String>(new GPNodeConst(nextState.head().doubleValue()), nextState.tail());
|
||||
return new Pair<AbstractGPNode, String>(new GPNodeConst(nextState.head()), nextState.tail());
|
||||
} else {
|
||||
System.err.println("String has unknown prefix: " + str);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class GPArea implements java.io.Serializable {
|
||||
*/
|
||||
public void add2CompleteList(AbstractGPNode n, boolean b) {
|
||||
this.completeList.add(n);
|
||||
this.blackList.add(Boolean.valueOf(b));
|
||||
this.blackList.add(b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ public class GPArea implements java.io.Serializable {
|
||||
* @param b the boolean value
|
||||
*/
|
||||
public void setBlackListElement(int i, boolean b) {
|
||||
this.blackList.set(i, Boolean.valueOf(b));
|
||||
this.blackList.set(i, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,7 +126,7 @@ public class GPArea implements java.io.Serializable {
|
||||
public void compileReducedList() {
|
||||
this.reducedList = new ArrayList<>();
|
||||
for (int i = 0; i < this.completeList.size(); i++) {
|
||||
if (this.blackList.get(i).booleanValue()) {
|
||||
if (this.blackList.get(i)) {
|
||||
this.reducedList.add(this.completeList.get(i));
|
||||
}
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result += ((Double) tmpObj).doubleValue();
|
||||
result += (Double) tmpObj;
|
||||
}
|
||||
Double ret = new Double(result);
|
||||
Double ret = result;
|
||||
|
||||
if (ret < 0) {
|
||||
return -ret;
|
||||
|
@ -57,7 +57,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable
|
||||
*/
|
||||
@Override
|
||||
public Object evaluate(InterfaceProgramProblem environment) {
|
||||
return new Double(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,9 +56,9 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = Math.sin(((Double) tmpObj).doubleValue());
|
||||
result = Math.sin((Double) tmpObj);
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,12 +64,12 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = ((Double) tmpObj).doubleValue();
|
||||
result = (Double) tmpObj;
|
||||
}
|
||||
for (int i = 1; i < this.nodes.length; i++) {
|
||||
tmpObj = this.nodes[i].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
tmpValue = ((Double) tmpObj).doubleValue();
|
||||
tmpValue = (Double) tmpObj;
|
||||
}
|
||||
if (Math.abs(tmpValue) < this.lowerBorderForSec) {
|
||||
if (tmpValue < 0) {
|
||||
@ -80,7 +80,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
|
||||
}
|
||||
result /= tmpValue;
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,9 +56,9 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = Math.exp(((Double) tmpObj).doubleValue());
|
||||
result = Math.exp((Double) tmpObj);
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +96,7 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable
|
||||
return this.identifier;
|
||||
} else {
|
||||
if (this.lastValue instanceof Double) {
|
||||
double tmpD = ((Double) this.lastValue).doubleValue();
|
||||
double tmpD = (Double) this.lastValue;
|
||||
tmpD = ((long) (tmpD * 10000.0 + ((tmpD >= 0.0) ? 0.5 : -0.5))) / 10000.0;
|
||||
return ("S:" + this.identifier + " = " + tmpD);
|
||||
} else {
|
||||
|
@ -58,12 +58,12 @@ public class GPNodeMult extends AbstractGPNode implements java.io.Serializable {
|
||||
for (int i = 0; i < this.nodes.length; i++) {
|
||||
tmpObj = this.nodes[i].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result *= ((Double) tmpObj).doubleValue();
|
||||
result *= (Double) tmpObj;
|
||||
} else {
|
||||
System.err.println("Unexpected type returned in evaluate for " + this.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,15 +57,15 @@ public class GPNodeNeg extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result += ((Double) tmpObj).doubleValue();
|
||||
result += (Double) tmpObj;
|
||||
}
|
||||
for (int i = 1; i < this.nodes.length; i++) {
|
||||
tmpObj = this.nodes[i].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result -= ((Double) tmpObj).doubleValue();
|
||||
result -= (Double) tmpObj;
|
||||
}
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,9 +56,9 @@ public class GPNodePow2 extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = Math.pow(((Double) tmpObj).doubleValue(), 2);
|
||||
result = Math.pow((Double) tmpObj, 2);
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,9 +56,9 @@ public class GPNodePow3 extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = Math.pow(((Double) tmpObj).doubleValue(), 3);
|
||||
result = Math.pow((Double) tmpObj, 3);
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class GPNodeProd extends AbstractGPNode implements java.io.Serializable {
|
||||
result = (Double) tmpObj;
|
||||
}
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,9 +56,9 @@ public class GPNodeSin extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = Math.sin(((Double) tmpObj).doubleValue());
|
||||
result = Math.sin((Double) tmpObj);
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,9 +57,9 @@ public class GPNodeSqrt extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result = Math.sqrt(Math.abs(((Double) tmpObj).doubleValue()));
|
||||
result = Math.sqrt(Math.abs((Double) tmpObj));
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,15 +57,15 @@ public class GPNodeSub extends AbstractGPNode implements java.io.Serializable {
|
||||
|
||||
tmpObj = this.nodes[0].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result += ((Double) tmpObj).doubleValue();
|
||||
result += (Double) tmpObj;
|
||||
}
|
||||
for (int i = 1; i < this.nodes.length; i++) {
|
||||
tmpObj = this.nodes[i].evaluate(environment);
|
||||
if (tmpObj instanceof Double) {
|
||||
result -= ((Double) tmpObj).doubleValue();
|
||||
result -= (Double) tmpObj;
|
||||
}
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,7 +69,7 @@ public class GPNodeSum extends AbstractGPNode implements java.io.Serializable {
|
||||
result = (Double) tmpObj;
|
||||
}
|
||||
}
|
||||
return new Double(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,7 +100,7 @@ public class MOCCOChooseReferenceSolution extends MOCCOPhase implements Interfac
|
||||
gbc.gridx = 2;
|
||||
gbc.gridy = i + 1;
|
||||
gbc.weightx = 1;
|
||||
textA = new JTextField("" + ((Double) referenceSolution.getData(obj[i].getIdentName())).doubleValue());
|
||||
textA = new JTextField("" + (Double) referenceSolution.getData(obj[i].getIdentName()));
|
||||
textA.setEditable(false);
|
||||
tmpP.add(textA, gbc);
|
||||
|
||||
@ -145,7 +145,7 @@ public class MOCCOChooseReferenceSolution extends MOCCOPhase implements Interfac
|
||||
public void individualSelected(AbstractEAIndividual indy) {
|
||||
Population pop = this.mocco.state.paretoFront.getMarkedIndividuals();
|
||||
if (pop.size() == 1) {
|
||||
this.referenceSolution = (AbstractEAIndividual) pop.get(0);
|
||||
this.referenceSolution = pop.get(0);
|
||||
} else {
|
||||
this.referenceSolution = null;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ public class MOCCOParameterizeGDF extends MOCCOPhase implements InterfaceProcess
|
||||
System.out.println("d.length = " + d.length);
|
||||
for (int i = 0; i < obj.length; i++) {
|
||||
if (obj[i].getOptimizationMode().contains("Objective")) {
|
||||
tmpA.add(new Double(d[i]));
|
||||
tmpA.add(d[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces
|
||||
}
|
||||
gbc.gridx = 2;
|
||||
gbc.gridy = i + 1;
|
||||
this.refSolTextField[i] = new JTextField("" + ((Double) refSolution.getData(obj[i].getIdentName())).doubleValue());
|
||||
this.refSolTextField[i] = new JTextField("" + (Double) refSolution.getData(obj[i].getIdentName()));
|
||||
this.refSolTextField[i].setEditable(false);
|
||||
panelSTEP.add(this.refSolTextField[i], gbc);
|
||||
gbc.gridx = 3;
|
||||
@ -269,10 +269,10 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces
|
||||
weights[i] = 0;
|
||||
if (obj[i].is2BMinimized()) {
|
||||
// check this sounds wierd => sounds correct if objectives are used above stupid!
|
||||
relax[i] = ((Double) refSolution.getData(obj[i].getIdentName())).doubleValue()
|
||||
relax[i] = (Double) refSolution.getData(obj[i].getIdentName())
|
||||
+ Math.abs(relax[i]);
|
||||
} else {
|
||||
relax[i] = ((Double) refSolution.getData(obj[i].getIdentName())).doubleValue()
|
||||
relax[i] = (Double) refSolution.getData(obj[i].getIdentName())
|
||||
- Math.abs(relax[i]);
|
||||
}
|
||||
obj[i].SetConstraintGoal(relax[i]);
|
||||
@ -330,7 +330,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces
|
||||
System.out.println("d.length = " + d.length);
|
||||
for (int i = 0; i < obj.length; i++) {
|
||||
if (obj[i].getOptimizationMode().contains("Objective")) {
|
||||
tmpA.add(new Double(d[i]));
|
||||
tmpA.add(d[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.mocco;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.operator.archiving.ArchivingAllDominating;
|
||||
import eva2.optimization.operator.terminators.EvaluationTerminator;
|
||||
import eva2.optimization.operator.terminators.InterfaceTerminator;
|
||||
@ -106,12 +105,12 @@ public class MOCCOState {
|
||||
if (tmpObj != null) {
|
||||
double[] tmoF = new double[tmpObj.length];
|
||||
for (int k = 0; k < tmpObj.length; k++) {
|
||||
tmoF[k] = ((Double) ((AbstractEAIndividual) newPop[newPop.length - 1].get(j)).getData(tmpObj[k].getIdentName())).doubleValue();
|
||||
tmoF[k] = (Double) newPop[newPop.length - 1].get(j).getData(tmpObj[k].getIdentName());
|
||||
}
|
||||
objectives.add(tmoF);
|
||||
}
|
||||
fitness.add(((AbstractEAIndividual) newPop[newPop.length - 1].get(j)).getFitness());
|
||||
constraint.add(new Double(((AbstractEAIndividual) newPop[newPop.length - 1].get(j)).getConstraintViolation()));
|
||||
fitness.add(newPop[newPop.length - 1].get(j).getFitness());
|
||||
constraint.add(newPop[newPop.length - 1].get(j).getConstraintViolation());
|
||||
}
|
||||
if (this.objectiveCache != null) {
|
||||
this.objectiveCache.add(objectives);
|
||||
@ -218,15 +217,15 @@ public class MOCCOState {
|
||||
if (tmpObj[k] == null) {
|
||||
System.out.println("Objective " + k + " == null!");
|
||||
}
|
||||
if (((AbstractEAIndividual) this.populationHistory[i].get(j)).getData(tmpObj[k].getIdentName()) == null) {
|
||||
if (this.populationHistory[i].get(j).getData(tmpObj[k].getIdentName()) == null) {
|
||||
System.out.println("User Data " + k + " " + tmpObj[k].getIdentName() + " == null!");
|
||||
}
|
||||
tmoF[k] = ((Double) ((AbstractEAIndividual) this.populationHistory[i].get(j)).getData(tmpObj[k].getIdentName())).doubleValue();
|
||||
tmoF[k] = (Double) this.populationHistory[i].get(j).getData(tmpObj[k].getIdentName());
|
||||
}
|
||||
objectives.add(tmoF);
|
||||
}
|
||||
fitness.add(((AbstractEAIndividual) this.populationHistory[i].get(j)).getFitness());
|
||||
constraint.add(new Double(((AbstractEAIndividual) this.populationHistory[i].get(j)).getConstraintViolation()));
|
||||
fitness.add(this.populationHistory[i].get(j).getFitness());
|
||||
constraint.add(this.populationHistory[i].get(j).getConstraintViolation());
|
||||
}
|
||||
if (this.objectiveCache != null) {
|
||||
this.objectiveCache.add(objectives);
|
||||
|
@ -156,10 +156,10 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener,
|
||||
} catch (java.io.IOException e) {
|
||||
}
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (!((AbstractEAIndividual) pop.get(i)).violatesConstraint()) {
|
||||
if (!pop.get(i).violatesConstraint()) {
|
||||
// write
|
||||
tmp = "";
|
||||
double[] fit = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
double[] fit = pop.get(i).getFitness();
|
||||
for (int j = 0; j < fit.length; j++) {
|
||||
tmp += fit[j] + "\t";
|
||||
}
|
||||
@ -195,10 +195,10 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener,
|
||||
} catch (java.io.IOException e) {
|
||||
}
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (!((AbstractEAIndividual) pop.get(i)).violatesConstraint()) {
|
||||
if (!pop.get(i).violatesConstraint()) {
|
||||
// write
|
||||
tmp = "";
|
||||
double[] fit = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
double[] fit = pop.get(i).getFitness();
|
||||
for (int j = 0; j < fit.length; j++) {
|
||||
tmp += fit[j] + "\t";
|
||||
}
|
||||
@ -234,10 +234,10 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener,
|
||||
} catch (java.io.IOException e) {
|
||||
}
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (((AbstractEAIndividual) pop.get(i)).violatesConstraint()) {
|
||||
if (pop.get(i).violatesConstraint()) {
|
||||
// write
|
||||
tmp = "";
|
||||
double[] fit = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
double[] fit = pop.get(i).getFitness();
|
||||
for (int j = 0; j < fit.length; j++) {
|
||||
tmp += fit[j] + "\t";
|
||||
}
|
||||
@ -272,7 +272,7 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener,
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
// write
|
||||
tmp = "";
|
||||
double[] fit = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
double[] fit = pop.get(i).getFitness();
|
||||
for (int j = 0; j < fit.length; j++) {
|
||||
tmp += fit[j] + "\t";
|
||||
}
|
||||
@ -490,7 +490,7 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener,
|
||||
public void setRefPointSelectable(boolean t) {
|
||||
this.refPointSelectable = t;
|
||||
if (this.refPointSelectable) {
|
||||
int dim = ((AbstractEAIndividual) this.moccoStandalone.state.paretoFront.get(0)).getFitness().length;
|
||||
int dim = this.moccoStandalone.state.paretoFront.get(0).getFitness().length;
|
||||
this.referencePoint = new double[dim];
|
||||
for (int i = 0; i < dim; i++) {
|
||||
this.referencePoint[i] = 0;
|
||||
|
@ -3,7 +3,6 @@ package eva2.optimization.mocco.paretofrontviewer;
|
||||
import eva2.gui.plot.FunctionArea;
|
||||
import eva2.gui.plot.GraphPointSet;
|
||||
import eva2.gui.plot.InterfaceDPointWithContent;
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.problems.InterfaceMultiObjectiveDeNovoProblem;
|
||||
import eva2.problems.InterfaceOptimizationObjective;
|
||||
@ -200,7 +199,7 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie
|
||||
for (int j = 0; j < ((ArrayList) this.moccoViewer.moccoStandalone.state.fitnessCache.get(i)).size(); j++) {
|
||||
fitness = (double[]) ((ArrayList) this.moccoViewer.moccoStandalone.state.fitnessCache.get(i)).get(j);
|
||||
myPoint = new DPoint(fitness[indexX], fitness[indexY]);
|
||||
if (((Double) ((ArrayList) this.moccoViewer.moccoStandalone.state.constraintCache.get(i)).get(j)).doubleValue() == 0) {
|
||||
if ((Double) ((ArrayList) this.moccoViewer.moccoStandalone.state.constraintCache.get(i)).get(j) == 0) {
|
||||
myPoint.setIcon(new Chart2DDPointIconCross());
|
||||
} else {
|
||||
myPoint.setIcon(new Chart2DDPointIconPoint());
|
||||
@ -223,7 +222,7 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie
|
||||
for (int j = 0; j < ((ArrayList) this.moccoViewer.moccoStandalone.state.objectiveCache.get(i)).size(); j++) {
|
||||
fitness = (double[]) ((ArrayList) this.moccoViewer.moccoStandalone.state.objectiveCache.get(i)).get(j);
|
||||
myPoint = new DPoint(fitness[indexX], fitness[indexY]);
|
||||
if (((Double) ((ArrayList) this.moccoViewer.moccoStandalone.state.constraintCache.get(i)).get(j)).doubleValue() == 0) {
|
||||
if ((Double) ((ArrayList) this.moccoViewer.moccoStandalone.state.constraintCache.get(i)).get(j) == 0) {
|
||||
myPoint.setIcon(new Chart2DDPointIconCross());
|
||||
} else {
|
||||
myPoint.setIcon(new Chart2DDPointIconPoint());
|
||||
@ -256,12 +255,12 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie
|
||||
mySet.setColor(Color.BLACK);
|
||||
for (int i = 0; i < pf.size(); i++) {
|
||||
if (this.fitObjective.getSelectedIndex() == 0) {
|
||||
fitness = ((AbstractEAIndividual) pf.get(i)).getFitness();
|
||||
fitness = pf.get(i).getFitness();
|
||||
} else {
|
||||
InterfaceOptimizationObjective[] tmpObj = ((InterfaceMultiObjectiveDeNovoProblem) this.moccoViewer.moccoStandalone.state.currentProblem).getProblemObjectives();
|
||||
fitness = new double[tmpObj.length];
|
||||
for (int k = 0; k < tmpObj.length; k++) {
|
||||
fitness[k] = (Double) ((AbstractEAIndividual) pf.get(i)).getData(tmpObj[k].getIdentName());
|
||||
fitness[k] = (Double) pf.get(i).getData(tmpObj[k].getIdentName());
|
||||
}
|
||||
}
|
||||
point = new DPoint(fitness[indexX], fitness[indexY]);
|
||||
@ -270,7 +269,7 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie
|
||||
((Chart2DDPointContentSelectable) icon).addSelectionListener(this.moccoViewer);
|
||||
}
|
||||
((InterfaceDPointWithContent) icon).setProblem(this.moccoViewer.moccoStandalone.state.currentProblem);
|
||||
((InterfaceDPointWithContent) icon).setEAIndividual((AbstractEAIndividual) pf.get(i));
|
||||
((InterfaceDPointWithContent) icon).setEAIndividual(pf.get(i));
|
||||
point.setIcon(icon);
|
||||
mySet.addDPoint(point);
|
||||
if (fitness[indexX] < xmin) {
|
||||
|
@ -92,8 +92,8 @@ class SimpleView extends JComponent implements InterfaceRefPointListener {
|
||||
}
|
||||
} else {
|
||||
InterfaceOptimizationObjective[] tmpObj = ((InterfaceMultiObjectiveDeNovoProblem) this.paretoFrontViewScatterPlot.moccoViewer.moccoStandalone.state.currentProblem).getProblemObjectives();
|
||||
result[0] = ((Double) indy.getData(tmpObj[this.object1].getIdentName())).doubleValue();
|
||||
result[1] = ((Double) indy.getData(tmpObj[this.object2].getIdentName())).doubleValue();
|
||||
result[0] = (Double) indy.getData(tmpObj[this.object1].getIdentName());
|
||||
result[1] = (Double) indy.getData(tmpObj[this.object2].getIdentName());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -123,14 +123,14 @@ class SimpleView extends JComponent implements InterfaceRefPointListener {
|
||||
mySet.setConnectedMode(false);
|
||||
mySet.setColor(Color.BLACK);
|
||||
for (int i = 0; i < pf.size(); i++) {
|
||||
plotValue = this.fetchPlotValueFor((AbstractEAIndividual) pf.get(i));
|
||||
plotValue = this.fetchPlotValueFor(pf.get(i));
|
||||
point = new DPoint(plotValue[0], plotValue[1]);
|
||||
icon = new Chart2DDPointContentSelectable();
|
||||
if (this.paretoFrontViewScatterPlot.moccoViewer.refSolutionSelectable) {
|
||||
((Chart2DDPointContentSelectable) icon).addSelectionListener(this.paretoFrontViewScatterPlot.moccoViewer);
|
||||
}
|
||||
((InterfaceDPointWithContent) icon).setProblem(this.paretoFrontViewScatterPlot.moccoViewer.moccoStandalone.state.currentProblem);
|
||||
((InterfaceDPointWithContent) icon).setEAIndividual((AbstractEAIndividual) pf.get(i));
|
||||
((InterfaceDPointWithContent) icon).setEAIndividual(pf.get(i));
|
||||
point.setIcon(icon);
|
||||
mySet.addDPoint(point);
|
||||
if (plotValue[0] < xmin) {
|
||||
|
@ -38,13 +38,13 @@ public abstract class AbstractArchiving implements InterfaceArchiving, java.io.S
|
||||
public boolean isDominant(AbstractEAIndividual indy, Population pop) {
|
||||
if (this.obeyDebsConstViolationPrinciple) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (!(indy.equals(pop.get(i))) && (((AbstractEAIndividual) pop.get(i)).isDominatingDebConstraints(indy))) {
|
||||
if (!(indy.equals(pop.get(i))) && (pop.get(i).isDominatingDebConstraints(indy))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (!(indy.equals(pop.get(i))) && (((AbstractEAIndividual) pop.get(i)).isDominating(indy))) {
|
||||
if (!(indy.equals(pop.get(i))) && (pop.get(i).isDominating(indy))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ public abstract class AbstractArchiving implements InterfaceArchiving, java.io.S
|
||||
|
||||
for (int i = 0; i < archive.size(); i++) {
|
||||
isDominating = true;
|
||||
tmpFitness = ((AbstractEAIndividual) archive.get(i)).getFitness();
|
||||
tmpFitness = archive.get(i).getFitness();
|
||||
try {
|
||||
for (int j = 0; j < indyFitness.length; j++) {
|
||||
isDominating &= indyFitness[j] <= tmpFitness[j];
|
||||
@ -120,7 +120,7 @@ public abstract class AbstractArchiving implements InterfaceArchiving, java.io.S
|
||||
// first prepare the tmpFit
|
||||
tmpFit = new double[pop.size()][];
|
||||
for (int j = 0; j < pop.size(); j++) {
|
||||
tmpIndy = ((AbstractEAIndividual) pop.get(j));
|
||||
tmpIndy = pop.get(j);
|
||||
if (tmpIndy.getFitness().length <= 1) {
|
||||
tmpD = (double[]) tmpIndy.getData("MOFitness");
|
||||
tmpFit[j] = new double[tmpD.length];
|
||||
|
@ -42,9 +42,9 @@ public class ArchivingAllDominating extends AbstractArchiving implements java.io
|
||||
if (this.obeyDebsConstViolationPrinciple) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
//System.out.println("i:"+ i+" "+pop.size()+"_"+((AbstractEAIndividual)pop.get(0)).getFitness().length);
|
||||
if ((((AbstractEAIndividual) pop.get(i)).getConstraintViolation() == 0) && (this.isDominant((AbstractEAIndividual) pop.get(i), pop.getArchive()))) {
|
||||
if ((pop.get(i).getConstraintViolation() == 0) && (this.isDominant(pop.get(i), pop.getArchive()))) {
|
||||
//System.out.println("Adding ("+((AbstractEAIndividual)pop.get(i)).getFitness()[0] +"/"+((AbstractEAIndividual)pop.get(i)).getFitness()[1]+") to archive.");
|
||||
this.addIndividualToArchive((AbstractEAIndividual) ((AbstractEAIndividual) pop.get(i)).clone(), pop.getArchive());
|
||||
this.addIndividualToArchive((AbstractEAIndividual) pop.get(i).clone(), pop.getArchive());
|
||||
}
|
||||
}
|
||||
if ((pop.getArchive().size() == 0) && (pop.size() > 0)) {
|
||||
@ -57,9 +57,9 @@ public class ArchivingAllDominating extends AbstractArchiving implements java.io
|
||||
// is dominating a element in the archive
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
//System.out.println("i:"+ i+" "+pop.size()+"_"+((AbstractEAIndividual)pop.get(0)).getFitness().length);
|
||||
if (this.isDominant((AbstractEAIndividual) pop.get(i), pop.getArchive())) {
|
||||
if (this.isDominant(pop.get(i), pop.getArchive())) {
|
||||
//System.out.println("Adding ("+((AbstractEAIndividual)pop.get(i)).getFitness()[0] +"/"+((AbstractEAIndividual)pop.get(i)).getFitness()[1]+") to archive.");
|
||||
this.addIndividualToArchive((AbstractEAIndividual) ((AbstractEAIndividual) pop.get(i)).clone(), pop.getArchive());
|
||||
this.addIndividualToArchive((AbstractEAIndividual) pop.get(i).clone(), pop.getArchive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.operator.archiving;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.operator.moso.MOSOMaxiMin;
|
||||
import eva2.optimization.operator.selection.InterfaceSelection;
|
||||
import eva2.optimization.operator.selection.SelectBestIndividuals;
|
||||
@ -65,8 +64,8 @@ public class ArchivingMaxiMin implements InterfaceArchiving, java.io.Serializabl
|
||||
|
||||
// now unconvert from SO to MO
|
||||
for (int i = 0; i < archive.size(); i++) {
|
||||
tmpD = (double[]) ((AbstractEAIndividual) archive.get(i)).getData("MOFitness");
|
||||
((AbstractEAIndividual) archive.get(i)).setFitness(tmpD);
|
||||
tmpD = (double[]) archive.get(i).getData("MOFitness");
|
||||
archive.get(i).setFitness(tmpD);
|
||||
}
|
||||
|
||||
pop.SetArchive(archive);
|
||||
|
@ -40,8 +40,8 @@ public class ArchivingNSGA extends AbstractArchiving implements java.io.Serializ
|
||||
// test for each element in population if it
|
||||
// is dominating a element in the archive
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (this.isDominant((AbstractEAIndividual) pop.get(i), pop.getArchive())) {
|
||||
this.addIndividualToArchive((AbstractEAIndividual) ((AbstractEAIndividual) pop.get(i)).clone(), pop.getArchive());
|
||||
if (this.isDominant(pop.get(i), pop.getArchive())) {
|
||||
this.addIndividualToArchive((AbstractEAIndividual) pop.get(i).clone(), pop.getArchive());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.operator.archiving;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.tools.chart2d.Chart2DDPointIconCross;
|
||||
import eva2.tools.chart2d.DPointIcon;
|
||||
@ -111,8 +110,8 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab
|
||||
tmpDom = new Population();
|
||||
tmpNonDom = new Population();
|
||||
for (int i = 0; i < tmpPop.size(); i++) {
|
||||
if (this.isDominant((AbstractEAIndividual) tmpPop.get(i), tmpPop)) {
|
||||
((AbstractEAIndividual) tmpPop.get(i)).putData("ParetoLevel", new Integer(level));
|
||||
if (this.isDominant(tmpPop.get(i), tmpPop)) {
|
||||
tmpPop.get(i).putData("ParetoLevel", level);
|
||||
tmpDom.add(tmpPop.get(i));
|
||||
|
||||
} else {
|
||||
@ -124,7 +123,7 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab
|
||||
System.out.println("Problem NSGA II at level " + level + ".");
|
||||
tmpDom.addPopulation(tmpNonDom);
|
||||
for (int i = 0; i < tmpDom.size(); i++) {
|
||||
((AbstractEAIndividual) tmpDom.get(i)).putData("ParetoLevel", new Integer(level));
|
||||
tmpDom.get(i).putData("ParetoLevel", level);
|
||||
}
|
||||
tmpPop.clear();
|
||||
// System.out.println(""+tmpPop.getStringRepresentation());
|
||||
@ -154,11 +153,11 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab
|
||||
fitness = new double[fronts[i].size()][];
|
||||
hyperCube = new double[fronts[i].size()];
|
||||
for (int j = 0; j < fronts[i].size(); j++) {
|
||||
fitness[j] = ((AbstractEAIndividual) fronts[i].get(j)).getFitness();
|
||||
fitness[j] = fronts[i].get(j).getFitness();
|
||||
}
|
||||
hyperCube = heidi.calculateHyperCubeVolumes(fitness);
|
||||
for (int j = 0; j < fronts[i].size(); j++) {
|
||||
((AbstractEAIndividual) fronts[i].get(j)).putData("HyperCube", new Double(hyperCube[j]));
|
||||
fronts[i].get(j).putData("HyperCube", hyperCube[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ public class ArchivingNSGAIISMeasure extends ArchivingNSGAII {
|
||||
public boolean isDominant(AbstractEAIndividual indy, Population pop) {
|
||||
if (this.obeyDebsConstViolationPrinciple) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (!(indy.equals(pop.get(i)) || indy.equalFitness((AbstractEAIndividual) pop.get(i))) && (((AbstractEAIndividual) pop.get(i)).isDominatingDebConstraints(indy))) {
|
||||
if (!(indy.equals(pop.get(i)) || indy.equalFitness(pop.get(i))) && (pop.get(i).isDominatingDebConstraints(indy))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (!(indy.equals(pop.get(i)) || indy.equalFitness((AbstractEAIndividual) pop.get(i))) && (((AbstractEAIndividual) pop.get(i)).isDominating(indy))) {
|
||||
if (!(indy.equals(pop.get(i)) || indy.equalFitness(pop.get(i))) && (pop.get(i).isDominating(indy))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -99,7 +99,7 @@ public class ArchivingNSGAIISMeasure extends ArchivingNSGAII {
|
||||
}
|
||||
}
|
||||
assigned[minIndex] = true;
|
||||
((AbstractEAIndividual) frontArray[minIndex]).putData("HyperCube", new Double(e));
|
||||
((AbstractEAIndividual) frontArray[minIndex]).putData("HyperCube", (double) e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,8 +46,8 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
|
||||
// test for each element in population if it
|
||||
// is dominating a element in the archive
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
if (this.isDominant((AbstractEAIndividual) pop.get(i), pop.getArchive())) {
|
||||
this.addIndividualToArchive((AbstractEAIndividual) ((AbstractEAIndividual) pop.get(i)).clone(), pop.getArchive());
|
||||
if (this.isDominant(pop.get(i), pop.getArchive())) {
|
||||
this.addIndividualToArchive((AbstractEAIndividual) pop.get(i).clone(), pop.getArchive());
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,14 +88,14 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
|
||||
// boolean debug = true;
|
||||
|
||||
// first calculate the bounds of the search space
|
||||
bounds = new double[((AbstractEAIndividual) pop.get(0)).getFitness().length][2];
|
||||
bounds = new double[pop.get(0).getFitness().length][2];
|
||||
for (int i = 0; i < bounds.length; i++) {
|
||||
bounds[i][0] = Double.POSITIVE_INFINITY;
|
||||
bounds[i][1] = Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
// if (debug) System.out.println("The individuals:");
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
tmpFit = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
tmpFit = pop.get(i).getFitness();
|
||||
// if (debug) System.out.println("Individual "+i+": "+tmpFit[0] +"/"+tmpFit[1]);
|
||||
result[i] = 0;
|
||||
for (int j = 0; j < tmpFit.length; j++) {
|
||||
@ -122,7 +122,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
|
||||
curGrid = new int[bounds.length];
|
||||
// haven't calculated the squeeze factor for this guy yet
|
||||
// first i'll calculate the grid position this guy is in
|
||||
tmpFit = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
tmpFit = pop.get(i).getFitness();
|
||||
coll = new ArrayList();
|
||||
for (int j = 0; j < tmpFit.length; j++) {
|
||||
grid[j] = (bounds[j][1] - bounds[j][0]) / this.gridSize;
|
||||
@ -133,12 +133,12 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
|
||||
// System.out.println("");
|
||||
// System.out.println("Checking for individuals in the same grid");
|
||||
// }
|
||||
coll.add(new Integer(i));
|
||||
coll.add(i);
|
||||
for (int j = i + 1; j < pop.size(); j++) {
|
||||
if (result[j] == 0) {
|
||||
// check whether this guy is in the same grid as the
|
||||
// first guy...
|
||||
tmpFit = ((AbstractEAIndividual) pop.get(j)).getFitness();
|
||||
tmpFit = pop.get(j).getFitness();
|
||||
sameGrid = true;
|
||||
for (int k = 0; k < tmpFit.length; k++) {
|
||||
tmpGrid[k] = (int) ((tmpFit[k] - bounds[k][0]) / grid[k]);
|
||||
@ -149,7 +149,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
|
||||
}
|
||||
}
|
||||
if (sameGrid) {
|
||||
coll.add(new Integer(j));
|
||||
coll.add(j);
|
||||
}
|
||||
// if (debug) {
|
||||
// System.out.println("Checking indy "+j+" ("+tmpFit[0] +"/"+tmpFit[1]+") in grid ["+tmpGrid[0]+"/"+tmpGrid[1]+"]");
|
||||
@ -159,9 +159,9 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
|
||||
// now i got all the boogies of the same grid element
|
||||
// lets assign them thier squeeze factor
|
||||
for (int j = 0; j < coll.size(); j++) {
|
||||
result[((Integer) coll.get(j)).intValue()] = coll.size();
|
||||
tmpIndy = (AbstractEAIndividual) pop.get(((Integer) coll.get(j)).intValue());
|
||||
tmpIndy.putData("SqueezeFactor", new Integer(coll.size()));
|
||||
result[((Integer) coll.get(j))] = coll.size();
|
||||
tmpIndy = pop.get(((Integer) coll.get(j)).intValue());
|
||||
tmpIndy.putData("SqueezeFactor", coll.size());
|
||||
tmpIndy.putData("GridBox", curGrid);
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
|
||||
double[][] fitness = new double[tmp.size()][];
|
||||
for (int i = 0; i < tmp.size(); i++) {
|
||||
fitness[i] = ((AbstractEAIndividual) tmp.get(i)).getFitness();
|
||||
fitness[i] = tmp.get(i).getFitness();
|
||||
}
|
||||
double[] minY, maxY;
|
||||
minY = fitness[0];
|
||||
@ -162,9 +162,9 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
result[i] = 0;
|
||||
SPEAStrength[i] = 0;
|
||||
tmpIndy = (AbstractEAIndividual) pop.get(i);
|
||||
tmpIndy = pop.get(i);
|
||||
for (int j = 0; j < pop.size(); j++) {
|
||||
if ((i != j) && (!this.isEqualTo(tmpIndy, (AbstractEAIndividual) pop.get(j))) && (tmpIndy.isDominating((AbstractEAIndividual) pop.get(j)))) {
|
||||
if ((i != j) && (!this.isEqualTo(tmpIndy, pop.get(j))) && (tmpIndy.isDominating(pop.get(j)))) {
|
||||
SPEAStrength[i]++;
|
||||
}
|
||||
}
|
||||
@ -178,13 +178,13 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
// now calculate the SPEAFitness
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
for (int j = 0; j < pop.size(); j++) {
|
||||
if ((i != j) && (!this.isEqualTo((AbstractEAIndividual) pop.get(i), (AbstractEAIndividual) pop.get(j))) && (((AbstractEAIndividual) pop.get(i)).isDominating(((AbstractEAIndividual) pop.get(j))))) {
|
||||
if ((i != j) && (!this.isEqualTo(pop.get(i), pop.get(j))) && (pop.get(i).isDominating(pop.get(j)))) {
|
||||
result[j] += SPEAStrength[i];
|
||||
if (this.soutDebug) {
|
||||
if (i == 14) {
|
||||
double[] f1, f2;
|
||||
f1 = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
f2 = ((AbstractEAIndividual) pop.get(j)).getFitness();
|
||||
f1 = pop.get(i).getFitness();
|
||||
f2 = pop.get(j).getFitness();
|
||||
for (int n = 0; n < f1.length; n++) {
|
||||
System.out.println("" + Math.abs(f1[n] - f2[n]));
|
||||
}
|
||||
@ -205,7 +205,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
double[][] trueFitness;
|
||||
trueFitness = new double[pop.size()][];
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
trueFitness[i] = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
trueFitness[i] = pop.get(i).getFitness();
|
||||
System.out.println("Fitness: (" + trueFitness[i][0] + "/" + trueFitness[i][1] + ")");
|
||||
}
|
||||
DPoint myPoint;
|
||||
@ -250,7 +250,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
distMatrix[i][i] = 0.0;
|
||||
for (int j = i + 1; j < pop.size(); j++) {
|
||||
distMatrix[i][j] = this.metric.distance((AbstractEAIndividual) pop.get(i), (AbstractEAIndividual) pop.get(j));
|
||||
distMatrix[i][j] = this.metric.distance(pop.get(i), pop.get(j));
|
||||
distMatrix[j][i] = distMatrix[i][j];
|
||||
}
|
||||
}
|
||||
@ -311,13 +311,13 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
|
||||
// first calculate the SPEAStrength
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) pop.get(i);
|
||||
tmpIndy = pop.get(i);
|
||||
trueFitness[i] = tmpIndy.getFitness();
|
||||
for (int j = i + 1; j < pop.size(); j++) {
|
||||
if (tmpIndy.isDominating((AbstractEAIndividual) pop.get(j))) {
|
||||
if (tmpIndy.isDominating(pop.get(j))) {
|
||||
SPEAStrength[i]++;
|
||||
} else {
|
||||
if (((AbstractEAIndividual) pop.get(j)).isDominating(tmpIndy)) {
|
||||
if (pop.get(j).isDominating(tmpIndy)) {
|
||||
SPEAStrength[j]++;
|
||||
}
|
||||
}
|
||||
@ -328,7 +328,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
for (int j = 0; j < pop.size(); j++) {
|
||||
if (i != j) {
|
||||
if (((AbstractEAIndividual) pop.get(i)).isDominating(((AbstractEAIndividual) pop.get(j)))) {
|
||||
if (pop.get(i).isDominating(pop.get(j))) {
|
||||
SPEAFitness[j] += SPEAStrength[i];
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
distMatrix[i][i] = 0.0;
|
||||
for (int j = i + 1; j < pop.size(); j++) {
|
||||
distMatrix[i][j] = this.metric.distance((AbstractEAIndividual) pop.get(i), (AbstractEAIndividual) pop.get(j));
|
||||
distMatrix[i][j] = this.metric.distance(pop.get(i), pop.get(j));
|
||||
distMatrix[j][i] = distMatrix[i][j];
|
||||
}
|
||||
}
|
||||
@ -373,8 +373,8 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
|
||||
System.out.println("d " + 1 / (2 + D[i]));
|
||||
}
|
||||
SPEAResult[i] = SPEAFitness[i] + (1 / (2 + D[i]));
|
||||
((AbstractEAIndividual) pop.get(i)).putData("RawFit", new Double(SPEAFitness[i]));
|
||||
((AbstractEAIndividual) pop.get(i)).putData("SPEAFit", new Double(SPEAResult[i]));
|
||||
pop.get(i).putData("RawFit", (double) SPEAFitness[i]);
|
||||
pop.get(i).putData("SPEAFit", SPEAResult[i]);
|
||||
}
|
||||
|
||||
// Puh!
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.operator.archiving;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.tools.math.RNG;
|
||||
|
||||
@ -41,7 +40,7 @@ public class RemoveSurplusIndividualsDynamicHyperCube implements InterfaceRemove
|
||||
fitness = new double[archive.size()][];
|
||||
space = new double[archive.size()];
|
||||
for (int i = 0; i < archive.size(); i++) {
|
||||
fitness[i] = ((AbstractEAIndividual) archive.get(i)).getFitness();
|
||||
fitness[i] = archive.get(i).getFitness();
|
||||
}
|
||||
space = this.calculateHyperCubeVolumes(fitness);
|
||||
// now find the individual with the smallest hypervolume
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.operator.archiving;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.tools.math.RNG;
|
||||
|
||||
@ -41,7 +40,7 @@ public class RemoveSurplusIndividualsSMetric implements InterfaceRemoveSurplusIn
|
||||
fitness = new double[archive.size()][];
|
||||
space = new double[archive.size()];
|
||||
for (int i = 0; i < archive.size(); i++) {
|
||||
fitness[i] = ((AbstractEAIndividual) archive.get(i)).getFitness();
|
||||
fitness[i] = archive.get(i).getFitness();
|
||||
}
|
||||
space = this.calculateContributingHypervolume(fitness);
|
||||
// now find the individual with the smallest hypervolume
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.operator.archiving;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.tools.math.RNG;
|
||||
|
||||
@ -40,20 +39,20 @@ public class RemoveSurplusIndividualsStaticHyperCube extends RemoveSurplusIndivi
|
||||
fitness = new double[archive.size()][];
|
||||
space = new double[archive.size()];
|
||||
for (int i = 0; i < archive.size(); i++) {
|
||||
fitness[i] = ((AbstractEAIndividual) archive.get(i)).getFitness();
|
||||
fitness[i] = archive.get(i).getFitness();
|
||||
}
|
||||
space = this.calculateHyperCubeVolumes(fitness);
|
||||
for (int i = 0; i < archive.size(); i++) {
|
||||
((AbstractEAIndividual) archive.get(i)).putData("HyperCube", new Double(space[i]));
|
||||
archive.get(i).putData("HyperCube", space[i]);
|
||||
}
|
||||
|
||||
while (archive.targetSizeExceeded()) {
|
||||
// select the individual with the least space around him
|
||||
// to do this i got to find the next smaller and the next bigger one
|
||||
smallestHyperCube = ((Double) ((AbstractEAIndividual) archive.get(0)).getData("HyperCube")).doubleValue();
|
||||
smallestHyperCube = (Double) archive.get(0).getData("HyperCube");
|
||||
indexSmallHyperCube = 0;
|
||||
for (int i = 1; i < archive.size(); i++) {
|
||||
tmpS = ((Double) ((AbstractEAIndividual) archive.get(i)).getData("HyperCube")).doubleValue();
|
||||
tmpS = (Double) archive.get(i).getData("HyperCube");
|
||||
if (tmpS < smallestHyperCube) {
|
||||
smallestHyperCube = tmpS;
|
||||
indexSmallHyperCube = i;
|
||||
|
@ -102,10 +102,10 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
|
||||
|
||||
// Build the connection Matrix
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
tmpIndy1 = (AbstractEAIndividual) pop.get(i);
|
||||
tmpIndy1 = pop.get(i);
|
||||
connectionMatrix[i][i] = true;
|
||||
for (int j = i + 1; j < pop.size(); j++) {
|
||||
tmpIndy2 = (AbstractEAIndividual) pop.get(j);
|
||||
tmpIndy2 = pop.get(j);
|
||||
if (tmpIndy1 == null || (tmpIndy2 == null)) {
|
||||
System.err.println("Warning: Individual should not be null (ClusteringDensityBased)!");
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public class ClusteringDynPeakIdent implements InterfaceClustering, java.io.Seri
|
||||
int i = 0;
|
||||
Population peaks = new Population(q);
|
||||
while (i < sortedPop.size() && (peaks.size() < q)) {
|
||||
if ((peaks.size() == 0) || (!peaks.isWithinPopDist((AbstractEAIndividual) sortedPop.get(i), rho, metric))) {
|
||||
if ((peaks.size() == 0) || (!peaks.isWithinPopDist(sortedPop.get(i), rho, metric))) {
|
||||
peaks.add(sortedPop.get(i));
|
||||
}
|
||||
i++;
|
||||
|
@ -338,7 +338,7 @@ public class ClusteringKMeans implements InterfaceClustering, java.io.Serializab
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
data[i] = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
data[i] = pop.get(i).getFitness();
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
@ -296,7 +296,7 @@ public class ClusteringNearestBetter implements InterfaceClustering, Serializabl
|
||||
Double refDat = (Double) referenceSet.getData(initializedRefData);
|
||||
if (refDat != null) {
|
||||
|
||||
currentMeanDistance = refDat.doubleValue();
|
||||
currentMeanDistance = refDat;
|
||||
return true;
|
||||
} else {
|
||||
System.err.println("Warning, missing reference data - forgot reference set initialization? " + this.getClass());
|
||||
|
@ -2,7 +2,6 @@ package eva2.optimization.operator.cluster;
|
||||
|
||||
import eva2.gui.plot.GraphPointSet;
|
||||
import eva2.gui.plot.Plot;
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.individuals.ESIndividualDoubleData;
|
||||
import eva2.optimization.individuals.InterfaceDataTypeDouble;
|
||||
import eva2.optimization.population.Population;
|
||||
@ -228,7 +227,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
data[i] = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
data[i] = pop.get(i).getFitness();
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
@ -50,7 +50,7 @@ public class CrossoverESArithmetical implements InterfaceCrossover, java.io.Seri
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CrossoverESBLXAlpha implements InterfaceCrossover, java.io.Serializ
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class CrossoverESFlat implements InterfaceCrossover, java.io.Serializable
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class CrossoverESIntermediate implements InterfaceCrossover, java.io.Seri
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover,
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class CrossoverGABitSimulated implements InterfaceCrossover, java.io.Seri
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (partners.size() == 0) {
|
||||
return result;
|
||||
|
@ -50,8 +50,8 @@ public class CrossoverGADefault implements InterfaceCrossover,
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners
|
||||
.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners
|
||||
.get(i).clone();
|
||||
}
|
||||
// for (int i = 0; i < result.length; i++) System.out.println("Before
|
||||
// Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
@ -60,7 +60,7 @@ public class CrossoverGAGINPoint implements InterfaceCrossover, java.io.Serializ
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (individual).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
|
||||
if (partners.size() == 0) {
|
||||
|
@ -48,7 +48,7 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (partners.size() == 0) {
|
||||
return result;
|
||||
|
@ -49,7 +49,7 @@ public class CrossoverGIDefault implements InterfaceCrossover, java.io.Serializa
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (partners.size() == 0) {
|
||||
return result;
|
||||
|
@ -49,7 +49,7 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (partners.size() == 0) {
|
||||
return result;
|
||||
|
@ -47,7 +47,7 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (partners.size() == 0) {
|
||||
return result;
|
||||
|
@ -54,7 +54,7 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
if (partners.size() == 0) {
|
||||
return result;
|
||||
|
@ -35,7 +35,7 @@ public class CrossoverOBGAPMX implements InterfaceCrossover, java.io.Serializabl
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
|
||||
if ((indy1 instanceof InterfaceOBGAIndividual) && (partners.get(0) instanceof InterfaceOBGAIndividual)) {
|
||||
|
@ -35,7 +35,7 @@ public class CrossoverOBGAPMXUniform implements InterfaceCrossover, java.io.Seri
|
||||
result = new AbstractEAIndividual[partners.size() + 1];
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class NoCrossover implements InterfaceCrossover, java.io.Serializable {
|
||||
result = new AbstractEAIndividual[1 + partners.size()]; /// by MK
|
||||
result[0] = (AbstractEAIndividual) (indy1).clone();
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners.get(i)).clone();
|
||||
result[i + 1] = (AbstractEAIndividual) partners.get(i).clone();
|
||||
}
|
||||
//in case the crossover was successful lets give the mutation operators a chance to mate the strategy parameters
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eva2.optimization.operator.fitnessmodifier;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.operator.cluster.ClusteringDensityBased;
|
||||
import eva2.optimization.operator.cluster.InterfaceClustering;
|
||||
import eva2.optimization.population.Population;
|
||||
@ -26,7 +25,7 @@ public class FitnessAdaptiveClustering implements java.io.Serializable, Interfac
|
||||
// prepare the calculation
|
||||
double[][] data = new double[population.size()][];
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
data[i] = ((AbstractEAIndividual) population.get(i)).getFitness();
|
||||
data[i] = population.get(i).getFitness();
|
||||
}
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double[] result = new double[data.length];
|
||||
@ -58,7 +57,7 @@ public class FitnessAdaptiveClustering implements java.io.Serializable, Interfac
|
||||
}
|
||||
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
((AbstractEAIndividual) population.get(i)).SetFitness(x, result[i]);
|
||||
population.get(i).SetFitness(x, result[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class FitnessSharing implements java.io.Serializable, InterfaceFitnessMod
|
||||
// prepare the calculation
|
||||
double[][] data = new double[population.size()][];
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
data[i] = ((AbstractEAIndividual) population.get(i)).getFitness();
|
||||
data[i] = population.get(i).getFitness();
|
||||
}
|
||||
double min = Double.POSITIVE_INFINITY, fitnessSharing;
|
||||
double[] result = new double[data.length];
|
||||
@ -50,18 +50,18 @@ public class FitnessSharing implements java.io.Serializable, InterfaceFitnessMod
|
||||
}
|
||||
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) population.get(i);
|
||||
tmpIndy = population.get(i);
|
||||
fitnessSharing = 0;
|
||||
for (int j = 0; j < population.size(); j++) {
|
||||
if (this.sharingDistance < this.distanceMetric.distance(tmpIndy, (AbstractEAIndividual) population.get(j))) {
|
||||
fitnessSharing += 1 - (this.distanceMetric.distance(tmpIndy, (AbstractEAIndividual) population.get(j)) / this.sharingDistance);
|
||||
if (this.sharingDistance < this.distanceMetric.distance(tmpIndy, population.get(j))) {
|
||||
fitnessSharing += 1 - (this.distanceMetric.distance(tmpIndy, population.get(j)) / this.sharingDistance);
|
||||
}
|
||||
}
|
||||
result[i] /= fitnessSharing;
|
||||
}
|
||||
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
((AbstractEAIndividual) population.get(i)).SetFitness(x, result[i]);
|
||||
population.get(i).SetFitness(x, result[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public class MOClusteringSeparation implements InterfaceMigration, java.io.Seria
|
||||
mySet = new GraphPointSet(10 + 1, plot.getFunctionArea());
|
||||
mySet.setConnectedMode(false);
|
||||
for (int j = 0; j < newIPOP[i].size(); j++) {
|
||||
indy = (AbstractEAIndividual) newIPOP[i].get(j);
|
||||
indy = newIPOP[i].get(j);
|
||||
myPoint = new DPoint(indy.getFitness()[0], indy.getFitness()[1]);
|
||||
tmp = new Chart2DDPointIconText("" + i);
|
||||
//if (i % 2 == 0) tmp.setIcon(new Chart2DDPointIconCircle());
|
||||
|
@ -96,13 +96,13 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
}
|
||||
memory = (Population) collector.clone();
|
||||
|
||||
if (((AbstractEAIndividual) collector.get(0)).getFitness().length == 2) {
|
||||
if (collector.get(0).getFitness().length == 2) {
|
||||
this.coneSeparation2D(collector, newIPOP, islands);
|
||||
} else {
|
||||
if (((AbstractEAIndividual) collector.get(0)).getFitness().length == 3) {
|
||||
if (collector.get(0).getFitness().length == 3) {
|
||||
this.coneSeparation3D(collector, newIPOP, islands);
|
||||
} else {
|
||||
if (((AbstractEAIndividual) collector.get(0)).getFitness().length >= 4) {
|
||||
if (collector.get(0).getFitness().length >= 4) {
|
||||
System.out.println("*Pff*");
|
||||
}
|
||||
}
|
||||
@ -174,18 +174,18 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
}
|
||||
|
||||
for (int i = 1; i < ref.size(); i++) {
|
||||
if (((AbstractEAIndividual) ref.get(i)).getFitness()[0] > ((AbstractEAIndividual) ref.get(y1Big)).getFitness()[0]) {
|
||||
if (ref.get(i).getFitness()[0] > ref.get(y1Big).getFitness()[0]) {
|
||||
y1Big = i;
|
||||
}
|
||||
if (((AbstractEAIndividual) ref.get(i)).getFitness()[1] > ((AbstractEAIndividual) ref.get(y2Big)).getFitness()[1]) {
|
||||
if (ref.get(i).getFitness()[1] > ref.get(y2Big).getFitness()[1]) {
|
||||
y2Big = i;
|
||||
}
|
||||
}
|
||||
double[] r = new double[2];
|
||||
double alpha = 90.0 / (double) islands.length;
|
||||
double[][] boundaries = new double[islands.length - 1][2];
|
||||
r[0] = ((AbstractEAIndividual) ref.get(y1Big)).getFitness()[0];
|
||||
r[1] = ((AbstractEAIndividual) ref.get(y2Big)).getFitness()[1];
|
||||
r[0] = ref.get(y1Big).getFitness()[0];
|
||||
r[1] = ref.get(y2Big).getFitness()[1];
|
||||
for (int i = 0; i < boundaries.length; i++) {
|
||||
boundaries[i][0] = 1 / Math.tan(Math.toRadians(alpha * (i + 1)));
|
||||
boundaries[i][1] = r[1] - boundaries[i][0] * r[0];
|
||||
@ -197,7 +197,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
// Now i got the cone's let's separate
|
||||
for (int i = 0; i < boundaries.length; i++) {
|
||||
for (int j = 0; j < collector.size(); j++) {
|
||||
indy = (AbstractEAIndividual) collector.get(j);
|
||||
indy = collector.get(j);
|
||||
if (indy.getFitness()[1] < boundaries[i][0] * indy.getFitness()[0] + boundaries[i][1]) {
|
||||
// this guy belongs to cone i
|
||||
newIPOP[i].add(indy);
|
||||
@ -229,7 +229,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
mySet = new GraphPointSet(10 + i, plot.getFunctionArea());
|
||||
mySet.setConnectedMode(false);
|
||||
for (int j = 0; j < newIPOP[i].size(); j++) {
|
||||
indy = (AbstractEAIndividual) newIPOP[i].get(j);
|
||||
indy = newIPOP[i].get(j);
|
||||
myPoint = new DPoint(indy.getFitness()[0], indy.getFitness()[1]);
|
||||
tmp = new Chart2DDPointIconText("" + i);
|
||||
if (i % 2 == 0) {
|
||||
@ -312,13 +312,13 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
}
|
||||
|
||||
for (int i = 1; i < ref.size(); i++) {
|
||||
if (((AbstractEAIndividual) ref.get(i)).getFitness()[0] > ((AbstractEAIndividual) ref.get(y1Big)).getFitness()[0]) {
|
||||
if (ref.get(i).getFitness()[0] > ref.get(y1Big).getFitness()[0]) {
|
||||
y1Big = i;
|
||||
}
|
||||
if (((AbstractEAIndividual) ref.get(i)).getFitness()[1] > ((AbstractEAIndividual) ref.get(y2Big)).getFitness()[1]) {
|
||||
if (ref.get(i).getFitness()[1] > ref.get(y2Big).getFitness()[1]) {
|
||||
y2Big = i;
|
||||
}
|
||||
if (((AbstractEAIndividual) ref.get(i)).getFitness()[2] > ((AbstractEAIndividual) ref.get(y3Big)).getFitness()[2]) {
|
||||
if (ref.get(i).getFitness()[2] > ref.get(y3Big).getFitness()[2]) {
|
||||
y3Big = i;
|
||||
}
|
||||
}
|
||||
@ -327,9 +327,9 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
double[][] normals = new double[islands.length][3];
|
||||
double angIncr = 360.0 / (double) islands.length;
|
||||
|
||||
distopian[0] = ((AbstractEAIndividual) ref.get(y1Big)).getFitness()[0];
|
||||
distopian[1] = ((AbstractEAIndividual) ref.get(y2Big)).getFitness()[1];
|
||||
distopian[2] = ((AbstractEAIndividual) ref.get(y3Big)).getFitness()[2];
|
||||
distopian[0] = ref.get(y1Big).getFitness()[0];
|
||||
distopian[1] = ref.get(y2Big).getFitness()[1];
|
||||
distopian[2] = ref.get(y3Big).getFitness()[2];
|
||||
|
||||
zE[0] = 0;
|
||||
zE[1] = 0;
|
||||
@ -362,7 +362,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
// Now i got the cone's let's separate
|
||||
for (int i = 0; i < normals.length; i++) {
|
||||
for (int j = 0; j < collector.size(); j++) {
|
||||
indy = (AbstractEAIndividual) collector.get(j);
|
||||
indy = collector.get(j);
|
||||
fitness = indy.getFitness();
|
||||
if ((this.getScalarProduct(curBoundingPlane[1], this.getVectorSub(fitness, curBoundingPlane[0])) < 0) &&
|
||||
(this.getScalarProduct(lastBoundingPlane[1], this.getVectorSub(fitness, lastBoundingPlane[0])) >= 0)) {
|
||||
|
@ -157,7 +157,7 @@ public class MOXMeansSeparation implements InterfaceMigration, java.io.Serializa
|
||||
mySet = new GraphPointSet(10 + 1, plot.getFunctionArea());
|
||||
mySet.setConnectedMode(false);
|
||||
for (int j = 0; j < newIPOP[i].size(); j++) {
|
||||
indy = (AbstractEAIndividual) newIPOP[i].get(j);
|
||||
indy = newIPOP[i].get(j);
|
||||
myPoint = new DPoint(indy.getFitness()[0], indy.getFitness()[1]);
|
||||
tmp = new Chart2DDPointIconText("" + i);
|
||||
//if (i % 2 == 0) tmp.setIcon(new Chart2DDPointIconCircle());
|
||||
|
@ -41,7 +41,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
this.currentGeneration = pop.getGeneration();
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,17 +38,17 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial
|
||||
for (int i = 0; i < pop.size() - 1; i++) {
|
||||
for (int j = 0; j < pop.size(); j++) {
|
||||
if (i != j) {
|
||||
if (((AbstractEAIndividual) pop.get(j)).isDominatingDebConstraints((AbstractEAIndividual) pop.get(i))) {
|
||||
if (pop.get(j).isDominatingDebConstraints(pop.get(i))) {
|
||||
MOGARank[i] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
((AbstractEAIndividual) pop.get(i)).putData("MOGARank", new Integer(MOGARank[i]));
|
||||
pop.get(i).putData("MOGARank", MOGARank[i]);
|
||||
}
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,13 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable
|
||||
double[] result, tmpFit, resultFit;
|
||||
double tmpResult;
|
||||
|
||||
tmpIndy = (AbstractEAIndividual) pop.get(0);
|
||||
tmpIndy = pop.get(0);
|
||||
fitnessArray = new double[pop.size()][tmpIndy.getFitness().length];
|
||||
minArray = new double[pop.size()][tmpIndy.getFitness().length];
|
||||
result = new double[pop.size()];
|
||||
resultFit = new double[1];
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
fitnessArray[i] = ((AbstractEAIndividual) pop.get(i)).getFitness();
|
||||
fitnessArray[i] = pop.get(i).getFitness();
|
||||
}
|
||||
for (int i = 0; i < fitnessArray.length; i++) {
|
||||
result[i] = Double.NEGATIVE_INFINITY;
|
||||
@ -61,7 +61,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable
|
||||
}
|
||||
}
|
||||
// write the result to the individuals
|
||||
tmpIndy = (AbstractEAIndividual) pop.get(i);
|
||||
tmpIndy = pop.get(i);
|
||||
tmpFit = tmpIndy.getFitness();
|
||||
tmpIndy.putData("MOFitness", tmpFit);
|
||||
resultFit = new double[1];
|
||||
|
@ -33,7 +33,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Seriali
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab
|
||||
ArchivingNSGAII arch = new ArchivingNSGAII();
|
||||
arch.getNonDominatedSortedFronts(pop);
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i
|
||||
@Override
|
||||
public void convertMultiObjective2SingleObjective(Population pop) {
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
this.convertSingleIndividual((AbstractEAIndividual) pop.get(i));
|
||||
this.convertSingleIndividual(pop.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package eva2.optimization.operator.mutation;
|
||||
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.individuals.IndividualInterface;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.util.annotation.Description;
|
||||
|
@ -171,8 +171,8 @@ public class MutateESCovarianceMatrixAdaptionPlus extends
|
||||
// population as
|
||||
// well in case of
|
||||
// plus strategy
|
||||
MutateESCovarianceMatrixAdaptionPlus mutator = (MutateESCovarianceMatrixAdaptionPlus) ((AbstractEAIndividual) selectedPop
|
||||
.get(i)).getMutationOperator();
|
||||
MutateESCovarianceMatrixAdaptionPlus mutator = (MutateESCovarianceMatrixAdaptionPlus) selectedPop
|
||||
.get(i).getMutationOperator();
|
||||
updateMutator(rate, mutator);
|
||||
if (selectedPop.getEAIndividual(i).getFitness(0) <= parentPop
|
||||
.getEAIndividual(0).getFitness(0)) {
|
||||
@ -184,8 +184,8 @@ public class MutateESCovarianceMatrixAdaptionPlus extends
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < newPop.size(); i++) {
|
||||
MutateESCovarianceMatrixAdaptionPlus mutator = (MutateESCovarianceMatrixAdaptionPlus) ((AbstractEAIndividual) newPop
|
||||
.get(i)).getMutationOperator();
|
||||
MutateESCovarianceMatrixAdaptionPlus mutator = (MutateESCovarianceMatrixAdaptionPlus) newPop
|
||||
.get(i).getMutationOperator();
|
||||
updateMutator(rate, mutator);
|
||||
if (newPop.getEAIndividual(i).getFitness(0) <= parentPop
|
||||
.getEAIndividual(0).getFitness(0)) {
|
||||
|
@ -138,16 +138,16 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable,
|
||||
if (crossoverType != MutateESCrossoverType.none) {
|
||||
ArrayList<Double> tmpList = new ArrayList<>();
|
||||
if (indy1.getMutationOperator() instanceof MutateESGlobal) {
|
||||
tmpList.add(new Double(((MutateESGlobal) indy1.getMutationOperator()).mutationStepSize));
|
||||
tmpList.add(((MutateESGlobal) indy1.getMutationOperator()).mutationStepSize);
|
||||
}
|
||||
for (int i = 0; i < partners.size(); i++) {
|
||||
if (((AbstractEAIndividual) partners.get(i)).getMutationOperator() instanceof MutateESGlobal) {
|
||||
tmpList.add(new Double(((MutateESGlobal) ((AbstractEAIndividual) partners.get(i)).getMutationOperator()).mutationStepSize));
|
||||
if (partners.get(i).getMutationOperator() instanceof MutateESGlobal) {
|
||||
tmpList.add(((MutateESGlobal) partners.get(i).getMutationOperator()).mutationStepSize);
|
||||
}
|
||||
}
|
||||
double[] list = new double[tmpList.size()];
|
||||
for (int i = 0; i < tmpList.size(); i++) {
|
||||
list[i] = tmpList.get(i).doubleValue();
|
||||
list[i] = tmpList.get(i);
|
||||
}
|
||||
if (list.length <= 1) {
|
||||
return;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user