Major code cleanup.

This commit is contained in:
halfdan committed 2014-10-19 12:37:35 +02:00
1 parent f4b064e64a
commit d9cc88e60d
348 files changed
+593 -1032

No files matched your search

+6 -6
View File
@@ -94,7 +94,7 @@ public class OptimizerFactory {
* @param listener
* @return An optimization algorithm that performs differential evolution.
*/
public static final DifferentialEvolution createDifferentialEvolution(
public static DifferentialEvolution createDifferentialEvolution(
AbstractOptimizationProblem problem, int popsize, double f,
double lambda, double CR,
InterfacePopulationChangedEventListener listener) {
@@ -136,7 +136,7 @@ public class OptimizerFactory {
* @param listener
* @return An optimization algorithm that employs an evolution strategy.
*/
public static final EvolutionStrategies createEvolutionStrategy(int mu,
public static EvolutionStrategies createEvolutionStrategy(int mu,
int lambda, boolean plus, InterfaceMutation mutationoperator,
double pm, InterfaceCrossover crossoveroperator, double pc,
InterfaceSelection selection, AbstractOptimizationProblem problem,
@@ -164,7 +164,7 @@ public class OptimizerFactory {
* @param listener
* @return An optimization algorithm that employs an IPOP-ES.
*/
public static final EvolutionStrategyIPOP createEvolutionStrategyIPOP(int mu,
public static EvolutionStrategyIPOP createEvolutionStrategyIPOP(int mu,
int lambda, boolean plus, InterfaceMutation mutationoperator,
double pm, InterfaceCrossover crossoveroperator, double pc, double incPopSizeFact, double stagThresh,
AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) {
@@ -175,7 +175,7 @@ public class OptimizerFactory {
return esIPOP;
}
private static final EvolutionStrategies createES(EvolutionStrategies theES, InterfaceMutation mutationoperator,
private static EvolutionStrategies createES(EvolutionStrategies theES, InterfaceMutation mutationoperator,
double pm, InterfaceCrossover crossoveroperator, double pc,
InterfaceSelection selection, AbstractOptimizationProblem problem,
InterfacePopulationChangedEventListener listener) {
@@ -526,7 +526,7 @@ public class OptimizerFactory {
*
* @return the default number of fitness call done before termination
*/
public static final int getDefaultFitCalls() {
public static int getDefaultFitCalls() {
return defaultFitCalls;
}
@@ -1423,7 +1423,7 @@ public class OptimizerFactory {
es.setForceOrigPopSize(false);
((EvolutionStrategyIPOP) es).setIncPopSizeFact(incLambdaFact);
// Set CMA operator for mutation
AbstractEAIndividual indy = (AbstractEAIndividual) indyTemplate;
AbstractEAIndividual indy = indyTemplate;
MutateESRankMuCMA cmaMut = new MutateESRankMuCMA();
AbstractEAIndividual.setOperators(indy, cmaMut, 1., new CrossoverESDefault(), 0.);
} else {
+2 -2
View File
@@ -278,7 +278,7 @@ public class OptimizerRunnable implements Runnable {
* @param multis
*/
public void setMultiRuns(int multis) {
((AbstractStatistics) proc.getStatistics()).getStatisticsParameter().setMultiRuns(multis);
proc.getStatistics().getStatisticsParameter().setMultiRuns(multis);
}
/**
@@ -287,6 +287,6 @@ public class OptimizerRunnable implements Runnable {
* @param addInfo
*/
public void setOutputFullStatsToText(boolean addInfo) {
((AbstractStatistics) proc.getStatistics()).getStatisticsParameter().setOutputAllFieldsAsText(addInfo);
proc.getStatistics().getStatisticsParameter().setOutputAllFieldsAsText(addInfo);
}
}
@@ -39,5 +39,4 @@ public class TestingCbnPostProc {
}
}
;
}
-1
View File
@@ -36,6 +36,5 @@ public class TestingGAB1 {
System.out.println();
}
;
}
-1
View File
@@ -40,5 +40,4 @@ public class TestingPlusCmaEs {
+ AbstractEAIndividual.getDefaultDataString(bestIndy));
}
;
}
+7 -14
View File
@@ -34,7 +34,7 @@ public class BeanInspector {
return false;
}
System.out.println("equalProperties: " + obj1.getClass().getName() + " " + obj2.getClass().getName());
if (obj1.getClass().getName().equals(obj2.getClass().getName()) == false) {
if (!obj1.getClass().getName().equals(obj2.getClass().getName())) {
System.out.println("");
return false;
}
@@ -76,14 +76,14 @@ public class BeanInspector {
Object value_1 = getter_1.invoke(obj1, args_1);
Object value_2 = getter_2.invoke(obj2, args_2);
BeansInside = true;
if (BeanInspector.equalProperties(value_1, value_2) == false) {
if (!BeanInspector.equalProperties(value_1, value_2)) {
BeansEqual = false;
}
} catch (Exception e) {
System.out.println(" BeanTest.equalProperties " + e.getMessage());
}
}
if (BeansInside == true) {
if (BeansInside) {
return BeansEqual;
}
// here we have Integer or Double ...
@@ -154,7 +154,7 @@ public class BeanInspector {
if (obj instanceof String) {
return (String) obj;
} // directly return a string object
Class<? extends Object> type = obj.getClass();
Class<?> type = obj.getClass();
if (type.isArray()) { // handle the array case
StringBuffer sbuf = new StringBuffer();
@@ -524,11 +524,7 @@ public class BeanInspector {
*/
private static boolean isBoxableFrom(Class clz1, Class clz2) {
Class box = getBoxedType(clz1);
if (box != null && (clz2.isAssignableFrom(box))) {
return true;
} else {
return false;
}
return box != null && (clz2.isAssignableFrom(box));
}
/**
@@ -852,11 +848,8 @@ public class BeanInspector {
if (cls.isPrimitive()) {
return true;
}
if ((cls == Double.class) || (cls == Integer.class) || (cls == Boolean.class) || (cls == Character.class) || (cls == Void.class)
|| (cls == Byte.class) || (cls == Short.class) || (cls == Long.class) || (cls == Float.class)) {
return true;
}
return false;
return (cls == Double.class) || (cls == Integer.class) || (cls == Boolean.class) || (cls == Character.class) || (cls == Void.class)
|| (cls == Byte.class) || (cls == Short.class) || (cls == Long.class) || (cls == Float.class);
}
/**
+1 -2
View File
@@ -44,7 +44,7 @@ public class EvAModuleButtonPanelMaker implements OptimizationStateListener, Ser
toolBar = new JToolBar();
toolBar.setFloatable(false);
moduleAdapter.addOptimizationStateListener((OptimizationStateListener) (this));
moduleAdapter.addOptimizationStateListener(this);
//////////////////////////////////////////////////////////////
@@ -104,7 +104,6 @@ public class EvAModuleButtonPanelMaker implements OptimizationStateListener, Ser
scheduleButton = ToolBoxGui.createIconifiedButton("images/Server24.gif", "Schedule", true);
scheduleButton.setToolTipText("Schedule the currently configured optimization as a job.");
//scheduleButton.setBorderPainted(false);
scheduleButton.addActionListener(new ActionListener() {
@Override
+2 -4
View File
@@ -57,16 +57,14 @@ public class HtmlDemo {
*/
public void show() {
try {
URL url = null;
url = this.getClass().getClassLoader().getSystemResource("html/" + name);
URL url = ClassLoader.getSystemResource("html/" + name);
try {
htmlEditorPane = new JEditorPane(url);
} catch (java.io.IOException ioe) {
url = this.getClass().getClassLoader().getSystemResource("html/Default.html");
url = ClassLoader.getSystemResource("html/Default.html");
htmlEditorPane = new JEditorPane(url);
}
//htmlEditorPane = new JEditorPane(htmlDescription);
htmlEditorPane.setEditable(false);
htmlEditorPane.addHyperlinkListener(createHyperLinkListener());
+1 -1
View File
@@ -70,7 +70,7 @@ public final class JEFrameRegister {
public void setFocusToNext(JEFrame jeFrame) {
int idx = frameList.indexOf(jeFrame);
idx = (idx + 1) % frameList.size();
JEFrame toset = ((JEFrame) frameList.get(idx));
JEFrame toset = frameList.get(idx);
toset.toFront();
}
+1 -10
View File
@@ -1,13 +1,5 @@
package eva2.gui;
/*
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
*/
import eva2.gui.editor.GenericObjectEditor;
import eva2.optimization.stat.OptimizationJobList;
@@ -20,7 +12,6 @@ public class JParaPanel implements Serializable, PanelMaker {
protected String name = "undefined";
protected Object localParameter;
protected Object proxyParameter;
protected PropertyEditor propertyEditor;
/**
@@ -50,7 +41,7 @@ public class JParaPanel implements Serializable, PanelMaker {
} else {
propertyEditor = new GenericObjectEditor();
((GenericObjectEditor) (propertyEditor)).setClassType(localParameter.getClass());
((GenericObjectEditor) (propertyEditor)).setValue(localParameter);
propertyEditor.setValue(localParameter);
((GenericObjectEditor) (propertyEditor)).disableOKCancel();
}
+1 -1
View File
@@ -156,7 +156,7 @@ public class JTextEditorInternalFrame extends JDocFrame {
Action[] actions = textArea.getActions();
for (int i = 0; i < actions.length; i++) {
hashActions.put((String) actions[i].getValue(Action.NAME), actions[i]);
hashActions.put(actions[i].getValue(Action.NAME), actions[i]);
}
mnuEdit = new JExtMenu("&Bearbeiten");
+1 -1
View File
@@ -369,7 +369,7 @@ public class Main extends JFrame implements OptimizationStateListener {
setSize(800, 600);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((int) ((screenSize.width - this.getWidth()) / 2), (int) ((screenSize.height - this.getHeight()) / 2.5));
setLocation((screenSize.width - this.getWidth()) / 2, (int) ((screenSize.height - this.getHeight()) / 2.5));
/* Create a new ConfigurationPanel (left side) */
configurationPane = new JPanel(new GridBagLayout());
+2 -2
View File
@@ -376,7 +376,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
*/ (genericObjectEditor.getValue().getClass().getName());
boolean found = false;
for (int i = 0; i < comboBoxModel.getSize(); i++) {
if (objectName.equals((String) comboBoxModel.getElementAt(i))) {
if (objectName.equals(comboBoxModel.getElementAt(i))) {
found = true;
break;
}
@@ -408,7 +408,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
className = (String) objectChooser.getSelectedItem();
try {
Object n = (Object) Class.forName(className).newInstance();
Object n = Class.forName(className).newInstance();
genericObjectEditor.setValue(n);
// TODO ? setObject(n);
} catch (Exception ex) {
+1 -1
View File
@@ -50,7 +50,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyDoubleArray(this);
return new PropertyDoubleArray(this);
}
/**
+1 -1
View File
@@ -25,6 +25,6 @@ public class PropertyEpsilonConstraint implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyEpsilonConstraint(this);
return new PropertyEpsilonConstraint(this);
}
}
+1 -1
View File
@@ -30,6 +30,6 @@ public class PropertyEpsilonThreshold implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyEpsilonThreshold(this);
return new PropertyEpsilonThreshold(this);
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ public class PropertyFilePath implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyFilePath(this);
return new PropertyFilePath(this);
}
/**
+1 -1
View File
@@ -21,7 +21,7 @@ public class PropertyIntArray implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyIntArray(this);
return new PropertyIntArray(this);
}
/**
@@ -27,7 +27,7 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyOptimizationObjectives(this);
return new PropertyOptimizationObjectives(this);
}
/**
@@ -39,7 +39,7 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
@Override
public Object clone() {
return (Object) new PropertyOptimizationObjectivesWithParam(this);
return new PropertyOptimizationObjectivesWithParam(this);
}
/**
+1 -1
View File
@@ -36,7 +36,7 @@ public class PropertySelectableList<T> implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertySelectableList<T>(this);
return new PropertySelectableList<T>(this);
}
public void setObjects(T[] o) {
+1 -5
View File
@@ -5,7 +5,6 @@ import eva2.tools.EVAHELP;
import eva2.util.annotation.Description;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
@@ -1119,10 +1118,7 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
int selectedColumn = sourceTable.getSelectedColumn();
String columnName = sourceTable.getColumnName(selectedColumn);
/* If the columnName equals Key it holds the keys */
if ("Key".equals(columnName)) {
return false;
}
return true;
return !"Key".equals(columnName);
}
+2 -16
View File
@@ -1,17 +1,4 @@
package eva2.gui;
/*
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 10 $
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $
*/
/*==========================================================================*
* IMPORTS
*==========================================================================*/
import javax.swing.*;
import java.awt.*;
@@ -35,7 +22,6 @@ public class PropertySheetPanelStat extends JPanel implements Serializable {
* Creates the property sheet panel.
*/
public PropertySheetPanelStat() {
// setBorder(BorderFactory.createLineBorder(Color.red));
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
@@ -113,10 +99,10 @@ class JCheckBoxFlag extends JCheckBox {
@Override
public void itemStateChanged(ItemEvent evt) {
if (evt.getStateChange() == evt.SELECTED) {
if (evt.getStateChange() == ItemEvent.SELECTED) {
JCheckBoxFlag.this.flag = true;
}
if (evt.getStateChange() == evt.DESELECTED) {
if (evt.getStateChange() == ItemEvent.DESELECTED) {
JCheckBoxFlag.this.flag = false;
}
}
@@ -30,6 +30,6 @@ public class PropertyWeightedLPTchebycheff implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new PropertyWeightedLPTchebycheff(this);
return new PropertyWeightedLPTchebycheff(this);
}
}
-2
View File
@@ -6,8 +6,6 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyEditor;
+1 -1
View File
@@ -44,7 +44,7 @@ public class EnumEditor extends PropertyEditorSupport {
public void setAsText(String text) throws IllegalArgumentException {
for (int i = 0; i < enumConstants.length; i++) {
if (text.equals(enumConstants[i].toString())) {
setValue((Enum) enumConstants[i]);
setValue(enumConstants[i]);
return;
}
}
+2 -2
View File
@@ -27,13 +27,13 @@ public class GenericAreaEditor extends AbstractListSelectionEditor {
@Override
protected String getElementName(int i) {
AbstractGPNode an = (AbstractGPNode) areaObject.getCompleteList().get(i);
AbstractGPNode an = areaObject.getCompleteList().get(i);
return an.getName();
}
@Override
protected boolean isElementSelected(int i) {
return ((Boolean) areaObject.getBlackList().get(i)).booleanValue();
return areaObject.getBlackList().get(i).booleanValue();
}
@Override
+2 -2
View File
@@ -352,7 +352,6 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
ListCellRenderer lcr = new DefaultListCellRenderer();
if (editor != null) {
if (editor instanceof GenericObjectEditor) {
// ((GenericObjectEditor) editor).getCustomEditor();
((GenericObjectEditor) editor).setClassType(elementClass);
}
if (editor.isPaintable() && editor.supportsCustomEditor()) {
@@ -416,6 +415,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
// Upper Button Panel
JPanel combiUpperPanel = new JPanel(getButtonLayout(1, upperButtonList));
// ToDo Figure out how to now show this on Job Pane
combiUpperPanel.add(view);
for (JButton but : upperButtonList) {
@@ -692,7 +692,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
rep = listModel.getSize() + " of " + EVAHELP.cutClassName(elementClass.getName());
Object maybeName = BeanInspector.callIfAvailable(listModel.get(0), "getName", new Object[]{});
if (maybeName != null) {
rep = rep + " (" + (String) maybeName + "...)";
rep = rep + " (" + maybeName + "...)";
}
}
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
@@ -40,8 +40,7 @@ class MyFocusListener implements FocusListener {
arrEditor.notifyFocusID(myID);
}
;
};
}
/**
+2 -2
View File
@@ -79,7 +79,7 @@ public class GenericObjectEditor implements PropertyEditor {
try {
// a field allowing a class to indicate it doesnt want to be displayed
Field f = clazz.getDeclaredField("hideFromGOE");
if (f.getBoolean(clazz) == true) {
if (f.getBoolean(clazz)) {
LOGGER.log(Level.FINEST, "Class {0} wants to be hidden from GOE.", clazz);
continue;
}
@@ -275,7 +275,7 @@ public class GenericObjectEditor implements PropertyEditor {
try {
if (v.size() > 0) {
setObject((Object) Class.forName((String) v.get(0)).newInstance());
setObject(Class.forName((String) v.get(0)).newInstance());
}
} catch (Exception ex) {
System.err.println("Exception in setDefaultValue !!!" + ex.getMessage());
+3 -3
View File
@@ -167,7 +167,7 @@ public class DPointSetMultiIcon extends DComponent {
} else {
DPoint result = new DPoint(xMI.getImage(minIndex),
yMI.getImage(minIndex));
result.setIcon((DPointIcon) this.iconsMI.get(minIndex));
result.setIcon(this.iconsMI.get(minIndex));
return result;
}
@@ -256,7 +256,7 @@ public class DPointSetMultiIcon extends DComponent {
if ((i < this.iconsMI.size()) && (this.iconsMI.get(i) != null)) {
g.setStroke(new BasicStroke());
g.translate(p2.x, p2.y);
((DPointIcon) this.iconsMI.get(i)).paint(g);
this.iconsMI.get(i).paint(g);
g.translate(-p2.x, -p2.y);
g.setStroke(strokeMI);
} else {
@@ -287,7 +287,7 @@ public class DPointSetMultiIcon extends DComponent {
if (this.iconsMI.get(i) != null) {
g.setStroke(new BasicStroke());
g.translate(p.x, p.y);
((DPointIcon) this.iconsMI.get(i)).paint(g);
this.iconsMI.get(i).paint(g);
g.translate(-p.x, -p.y);
g.setStroke(strokeMI);
} else {
+16 -16
View File
@@ -122,7 +122,7 @@ public class FunctionArea extends DArea implements Serializable {
if (isShowGraphToolTips()) {
int gIndex = getNearestGraphIndex(event.getX(), event.getY());
if (gIndex >= 0) {
DPoint pt = ((GraphPointSet) (pointSetContainer.get(gIndex))).getMedPoint();
DPoint pt = pointSetContainer.get(gIndex).getMedPoint();
Point pt2 = getDMeasures().getPoint(pt.x, pt.y);
pt2.x += (5 * (gIndex % 7)); // slight shift depending on index
// - easier distinction of very
@@ -395,7 +395,7 @@ public class FunctionArea extends DArea implements Serializable {
if (index == -1) {
return;
}
int GraphLabel = ((GraphPointSet) (this.pointSetContainer.get(index))).getGraphLabel();
int GraphLabel = this.pointSetContainer.get(index).getGraphLabel();
changeColorGraph(GraphLabel);
updateLegend();
}
@@ -406,7 +406,7 @@ public class FunctionArea extends DArea implements Serializable {
public void recolorAllGraphsByIndex() {
int index = 0;
for (int i = 0; i < pointSetContainer.size(); i++) {
GraphPointSet gps = ((GraphPointSet) (this.pointSetContainer.get(i)));
GraphPointSet gps = this.pointSetContainer.get(i);
if (gps.getPointCount() > 0) {
gps.setColorByIndex(index);
index++;
@@ -466,7 +466,7 @@ public class FunctionArea extends DArea implements Serializable {
public void clearAll() {
this.removeAllDElements();
for (int i = 0; i < pointSetContainer.size(); i++) {
((GraphPointSet) (pointSetContainer.get(i))).removeAllPoints();
pointSetContainer.get(i).removeAllPoints();
}
pointSetContainer.clear();
if (getYScale() instanceof Exp) {
@@ -496,7 +496,7 @@ public class FunctionArea extends DArea implements Serializable {
if (index == -1) {
return;
}
int GraphLabel = ((GraphPointSet) (this.pointSetContainer.get(index))).getGraphLabel();
int GraphLabel = this.pointSetContainer.get(index).getGraphLabel();
clearGraph(GraphLabel);
updateLegend();
}
@@ -658,7 +658,7 @@ public class FunctionArea extends DArea implements Serializable {
}
for (int i = 0; i < pointSetContainer.size(); i++) {
if (pointSetContainer.get(i) instanceof GraphPointSet) {
GraphPointSet set = (GraphPointSet) pointSetContainer.get(i);
GraphPointSet set = pointSetContainer.get(i);
DPointSet pset = set.getConnectedPointSet();
// add column names
s[0] = s[0] + " t " + cleanBlanks(set.getInfoString(), '_');
@@ -737,7 +737,7 @@ public class FunctionArea extends DArea implements Serializable {
}
int minindex = getNearestGraphIndex(x, y);
if (minindex >= 0) {
return ((GraphPointSet) (pointSetContainer.get(minindex))).getInfoString();
return pointSetContainer.get(minindex).getInfoString();
} else {
return "none";
}
@@ -750,7 +750,7 @@ public class FunctionArea extends DArea implements Serializable {
}
if (graphIndex >= 0 && (graphIndex < pointSetContainer.size())) {
return ((GraphPointSet) (pointSetContainer.get(graphIndex))).getInfoString();
return pointSetContainer.get(graphIndex).getInfoString();
} else {
return "none";
}
@@ -771,7 +771,7 @@ public class FunctionArea extends DArea implements Serializable {
private GraphPointSet getGraphPointSet(int GraphLabel) {
for (int i = 0; i < pointSetContainer.size(); i++) {
if (pointSetContainer.get(i) instanceof GraphPointSet) {
GraphPointSet xx = (GraphPointSet) (pointSetContainer.get(i));
GraphPointSet xx = pointSetContainer.get(i);
// System.out.println("looking at "+xx.getGraphLabel());
if (xx.getGraphLabel() == GraphLabel) {
// System.out.println("match!");
@@ -799,7 +799,7 @@ public class FunctionArea extends DArea implements Serializable {
double dist = 0;
for (int i = 0; i < pointSetContainer.size(); i++) {
if (pointSetContainer.get(i) instanceof GraphPointSet) {
GraphPointSet pointset = (GraphPointSet) (pointSetContainer.get(i));
GraphPointSet pointset = pointSetContainer.get(i);
point2 = pointset.getNearestDPoint(point1);
if (point2 == null) {
continue;
@@ -883,7 +883,7 @@ public class FunctionArea extends DArea implements Serializable {
return ret;
}
int minindex = getNearestGraphIndex(x, y);
ret = ((GraphPointSet) (pointSetContainer.get(minindex))).isStatisticsGraph();
ret = pointSetContainer.get(minindex).isStatisticsGraph();
return ret;
}
@@ -893,7 +893,7 @@ public class FunctionArea extends DArea implements Serializable {
*/
public void jump() {
for (int i = 0; i < pointSetContainer.size(); i++) {
((GraphPointSet) (pointSetContainer.get(i))).jump();
pointSetContainer.get(i).jump();
}
}
@@ -914,7 +914,7 @@ public class FunctionArea extends DArea implements Serializable {
System.out.println("");
System.out.println("GraphPointSet No " + i);
ret[i] = ((GraphPointSet) pointSetContainer.get(i)).printPoints();
ret[i] = pointSetContainer.get(i).printPoints();
}
return ret;
@@ -928,7 +928,7 @@ public class FunctionArea extends DArea implements Serializable {
System.out.println("");
System.out.println("GraphPointSet No " + i);
return ((GraphPointSet) pointSetContainer.get(i)).printPoints();
return pointSetContainer.get(i).printPoints();
// }
}
@@ -942,7 +942,7 @@ public class FunctionArea extends DArea implements Serializable {
if (index == -1 || point == null) {
return;
}
GraphPointSet pointset = (GraphPointSet) (this.pointSetContainer.get(index));
GraphPointSet pointset = this.pointSetContainer.get(index);
pointset.removePoint(point);
}
@@ -1080,7 +1080,7 @@ public class FunctionArea extends DArea implements Serializable {
}
if (graphIndex >= 0 && (graphIndex < pointSetContainer.size())) {
GraphPointSet gps = ((GraphPointSet) (pointSetContainer.get(graphIndex)));
GraphPointSet gps = pointSetContainer.get(graphIndex);
gps.setInfoString(newName);
updateLegend();
return true;
+1 -1
View File
@@ -194,7 +194,7 @@ public class GraphPointSet {
int[] index = new int[pointSetContainer.size()];
int[] GraphSize = new int[pointSetContainer.size()];
for (int i = 0; i < pointSetContainer.size(); i++) {
GraphSize[i] = ((PointSet) pointSetContainer.get(i)).getSize();
GraphSize[i] = pointSetContainer.get(i).getSize();
if (GraphSize[i] <= 0) {
System.err.println("Warning: invalid graph size of "
+ GraphSize[i] + " at " + i
+2 -2
View File
@@ -97,7 +97,7 @@ class PlotContainer extends ArrayList<GraphWindow> {
public boolean containsName(String name) {
GraphWindow temp;
for (int i = 0; i < size(); i++) {
temp = (GraphWindow) (get(i));
temp = get(i);
if (name.equals(temp.getName())) {
return true;
}
@@ -123,7 +123,7 @@ class PlotContainer extends ArrayList<GraphWindow> {
}
GraphWindow temp;
for (int i = 0; i < size(); i++) {
temp = (GraphWindow) (get(i));
temp = get(i);
if (name.equals(temp.getName())) {
actualPlot = temp;
return actualPlot;
+2 -2
View File
@@ -69,7 +69,7 @@ public class ModuleServer {
Method[] methods = module.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals("getName")) {
String name = (String) method.invoke((Object[]) null, (Object[]) null);
String name = (String) method.invoke(null, (Object[]) null);
if (name != null) {
moduleNameList.add(name);
} else {
@@ -107,7 +107,7 @@ public class ModuleServer {
for (Method method : methods) {
if (method.getName().equals("getName")) {
moduleName = (String) method.invoke((Object[]) null, (Object[]) null);
moduleName = (String) method.invoke(null, (Object[]) null);
}
}
} catch (Exception ex) {
@@ -1,5 +1,5 @@
package eva2.optimization.enums;
public enum ESMutationInitialSigma {
halfRange, quarterRange, avgInitialDistance, userDefined;
halfRange, quarterRange, avgInitialDistance, userDefined
}
@@ -1,5 +1,5 @@
package eva2.optimization.enums;
public enum MutateESCrossoverTypeEnum {
none, intermediate, discrete;
none, intermediate, discrete
}
@@ -1,5 +1,5 @@
package eva2.optimization.enums;
public enum PostProcessMethod {
hillClimber, nelderMead, cmaES;
hillClimber, nelderMead, cmaES
}
@@ -575,7 +575,7 @@ public class MOCCOStandalone implements InterfaceStandaloneOptimization, Interfa
double y = x / (double) ((EvaluationTerminator) this.state.terminator).getFitnessCalls();
currentProgress = (int) (population.getFunctionCalls() * y);
} else {
currentProgress = (int) (0);
currentProgress = 0;
}
updateStatus("Optimizing...", currentProgress);
} else {
@@ -308,7 +308,7 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
((GAIndividualDoubleData) tmpIndy).setCrossoverOperator(new CrossoverGAGINPoint());
((GAIndividualDoubleData) tmpIndy).setCrossoverProbability(1.0);
((GAIndividualDoubleData) tmpIndy).setMutationProbability(1.0);
((F1Problem) problem).setEAIndividual(tmpIndy);
problem.setEAIndividual(tmpIndy);
//((FGRNInferringProblem)this.problem).setStructreSkelInterval(1);
this.optimizationParameters.getOptimizer().setProblem(problem);
this.optimizationParameters.getOptimizer().addPopulationChangedEventListener(this);
@@ -324,7 +324,7 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
F1Problem problem = new F1Problem();
tmpIndy = new ESIndividualDoubleData();
((AbstractEAIndividual) tmpIndy).setMutationOperator(new MutateESLocal());
((F1Problem) problem).setEAIndividual(tmpIndy);
problem.setEAIndividual(tmpIndy);
//((FGRNInferringProblem)this.problem).setUseHEigenMatrix(true);
//((FGRNInferringProblem)this.problem).setUseOnlyPositiveNumbers(true);
this.optimizationParameters.getOptimizer().setProblem(problem);
@@ -60,12 +60,12 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new ESIndividualBinaryData(this);
return new ESIndividualBinaryData(this);
}
/**
@@ -61,12 +61,12 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new ESIndividualDoubleData(this);
return new ESIndividualDoubleData(this);
}
/**
@@ -56,12 +56,12 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new ESIndividualIntegerData(this);
return new ESIndividualIntegerData(this);
}
/**
@@ -72,13 +72,13 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new ESIndividualPermutationData(this);
return new ESIndividualPermutationData(this);
}
/**
@@ -43,12 +43,12 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GAESIndividualBinaryDoubleData(this);
return new GAESIndividualBinaryDoubleData(this);
}
/**
@@ -58,12 +58,12 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GAIndividualBinaryData(this);
return new GAIndividualBinaryData(this);
}
/**
@@ -68,12 +68,12 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GAIndividualDoubleData(this);
return new GAIndividualDoubleData(this);
}
/**
@@ -67,12 +67,12 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GAIndividualIntegerData(this);
return new GAIndividualIntegerData(this);
}
@@ -40,12 +40,12 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GAPIndividualProgramData(this);
return new GAPIndividualProgramData(this);
}
/**
@@ -104,12 +104,12 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GEIndividualProgramData(this);
return new GEIndividualProgramData(this);
}
/**
@@ -66,12 +66,12 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GIIndividualIntegerData(this);
return new GIIndividualIntegerData(this);
}
@@ -40,12 +40,12 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GIOBGAIndividualIntegerPermutationData(this);
return new GIOBGAIndividualIntegerPermutationData(this);
}
/**
@@ -75,12 +75,12 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.fitness.length; i++) {
this.fitness[i] = individual.fitness[i];
}
cloneAEAObjects((AbstractEAIndividual) individual);
cloneAEAObjects(individual);
}
@Override
public Object clone() {
return (Object) new GPIndividualProgramData(this);
return new GPIndividualProgramData(this);
}
/**
@@ -328,11 +328,11 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} else {
AbstractGPNode parent = nodeToMutate.getParent();
if (checkMaxDepth && (nodeToMutate.getDepth() == maxAllowedDepth)) { // mutate with a constant
AbstractGPNode newNode = (AbstractGPNode) (((AbstractGPNode) this.gpArea[i].getRandomNodeWithArity(0).clone()));
AbstractGPNode newNode = ((AbstractGPNode) this.gpArea[i].getRandomNodeWithArity(0).clone());
newNode.setDepth(nodeToMutate.getDepth());
parent.setNode(newNode, nodeToMutate);
} else {
AbstractGPNode newNode = (AbstractGPNode) (((AbstractGPNode) this.gpArea[i].getRandomNode().clone()));
AbstractGPNode newNode = ((AbstractGPNode) this.gpArea[i].getRandomNode().clone());
newNode.setDepth(nodeToMutate.getDepth());
newNode.initGrow(this.gpArea[i], this.maxAllowedDepth);
parent.setNode(newNode, nodeToMutate);
@@ -592,19 +592,7 @@ public abstract class AbstractGPNode implements InterfaceProgram, java.io.Serial
* @return True if MaxDepth is violated
*/
public boolean isMaxDepthViolated(int maxDepth) {
if (maxDepth < this.getMaxDepth()) {
return true;
} else {
return false;
}
// if (depth > this.depth) return false;
// else {
// boolean result = true;
// for (int i = 0; i < this.nodes.length; i++) {
// result = result & this.nodes[i].isMaxDepthViolated(depth);
// }
// return result;
// }
return maxDepth < this.getMaxDepth();
}
/**
@@ -126,7 +126,7 @@ public class GPArea implements java.io.Serializable {
public void compileReducedList() {
this.reducedList = new ArrayList<AbstractGPNode>();
for (int i = 0; i < this.completeList.size(); i++) {
if (((Boolean) (this.blackList.get(i))).booleanValue()) {
if (this.blackList.get(i).booleanValue()) {
this.reducedList.add(this.completeList.get(i));
}
}
@@ -141,14 +141,14 @@ public class GPArea implements java.io.Serializable {
public AbstractGPNode getRandomNodeWithArity(int targetarity) {
ArrayList<AbstractGPNode> tmpArray = new ArrayList<AbstractGPNode>();
for (int i = 0; i < this.reducedList.size(); i++) {
if (((AbstractGPNode) this.reducedList.get(i)).getArity() == targetarity) {
if (this.reducedList.get(i).getArity() == targetarity) {
tmpArray.add(this.reducedList.get(i));
}
}
if (tmpArray.size() == 0) {
return null;
} else {
return (AbstractGPNode) tmpArray.get(RNG.randomInt(0, tmpArray.size() - 1));
return tmpArray.get(RNG.randomInt(0, tmpArray.size() - 1));
}
}
@@ -159,7 +159,7 @@ public class GPArea implements java.io.Serializable {
if (this.reducedList.size() == 0) {
return null;
} else {
return (AbstractGPNode) this.reducedList.get(RNG.randomInt(0, this.reducedList.size() - 1));
return this.reducedList.get(RNG.randomInt(0, this.reducedList.size() - 1));
}
}
@@ -169,14 +169,14 @@ public class GPArea implements java.io.Serializable {
public AbstractGPNode getRandomNonTerminal() {
ArrayList<AbstractGPNode> tmpArray = new ArrayList<AbstractGPNode>();
for (int i = 0; i < this.reducedList.size(); i++) {
if (((AbstractGPNode) this.reducedList.get(i)).getArity() > 0) {
if (this.reducedList.get(i).getArity() > 0) {
tmpArray.add(this.reducedList.get(i));
}
}
if (tmpArray.size() == 0) {
return null;
} else {
return (AbstractGPNode) tmpArray.get(RNG.randomInt(0, tmpArray.size() - 1));
return tmpArray.get(RNG.randomInt(0, tmpArray.size() - 1));
}
}
@@ -32,7 +32,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeAbs(this);
return new GPNodeAbs(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeAdd(this);
return new GPNodeAdd(this);
}
/**
@@ -36,7 +36,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeCos(this);
return new GPNodeCos(this);
}
/**
@@ -38,7 +38,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeDiv(this);
return new GPNodeDiv(this);
}
/**
@@ -36,7 +36,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeExp(this);
return new GPNodeExp(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa
*/
@Override
public Object clone() {
return (Object) new GPNodeFlowExec2(this);
return new GPNodeFlowExec2(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeFlowExec3 extends AbstractGPNode implements java.io.Serializa
*/
@Override
public Object clone() {
return (Object) new GPNodeFlowExec3(this);
return new GPNodeFlowExec3(this);
}
/**
@@ -38,10 +38,7 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable
public boolean equals(Object obj) {
if (obj instanceof GPNodeInput) {
GPNodeInput node = (GPNodeInput) obj;
if (!this.identifier.equalsIgnoreCase(node.identifier)) {
return false;
}
return true;
return this.identifier.equalsIgnoreCase(node.identifier);
} else {
return false;
}
@@ -64,7 +61,7 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable
*/
@Override
public Object clone() {
return (Object) new GPNodeInput(this);
return new GPNodeInput(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeMult extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeMult(this);
return new GPNodeMult(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeNeg extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeNeg(this);
return new GPNodeNeg(this);
}
/**
@@ -20,6 +20,6 @@ public class GPNodeOne extends GPNodeConst implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeOne(this);
return new GPNodeOne(this);
}
}
@@ -39,10 +39,7 @@ public class GPNodeOutput extends AbstractGPNode implements java.io.Serializable
public boolean equals(Object obj) {
if (obj instanceof GPNodeOutput) {
GPNodeOutput node = (GPNodeOutput) obj;
if (!this.identifier.equalsIgnoreCase(node.identifier)) {
return false;
}
return true;
return this.identifier.equalsIgnoreCase(node.identifier);
} else {
return false;
}
@@ -65,7 +62,7 @@ public class GPNodeOutput extends AbstractGPNode implements java.io.Serializable
*/
@Override
public Object clone() {
return (Object) new GPNodeOutput(this);
return new GPNodeOutput(this);
}
/**
@@ -20,7 +20,7 @@ public class GPNodePi extends GPNodeConst implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodePi(this);
return new GPNodePi(this);
}
/**
@@ -36,7 +36,7 @@ public class GPNodePow2 extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodePow2(this);
return new GPNodePow2(this);
}
/**
@@ -36,7 +36,7 @@ public class GPNodePow3 extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodePow3(this);
return new GPNodePow3(this);
}
/**
@@ -28,7 +28,7 @@ public class GPNodeProd extends AbstractGPNode implements java.io.Serializable {
@Override
public Object clone() {
return (Object) new GPNodeProd(this);
return new GPNodeProd(this);
}
@Override
@@ -36,7 +36,7 @@ public class GPNodeSin extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeSin(this);
return new GPNodeSin(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeSqrt extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeSqrt(this);
return new GPNodeSqrt(this);
}
/**
@@ -37,7 +37,7 @@ public class GPNodeSub extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeSub(this);
return new GPNodeSub(this);
}
/**
@@ -33,7 +33,7 @@ public class GPNodeSum extends AbstractGPNode implements java.io.Serializable {
*/
@Override
public Object clone() {
return (Object) new GPNodeSum(this);
return new GPNodeSum(this);
}
/**
@@ -97,7 +97,7 @@ public class MOCCOProblemInitialization extends MOCCOPhase implements InterfaceP
mocco.parameterPanel.removeAll();
Object n = null;
try {
n = (Object) Class.forName(className).newInstance();
n = Class.forName(className).newInstance();
} catch (Exception ex) {
}
mocco.state.originalProblem = (InterfaceOptimizationProblem) n;
@@ -90,11 +90,11 @@ public class DEParameters extends AbstractOptimizationParameters implements Inte
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((DifferentialEvolution) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((DifferentialEvolution) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -95,11 +95,11 @@ public class EPParameters extends AbstractOptimizationParameters implements Inte
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((EvolutionaryProgramming) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((EvolutionaryProgramming) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -93,11 +93,11 @@ public class GAParameters extends AbstractOptimizationParameters implements Inte
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((GeneticAlgorithm) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((GeneticAlgorithm) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -83,7 +83,7 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
}
EvATabbedFrameMaker frmMkr = new EvATabbedFrameMaker();
InterfaceStatisticsParameter Stat = ((StatisticsWithGUI) statisticsModule).getStatisticsParameter();
InterfaceStatisticsParameter Stat = statisticsModule.getStatisticsParameter();
EvAModuleButtonPanelMaker ButtonPanel = new EvAModuleButtonPanelMaker(remoteModuleAdapter, ((Processor) processor).isOptimizationRunning());
ButtonPanel.setHelperFilename(helperFilename);
frmMkr.addPanelMaker(ButtonPanel);
@@ -110,7 +110,7 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
public void performedStart(String infoString) {
super.performedStart(infoString);
OptimizationJob job = scheduleJob();
((AbstractStatistics) (((Processor) processor).getStatistics())).addDataListener(job);
((Processor) processor).getStatistics().addDataListener(job);
}
@Override
@@ -90,11 +90,11 @@ public class HCParameters extends AbstractOptimizationParameters implements Inte
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((HillClimbing) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((HillClimbing) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -86,11 +86,11 @@ public class MCParameters extends AbstractOptimizationParameters implements Inte
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((MonteCarloSearch) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((MonteCarloSearch) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -76,11 +76,11 @@ public class MOEAParameters extends AbstractOptimizationParameters implements In
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((MultiObjectiveEA) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((MultiObjectiveEA) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -146,21 +146,21 @@ public class MOEAParameters extends AbstractOptimizationParameters implements In
* @return The current optimizing method
*/
public int getArchiveSize() {
Population archive = ((MultiObjectiveEA) this.optimizer).getPopulation().getArchive();
Population archive = this.optimizer.getPopulation().getArchive();
if (archive == null) {
archive = new Population();
((MultiObjectiveEA) this.optimizer).getPopulation().SetArchive(archive);
this.optimizer.getPopulation().SetArchive(archive);
}
return ((MultiObjectiveEA) this.optimizer).getArchiveSize();
}
public void setArchiveSize(int b) {
Population archive = ((MultiObjectiveEA) this.optimizer).getPopulation().getArchive();
Population archive = this.optimizer.getPopulation().getArchive();
if (archive == null) {
archive = new Population();
((MultiObjectiveEA) this.optimizer).getPopulation().SetArchive(archive);
this.optimizer.getPopulation().SetArchive(archive);
}
((MultiObjectiveEA) this.optimizer).getPopulation().getArchive().setTargetSize(b);
this.optimizer.getPopulation().getArchive().setTargetSize(b);
}
public String archiveSizeTipText() {
@@ -81,11 +81,11 @@ public class PBILParameters extends AbstractOptimizationParameters implements In
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((PopulationBasedIncrementalLearning) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((PopulationBasedIncrementalLearning) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -81,11 +81,11 @@ public class PSOParameters extends AbstractOptimizationParameters implements Int
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((ParticleSwarmOptimization) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((ParticleSwarmOptimization) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
+6 -6
View File
@@ -303,8 +303,8 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
// is called recursively.
if (controllerOrSubControllable instanceof InterfaceParameterControl) {
args[0] = instance;
if (!((InterfaceParameterControl) controllerOrSubControllable instanceof ConstantParameters)) {
BeanInspector.callIfAvailable((InterfaceParameterControl) controllerOrSubControllable, methodName, args);
if (!(controllerOrSubControllable instanceof ConstantParameters)) {
BeanInspector.callIfAvailable(controllerOrSubControllable, methodName, args);
}
} else {
args[0] = controllerOrSubControllable;
@@ -312,8 +312,8 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
}
}
} else if (paramCtrlReturn instanceof InterfaceParameterControl) {
if (!((InterfaceParameterControl) paramCtrlReturn instanceof ConstantParameters)) {
BeanInspector.callIfAvailable((InterfaceParameterControl) paramCtrlReturn, methodName, args);
if (!(paramCtrlReturn instanceof ConstantParameters)) {
BeanInspector.callIfAvailable(paramCtrlReturn, methodName, args);
}
}
}
@@ -384,7 +384,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
public void registerPopulationStateChanged(Object source, String name) {
if (name.equals(Population.NEXT_GENERATION_PERFORMED)) {
statistics.createNextGenerationPerformed(
(PopulationInterface) this.optimizationParameters.getOptimizer().getPopulation(),
this.optimizationParameters.getOptimizer().getPopulation(),
this.optimizationParameters.getOptimizer(),
getInformerList());
if (optimizationStateListener != null) {
@@ -474,7 +474,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
}
PostProcess.checkAccuracy((AbstractOptimizationProblem) optimizationParameters.getProblem(), resultPop, ppp.getAccuracies(), ppp.getAccAssumeConv(),
-1, ppp.getAccMaxEval(), (SolutionHistogram[]) null, true, listener);
-1, ppp.getAccMaxEval(), null, true, listener);
resultPop = PostProcess.postProcess(ppp, resultPop, (AbstractOptimizationProblem) optimizationParameters.getProblem(), listener);
resultPopulation = resultPop;
@@ -83,11 +83,11 @@ public class SAParameters extends AbstractOptimizationParameters implements Seri
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((SimulatedAnnealing) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((SimulatedAnnealing) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -84,11 +84,11 @@ public class SSGAParameters extends AbstractOptimizationParameters implements In
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return ((SteadyStateGA) this.optimizer).getPopulation();
return this.optimizer.getPopulation();
}
public void setPopulation(Population pop) {
((SteadyStateGA) this.optimizer).setPopulation(pop);
this.optimizer.setPopulation(pop);
}
public String populationTipText() {
@@ -68,11 +68,7 @@ public abstract class AbstractArchiving implements InterfaceArchiving, java.io.S
tmpFitness = ((AbstractEAIndividual) archive.get(i)).getFitness();
try {
for (int j = 0; j < indyFitness.length; j++) {
if (indyFitness[j] <= tmpFitness[j]) {
isDominating &= true;
} else {
isDominating &= false;
}
isDominating &= indyFitness[j] <= tmpFitness[j];
}
} catch (java.lang.ArrayIndexOutOfBoundsException e) {
//System.out.println("-------addIndividualToArchive-------("+indyFitness.length+"/"+tmpFitness.length+")");
@@ -20,7 +20,7 @@ public class ArchivingAllDominating extends AbstractArchiving implements java.io
@Override
public Object clone() {
return (Object) new ArchivingAllDominating(this);
return new ArchivingAllDominating(this);
}
/**
@@ -35,7 +35,7 @@ public class ArchivingMaxiMin implements InterfaceArchiving, java.io.Serializabl
@Override
public Object clone() {
return (Object) new ArchivingMaxiMin(this);
return new ArchivingMaxiMin(this);
}
/**
@@ -20,7 +20,7 @@ public class ArchivingNSGA extends AbstractArchiving implements java.io.Serializ
@Override
public Object clone() {
return (Object) new ArchivingNSGA(this);
return new ArchivingNSGA(this);
}
/**
@@ -26,7 +26,7 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab
@Override
public Object clone() {
return (Object) new ArchivingNSGAII(this);
return new ArchivingNSGAII(this);
}
/**
@@ -28,7 +28,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
@Override
public Object clone() {
return (Object) new ArchivingPESAII(this);
return new ArchivingPESAII(this);
}
/**
@@ -29,7 +29,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
@Override
public Object clone() {
return (Object) new ArchivingSPEAII(this);
return new ArchivingSPEAII(this);
}
/**
@@ -17,7 +17,7 @@ public class InformationRetrievalInserting implements InterfaceInformationRetrie
@Override
public Object clone() {
return (Object) new InformationRetrievalInserting(this);
return new InformationRetrievalInserting(this);
}
/**
@@ -21,7 +21,7 @@ public class InformationRetrievalNone implements InterfaceInformationRetrieval,
@Override
public Object clone() {
return (Object) new InformationRetrievalNone(this);
return new InformationRetrievalNone(this);
}
/**
@@ -17,7 +17,7 @@ public class InformationRetrievalReplacing implements InterfaceInformationRetrie
@Override
public Object clone() {
return (Object) new InformationRetrievalReplacing(this);
return new InformationRetrievalReplacing(this);
}
/**
@@ -21,7 +21,7 @@ public class RemoveSurplusIndividualsDynamicHyperCube implements InterfaceRemove
@Override
public Object clone() {
return (Object) new RemoveSurplusIndividualsDynamicHyperCube(this);
return new RemoveSurplusIndividualsDynamicHyperCube(this);
}
/**
@@ -21,7 +21,7 @@ public class RemoveSurplusIndividualsSMetric implements InterfaceRemoveSurplusIn
@Override
public Object clone() {
return (Object) new RemoveSurplusIndividualsSMetric(this);
return new RemoveSurplusIndividualsSMetric(this);
}
/**
Loaded 100 of 348 files, more files were not shown because too many files have changed in this diff. Show more