Minor cosmetics.

This commit is contained in:
Marcel Kronfeld 2008-09-12 10:14:28 +00:00
parent bcdc7d254e
commit 3f31f5d396
7 changed files with 37 additions and 16 deletions

View File

@ -11,6 +11,8 @@ package eva2;
* requires much time for transcoding, however, this is not useful by itself. Yet it could be
* interesting for combined individuals composed of two data types.
* Cleaned up MutateXXDefault to a single MutateDefault, too. DE may now do range checking.
* The "Description" button has made space for a "Show Solution" button. The Rank-Mu-CMA was improved
* to use a CMAParameterSet which is associated with populations and not static any more.
* 2.029: Tuned the 2d-graphs which now paints quicker and changes size depending on the
* surrounding plot window. Added a preloader-thread to accelerate the GUI at starting time.
* 2.028: Tuned the Population to sort only when necessary on calls to getBestN... Added StatisticsDummy.

View File

@ -116,7 +116,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
System.gc();
}
});
newFrame.getContentPane().add(this.m_Problem.drawIndividual(this.m_Indy));
newFrame.getContentPane().add(this.m_Problem.drawIndividual(-1, -1, this.m_Indy));
newFrame.setSize(200, 300);
newFrame.pack();
newFrame.validate();

View File

@ -79,7 +79,7 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo
System.gc();
}
});
newFrame.getContentPane().add(this.m_Problem.drawIndividual(this.m_Indy));
newFrame.getContentPane().add(this.m_Problem.drawIndividual(-1, -1, this.m_Indy));
newFrame.setSize(200, 300);
newFrame.pack();
newFrame.validate();

View File

@ -13,28 +13,26 @@ package eva2.gui;
/*==========================================================================*
* IMPORTS
*==========================================================================*/
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.net.InetAddress;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import wsi.ra.jproxy.RMIProxyLocal;
import wsi.ra.jproxy.RemoteStateListener;
import eva2.server.go.InterfaceGOParameters;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.problems.AbstractOptimizationProblem;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.server.go.strategies.InterfaceOptimizer;
import eva2.server.modules.AbstractModuleAdapter;
import eva2.server.modules.ModuleAdapter;
import wsi.ra.jproxy.RMIProxyLocal;
import wsi.ra.jproxy.RemoteStateListener;
/*==========================================================================*
* CLASS DECLARATION
*==========================================================================*/
@ -166,7 +164,8 @@ public class JModuleGeneralPanel implements RemoteStateListener, Serializable {
frame.setTitle("The current best solution for "+goProblem.getName());
frame.setSize(400, 300);
frame.setLocation(450, 250);
frame.getContentPane().add(goProblem.drawIndividual(indy));
Population pop = opt.getPopulation();
frame.getContentPane().add(goProblem.drawIndividual(pop.getGeneration(), pop.getFunctionCalls(), indy));
frame.validate();
frame.setVisible(true);
} else System.out.println("No current solution available.");

View File

@ -282,7 +282,8 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
frame.setTitle("The current best solution for "+m_GO.getProblem().getName());
frame.setSize(400, 300);
frame.setLocation(450, 250);
frame.getContentPane().add(m_GO.getProblem().drawIndividual(m_GO.getOptimizer().getPopulation().getBestEAIndividual()));
Population pop = m_GO.getOptimizer().getPopulation();
frame.getContentPane().add(m_GO.getProblem().drawIndividual(pop.getGeneration(), pop.getFunctionCalls(), pop.getBestEAIndividual()));
frame.validate();
frame.setVisible(true);
}

View File

@ -121,16 +121,35 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
return AbstractEAIndividual.getDefaultDataString(pop.getBestIndividual());
}
/** This method allows you to request a graphical represenation for a given
* individual.
* @return JComponent
/**
* Convenience method, draws with undefined generation and function evaluation count.
*
* @see #drawIndividual(int, int, AbstractEAIndividual)
* @param indy
* @return
*/
public JComponent drawIndividual(AbstractEAIndividual indy) {
return drawIndividual(-1, -1, indy);
}
/**
* This method allows you to request a graphical represenation for a given individual.
* The additional informations generation and funCalls are shown if they are >= 0.
* individual.
* @param generation generation of the individual or -1
* @param funCalls function calls performed or -1
* @param indy the individual to display
* @return JComponent
*/
public JComponent drawIndividual(int generation, int funCalls, AbstractEAIndividual indy) {
JPanel result = new JPanel();
result.setLayout(new BorderLayout());
JTextArea area = new JTextArea();
JScrollPane scroll = new JScrollPane(area);
String text = "Best Solution:\n"+this.getSolutionRepresentationFor(indy);
String text = "Best Solution:\n";
if (generation >= 0) text+=" Generation: " + generation + "\n";
if (funCalls >= 0) text+=" Evaluations: " + funCalls + "\n";
text += this.getSolutionRepresentationFor(indy);
area.setLineWrap(true);
area.setText(text);
area.setEditable(false);

View File

@ -72,7 +72,7 @@ public interface InterfaceOptimizationProblem extends InterfaceAdditionalPopulat
/** This method allows you to request a graphical represenation for a given
* individual.
*/
public JComponent drawIndividual(AbstractEAIndividual indy);
public JComponent drawIndividual(int generation, int funCalls, AbstractEAIndividual indy);
/** This method returns a double value that will be displayed in a fitness
* plot. A fitness that is to be minimized with a global min of zero