21import java.awt.BasicStroke;
22import java.awt.BorderLayout;
24import java.awt.Dimension;
25import java.awt.FlowLayout;
27import java.awt.GridLayout;
28import java.awt.event.ActionEvent;
29import java.awt.event.ActionListener;
30import java.util.ArrayList;
31import java.util.HashMap;
33import java.util.concurrent.atomic.AtomicInteger;
35import javax.swing.BoxLayout;
36import javax.swing.ButtonGroup;
37import javax.swing.GroupLayout;
38import javax.swing.JButton;
39import javax.swing.JComboBox;
40import javax.swing.JLabel;
41import javax.swing.JOptionPane;
42import javax.swing.JPanel;
43import javax.swing.JRadioButton;
44import javax.swing.JScrollPane;
45import javax.swing.JSeparator;
46import javax.swing.JSpinner;
47import javax.swing.JTextField;
48import javax.swing.SpinnerNumberModel;
49import javax.swing.SwingConstants;
50import javax.swing.UIManager;
51import javax.swing.event.ChangeEvent;
52import javax.swing.event.ChangeListener;
53import javax.swing.event.DocumentEvent;
54import javax.swing.event.DocumentListener;
55import javax.swing.table.DefaultTableModel;
57import org.jfree.chart.ChartFactory;
58import org.jfree.chart.ChartPanel;
59import org.jfree.chart.JFreeChart;
60import org.jfree.chart.plot.PlotOrientation;
61import org.jfree.chart.plot.XYPlot;
62import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
63import org.jfree.data.xy.DefaultXYDataset;
65import denoptim.ga.EAUtils;
66import denoptim.programs.denovo.GAParameters;
84 public static AtomicInteger
gaFormUID =
new AtomicInteger(1);
121 String
keyPar5 =
"GA-SortByIncreasingFitness";
356 String
NL = System.getProperty(
"line.separator");
362 this.setLayout(
new BorderLayout());
364 block =
new JPanel();
365 JScrollPane scrollablePane =
new JScrollPane(
block);
366 block.setLayout(
new BoxLayout(
block, SwingConstants.VERTICAL));
371 SwingConstants.VERTICAL));
376 SwingConstants.VERTICAL));
381 SwingConstants.VERTICAL));
386 SwingConstants.VERTICAL));
393 SwingConstants.VERTICAL));
398 SwingConstants.VERTICAL));
403 SwingConstants.VERTICAL));
410 SwingConstants.VERTICAL));
415 SwingConstants.VERTICAL));
420 SwingConstants.VERTICAL));
428 SwingConstants.VERTICAL));
430 String toolTipSrcOrNew =
"Tick here to use settings from file.";
431 lineSrcOrNew =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
432 rdbSrcOrNew =
new JRadioButton(
"Use parameters from existing file");
434 rdbSrcOrNew.addActionListener(
new ActionListener(){
435 public void actionPerformed(ActionEvent e){
453 String toolTipGASource =
"<html>Pathname of a DENOPTIM's parameter file with GA settings.</html>";
454 lineGASource =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
455 lblGASource =
new JLabel(
"Use parameters from file:", SwingConstants.LEFT);
461 btnGASource.addActionListener(
new ActionListener() {
462 public void actionPerformed(ActionEvent e) {
468 txtGASource.setToolTipText(
"<html>Specify the file containing the "
469 +
"parameters to be loaded in this form.</html>");
471 public void actionPerformed(ActionEvent e) {
478 if (e1.getMessage().equals(
"") || e1.getMessage() ==
null)
480 e1.printStackTrace();
482 "<html>Exception occurred while importing parameters.<br>Please, report this to the DENOPTIM team.</html>",
484 JOptionPane.ERROR_MESSAGE,
485 UIManager.getIcon(
"OptionPane.errorIcon"));
492 JOptionPane.ERROR_MESSAGE,
493 UIManager.getIcon(
"OptionPane.errorIcon"));
507 String toolTipPar6 =
"Specifies the number of individuals in the population.";
508 linePar6 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
509 lblPar6 =
new JLabel(
"Size of population:", SwingConstants.LEFT);
511 lblPar6.setToolTipText(toolTipPar6);
513 txtPar6.setToolTipText(toolTipPar6);
521 String toolTipPar7 =
"Specifies the number of children to be generated for each generation.";
522 linePar7 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
523 lblPar7 =
new JLabel(
"No. offsprings per generation:", SwingConstants.LEFT);
525 lblPar7.setToolTipText(toolTipPar7);
527 txtPar7.setToolTipText(toolTipPar7);
535 String toolTipPar8 =
"Specifies the maximum number of generation.";
536 linePar8 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
537 lblPar8 =
new JLabel(
"Max. number of generations:", SwingConstants.LEFT);
539 lblPar8.setToolTipText(toolTipPar8);
541 txtPar8.setToolTipText(toolTipPar8);
549 String toolTipPar9 =
"Specifies the convergence criterion as number of subsequent identical generations.";
550 linePar9 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
551 lblPar9 =
new JLabel(
"Max. stagnating generations:", SwingConstants.LEFT);
553 lblPar9.setToolTipText(toolTipPar9);
555 txtPar9.setToolTipText(toolTipPar9);
571 public void actionPerformed(ActionEvent e){
580 rbtMolSzGrowth =
new JRadioButton(
"molecular size (heavy atoms count)");
582 public void actionPerformed(ActionEvent e){
598 String toolTipPar12 =
"<html>Specifies the value of the factor used in"
599 +
" growth probability schemes <code>"
600 + ProbabilityFuncitonShape.EXP_DIFF +
"</code> and "
602 + ProbabilityFuncitonShape.TANH +
"</code></html>";
603 linePar12 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
604 lblPar12 =
new JLabel(
"<html>Graph growth by level - parameter "
605 +
"<code>λ</code><html>", SwingConstants.LEFT);
607 lblPar12.setToolTipText(toolTipPar12);
608 spnPar12 =
new JSpinner(
new SpinnerNumberModel(1.0, 0.0,
null, 0.1));
609 spnPar12.setToolTipText(toolTipPar12);
616 String toolTipPar13 =
"<html>Specifies the value of parameter "
617 +
"σ<sub>1</sub> used for growth probability scheme"
619 + ProbabilityFuncitonShape.SIGMA
620 +
"</code>.<br>It corresponds to the steepness of"
621 +
" the function where <i>P(level) = 50%</i></html>";
622 linePar13 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
623 lblPar13 =
new JLabel(
"<html>Graph growth by level - parameter "
624 +
"<code>σ</code><sub>1</sub>:</html>",
625 SwingConstants.LEFT);
627 lblPar13.setToolTipText(toolTipPar13);
628 spnPar13 =
new JSpinner(
new SpinnerNumberModel(1.0,
null,
null, 0.1));
629 spnPar13.setToolTipText(toolTipPar13);
636 String toolTipPar14 =
"<html>Specifies the value of parameter "
637 +
"σ<sub>2</sub> used in growth probability scheme "
639 + ProbabilityFuncitonShape.SIGMA
640 +
"</code>.<br>It corresponds to the level "
641 +
"where <i>P(level) = 50%</i></html>";
642 linePar14 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
643 lblPar14 =
new JLabel(
"<html>Graph growth by level - parameter "
644 +
"<code>σ</code><sub>2</sub>:<html>",
645 SwingConstants.LEFT);
647 lblPar14.setToolTipText(toolTipPar14);
648 spnPar14 =
new JSpinner(
new SpinnerNumberModel(3.5,
null,
null, 0.1));
649 spnPar14.setToolTipText(toolTipPar14);
656 String toolTipPar11 =
"Specifies the growth probability scheme";
657 linePar11 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
658 lblPar11 =
new JLabel(
"Graph extension probability function:",
659 SwingConstants.LEFT);
661 lblPar11.setToolTipText(toolTipPar11);
662 cmbPar11 =
new JComboBox<ProbabilityFuncitonShape>(
665 cmbPar11.setToolTipText(toolTipPar11);
676 final JSpinner spnMaxLev =
new JSpinner(
new SpinnerNumberModel(
678 spnMaxLev.addChangeListener(
new ChangeListener()
681 public void stateChanged(ChangeEvent event)
683 int maxLev = ((Integer) spnMaxLev.getValue()).intValue();
694 grpLyoSubPrb.setAutoCreateGaps(
true);
695 grpLyoSubPrb.setAutoCreateContainerGaps(
true);
696 grpLyoSubPrb.setHorizontalGroup(grpLyoSubPrb.createSequentialGroup()
699 grpLyoSubPrb.setVerticalGroup(grpLyoSubPrb.createParallelGroup(
700 GroupLayout.Alignment.CENTER)
708 spnPar12.addChangeListener(
new ChangeListener()
710 public void stateChanged(ChangeEvent event)
715 spnPar13.addChangeListener(
new ChangeListener()
717 public void stateChanged(ChangeEvent event)
722 spnPar14.addChangeListener(
new ChangeListener()
724 public void stateChanged(ChangeEvent event)
730 cmbPar11.addActionListener(
new ActionListener(){
731 public void actionPerformed(ActionEvent e){
733 cmbPar11.getSelectedItem().toString()))
772 String toolTipParMolSz2 =
"<html>Specifies the value of the factor used in"
773 +
" molecular growth probability schemes <code>"
774 + ProbabilityFuncitonShape.EXP_DIFF +
"</code> and "
776 + ProbabilityFuncitonShape.TANH +
"</code></html>";
778 lblParMolSz2 =
new JLabel(
"<html>Mol growth probability - parameter "
779 +
"<code>λ</code><html>", SwingConstants.LEFT);
782 spnParMolSz2 =
new JSpinner(
new SpinnerNumberModel(1.0, 0.0,
null, 0.1));
790 String toolTipParMolSz3 =
"<html>Specifies the value of parameter "
791 +
"σ<sub>1</sub> used for molecular growth probability "
794 + ProbabilityFuncitonShape.SIGMA
795 +
"</code>.<br>It corresponds to the steepness of"
796 +
" the function where <i>P(level) = 50%</i></html>";
798 lblParMolSz3 =
new JLabel(
"<html>Mol growth probability - parameter "
799 +
"<code>σ</code><sub>1</sub>:</html>", SwingConstants.LEFT);
802 spnParMolSz3 =
new JSpinner(
new SpinnerNumberModel(0.2,
null,
null, 0.1));
810 String toolTipParMolSz4 =
"<html>Specifies the value of parameter "
811 +
"σ<sub>2</sub> used in molecular growth probability "
814 + ProbabilityFuncitonShape.SIGMA
815 +
"</code>.<br>It corresponds to the level "
816 +
"where <i>P(level) = 50%</i></html>";
818 lblParMolSz4 =
new JLabel(
"<html>Mol growth probability - parameter "
819 +
"<code>σ</code><sub>2</sub>:<html>", SwingConstants.LEFT);
822 spnParMolSz4 =
new JSpinner(
new SpinnerNumberModel(25.0,
null,
null, 1.0));
830 String toolTipParMolSz1 =
"Specifies the molecular growth probability scheme";
832 lblParMolSz1 =
new JLabel(
"Mol growth probability function:",
833 SwingConstants.LEFT);
850 final JSpinner spnMaxLevMolSz =
new JSpinner(
new SpinnerNumberModel(
852 spnMaxLevMolSz.addChangeListener(
new ChangeListener()
855 public void stateChanged(ChangeEvent event)
857 int maxLev = ((Integer) spnMaxLevMolSz.getValue()).intValue();
868 grpLyoMolSzProb.setAutoCreateGaps(
true);
869 grpLyoMolSzProb.setAutoCreateContainerGaps(
true);
870 grpLyoMolSzProb.setHorizontalGroup(grpLyoMolSzProb.createSequentialGroup()
873 grpLyoMolSzProb.setVerticalGroup(grpLyoMolSzProb.createParallelGroup(
874 GroupLayout.Alignment.CENTER)
884 public void stateChanged(ChangeEvent event)
891 public void stateChanged(ChangeEvent event)
898 public void stateChanged(ChangeEvent event)
905 public void actionPerformed(ActionEvent e){
956 String toolTipParCrowd2 =
"<html>Specifies the value of the factor used in"
957 +
" crowding probability schemes <code>"
958 + ProbabilityFuncitonShape.EXP_DIFF
961 + ProbabilityFuncitonShape.TANH
964 lblParCrowd2 =
new JLabel(
"<html>Crowding probability - parameter "
965 +
"<code>λ</code><html>", SwingConstants.LEFT);
968 spnParCrowd2 =
new JSpinner(
new SpinnerNumberModel(1.0, 0.0,
null, 0.1));
976 String toolTipParCrowd3 =
"<html>Specifies the value of parameter "
977 +
"σ<sub>1</sub> used for crowding probability scheme"
979 + ProbabilityFuncitonShape.SIGMA
980 +
"</code>.<br>It corresponds to the steepness of"
981 +
" the function where <i>P(level) = 50%</i></html>";
983 lblParCrowd3 =
new JLabel(
"<html>Crowding probability - parameter "
984 +
"<code>σ</code><sub>1</sub>:</html>", SwingConstants.LEFT);
987 spnParCrowd3 =
new JSpinner(
new SpinnerNumberModel(1.0,
null,
null, 0.1));
995 String toolTipParCrowd4 =
"<html>Specifies the value of parameter "
996 +
"σ<sub>2</sub> used in crowding probability scheme "
998 + ProbabilityFuncitonShape.SIGMA
999 +
"</code>.<br>It corresponds to the level "
1000 +
"where <i>P(level) = 50%</i></html>";
1001 lineParCrowd4 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1002 lblParCrowd4 =
new JLabel(
"<html>Crowding probability - parameter "
1003 +
"<code>σ</code><sub>2</sub>:<html>", SwingConstants.LEFT);
1006 spnParCrowd4 =
new JSpinner(
new SpinnerNumberModel(3.5,
null,
null, 0.1));
1014 String toolTipParCrowd1 =
"Specifies the crowding probability scheme";
1015 lineParCrowd1 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1016 lblParCrowd1 =
new JLabel(
"Crowding probability function:",
1017 SwingConstants.LEFT);
1020 cmbParCrowd1 =
new JComboBox<ProbabilityFuncitonShape>(
1034 final JSpinner spnMaxLevCrowd =
new JSpinner(
new SpinnerNumberModel(
1036 spnMaxLevCrowd.addChangeListener(
new ChangeListener()
1039 public void stateChanged(ChangeEvent event)
1041 int maxLev = ((Integer) spnMaxLevCrowd.getValue()).intValue();
1052 grpLyoCrowdProb.setAutoCreateGaps(
true);
1053 grpLyoCrowdProb.setAutoCreateContainerGaps(
true);
1054 grpLyoCrowdProb.setHorizontalGroup(grpLyoCrowdProb.createSequentialGroup()
1057 grpLyoCrowdProb.setVerticalGroup(grpLyoCrowdProb.createParallelGroup(
1058 GroupLayout.Alignment.CENTER)
1068 public void stateChanged(ChangeEvent event)
1075 public void stateChanged(ChangeEvent event)
1082 public void stateChanged(ChangeEvent event)
1089 public void actionPerformed(ActionEvent e){
1090 String scheme =
cmbParCrowd1.getSelectedItem().toString();
1138 String toolTipPar15 =
"<html>Specifies the strategy for selecting crossover partners.<ul>"
1139 +
"<li><code>RANDOM</code>: unbiased selection.</li>"
1140 +
"<li><code>TS</code>: Tournament.</li>"
1141 +
"<li><code>RW</code>: Roulette Wheel.</li>"
1142 +
"<li><code>SUS</code>: Stochastic Universal Sampling.</li>"
1144 linePar15 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1145 lblPar15 =
new JLabel(
"Parent selection algorithm:", SwingConstants.LEFT);
1147 lblPar15.setToolTipText(toolTipPar15);
1148 cmbPar15 =
new JComboBox<String>(
new String[] {
"RANDOM",
"TS",
"RW",
"SUS"});
1149 cmbPar15.setToolTipText(toolTipPar15);
1156 String toolTipPar16 =
"<html>Specifies the relative weight of "
1157 +
"crossover operations.</html>";
1158 linePar16 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1159 lblPar16 =
new JLabel(
"Crossover weight:", SwingConstants.LEFT);
1161 lblPar16.setToolTipText(toolTipPar16);
1163 txtPar16.setToolTipText(toolTipPar16);
1171 String toolTipPar17 =
"<html>Specifies the relative weight of "
1172 +
"mutation operations.</html>";
1173 linePar17 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1174 lblPar17 =
new JLabel(
"Mutation weight:", SwingConstants.LEFT);
1176 lblPar17.setToolTipText(toolTipPar17);
1178 txtPar17.setToolTipText(toolTipPar17);
1186 String toolTipParWC =
"<html>Specifies the relative weight of "
1187 +
"construction from scratch.</html>";
1188 lineParWC =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1189 lblParWC =
new JLabel(
"Construction weight:", SwingConstants.LEFT);
1191 lblParWC.setToolTipText(toolTipParWC);
1193 txtParWC.setToolTipText(toolTipParWC);
1201 String toolTipPar18 =
"Specifies the probability (0.0-1.0) of symmetric operations.";
1202 linePar18 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1203 lblPar18 =
new JLabel(
"Symmetric operation probability:", SwingConstants.LEFT);
1205 lblPar18.setToolTipText(toolTipPar18);
1207 txtPar18.setToolTipText(toolTipPar18);
1215 String toolTipPar19 =
"Specifies the population members replacement strategy.";
1216 linePar19 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1217 lblPar19 =
new JLabel(
"Population update mode:", SwingConstants.LEFT);
1219 lblPar19.setToolTipText(toolTipPar19);
1220 cmbPar19 =
new JComboBox<String>(
new String[] {
"ELITIST",
"NONE"});
1221 cmbPar19.setToolTipText(toolTipPar19);
1228 String toolTipPar24 =
"Specifies the maximum number of parallel candidate evaluation tasks.";
1229 linePar24 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1230 lblPar24 =
new JLabel(
"Number of parallel evaluation tasks:", SwingConstants.LEFT);
1232 lblPar24.setToolTipText(toolTipPar24);
1234 txtPar24.setToolTipText(toolTipPar24);
1242 String toolTipPar25 =
"<html>Specifies the parallelization scheme:<br><ul><li><code>synchronous</code>, i.e., parallel tasks are submitted in batches, thus no new task is submitted until the last of the previous tasks is completed.</li><li><code>asynchronous</code>, i.e., a new parallel tasks is submitted as soon as any of the previous task is completed.</li></ul></html>";
1243 linePar25 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1244 lblPar25 =
new JLabel(
"Task parallelization scheme:", SwingConstants.LEFT);
1246 lblPar25.setToolTipText(toolTipPar25);
1247 cmbPar25 =
new JComboBox<String>(
new String[] {
"Synchronous",
"Asynchronous"});
1248 cmbPar25.setToolTipText(toolTipPar25);
1257 String toolTipParMSM =
"<html>Specifies the relative weight of "
1258 +
"multi-site mutation operations "
1259 +
"(comma- or space-separated list).</html>";
1260 lineParMSM =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1261 lblParMSM =
new JLabel(
"Multi-site mutation weight:", SwingConstants.LEFT);
1263 lblParMSM.setToolTipText(toolTipParMSM);
1265 txtParMSM.setToolTipText(toolTipParMSM);
1273 String toolTipPar3 =
"Specifies the seed number used by the random number generator";
1274 linePar3 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1275 lblPar3 =
new JLabel(
"Random Seed:", SwingConstants.LEFT);
1277 lblPar3.setToolTipText(toolTipPar3);
1279 txtPar3.setToolTipText(toolTipPar3);
1287 String toolTipPar1 =
"Specifies the number of figures used to report the fitness";
1288 linePar1 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1289 lblPar1 =
new JLabel(
"Precision of fitness value:", SwingConstants.LEFT);
1291 lblPar1.setToolTipText(toolTipPar1);
1293 txtPar1.setToolTipText(toolTipPar1);
1301 String toolTipPar2 =
"Specifies the amount of log produced.";
1302 linePar2 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1303 lblPar2 =
new JLabel(
"Verbosity of GA modules:", SwingConstants.LEFT);
1305 lblPar2.setToolTipText(toolTipPar2);
1306 cmbPar2 =
new JComboBox<String>(
new String[] {
"-3",
"-2",
"-1",
"0",
"1",
"2",
"3"});
1307 cmbPar2.setToolTipText(toolTipPar2);
1315 String toolTipPar5 =
"Specifies whether the candidates should be reported in descending or ascending order of fitness.";
1316 linePar5 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1317 rdbPar5 =
new JRadioButton(
"Sort by descending fitness");
1318 rdbPar5.setToolTipText(toolTipPar5);
1324 String toolTipPar10 =
"<html>Controls the maximum number of attempts to build a new graph.<br> The maximum number of attempts to build a new graph is given by the size of the population, times this factor.</html>";
1325 linePar10 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1326 lblPar10 =
new JLabel(
"Max tries to get new graph:", SwingConstants.LEFT);
1328 lblPar10.setToolTipText(toolTipPar10);
1330 txtPar10.setToolTipText(toolTipPar10);
1342 String toolMolToGraph =
"<html>Specifies the pathname of a file containing molecules that should be screened to generate the initial population.<br> The file can be an SDF file or a text file where each line contains a SMILES.</html>";
1344 lblMolToGraph =
new JLabel(
"Initial population from screening:", SwingConstants.LEFT);
1351 txtMolToGraph.getDocument().addDocumentListener(
new DocumentListener() {
1352 public void changedUpdate(DocumentEvent e) {
1364 public void removeUpdate(DocumentEvent e) {
1376 public void insertUpdate(DocumentEvent e) {
1392 public void actionPerformed(ActionEvent e) {
1401 String toolFrgMols =
"<html>Specifies the pathname of a file containing the cutting rules to apply when converting molecules into graphs</html>";
1402 lineFrgMols =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1403 lblFrgMols =
new JLabel(
"Mol-to-graph bond-cutting rules:", SwingConstants.LEFT);
1413 btnFrgMols.addActionListener(
new ActionListener() {
1414 public void actionPerformed(ActionEvent e) {
1424 String toolAddH =
"Specifies whether the to add explicit H atoms upon importing molecules to be fragmented.";
1425 lineAddH =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1426 rdbAddH =
new JRadioButton(
"Add explicit H atoms");
1427 rdbAddH.setToolTipText(toolAddH);
1438 String toolTipPar20 =
"<html>Specifies the pathname of a file containing previously evaluated individuals to be added to the initial population.<br> The file can be an SDF file or a text file where each line containing the pathname to a single-molecule SDF file.</html>";
1439 linePar20 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1440 lblPar20 =
new JLabel(
"Initial population file (SDF):", SwingConstants.LEFT);
1442 lblPar20.setToolTipText(toolTipPar20);
1444 txtPar20.setToolTipText(toolTipPar20);
1449 btnPar20.addActionListener(
new ActionListener() {
1450 public void actionPerformed(ActionEvent e) {
1459 String toolTipPar21 =
"<html>Specifies the pathname of a text file collecting unique individual identification (UID) of previously known individuals.<br>The file must have one UID per line.</html>";
1460 linePar21 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1461 lblPar21 =
new JLabel(
"File with known UIDs:", SwingConstants.LEFT);
1463 lblPar21.setToolTipText(toolTipPar21);
1465 txtPar21.setToolTipText(toolTipPar21);
1470 btnPar21.addActionListener(
new ActionListener() {
1471 public void actionPerformed(ActionEvent e) {
1480 String toolTipPar22 =
"Specifies the pathname of the file that will collect unique individual identification (UID) strings encountered during an evolutionary experiment.";
1481 linePar22 =
new JPanel(
new FlowLayout(FlowLayout.LEFT));
1482 lblPar22 =
new JLabel(
"File for new UIDs:", SwingConstants.LEFT);
1484 lblPar22.setToolTipText(toolTipPar22);
1486 txtPar22.setToolTipText(toolTipPar22);
1491 btnPar22.addActionListener(
new ActionListener() {
1492 public void actionPerformed(ActionEvent e) {
1503 String toolTipRingTmplsFrags =
"<html>Specifies whether ring systems "
1504 +
"should be extracted <br>"
1505 +
"from generated graphs and stored as new general-"
1506 +
"purpose building blocks."
1510 +
"block library.");
1518 String toolTipRingTmplsScaff =
"<html>Specifies whether ring systems "
1519 +
"should be extracted <br>"
1520 +
"from generated graphs and stored as new "
1521 +
"scaffold building blocks."
1525 +
"of scaffold building blocks.");
1533 String toolTipRingSysTmpl =
"<html>A %/100 defining how good "
1534 +
"(high fitness w.r.t. population range)<br> "
1535 +
"candidates need to be for generating "
1536 +
"new ring system templates.<br>"
1537 +
"For example, 0.10 "
1538 +
"allows only the best 10% of the candidates <br>to generate "
1539 +
"a new building block from theyr graph.</html>";
1541 lblRingSysTmpl =
new JLabel(
"Threshold for saving ring systems:",
1542 SwingConstants.LEFT);
1545 spnRingSysTmpl =
new JSpinner(
new SpinnerNumberModel(0.10,0.0,1.0,0.05));
1561 JButton advOptShow =
new JButton(
"Advanced Settings");
1562 advOptShow.addActionListener(
new ActionListener(){
1563 public void actionPerformed(ActionEvent e){
1567 advOptShow.setText(
"Show Advanced Settings");
1572 advOptShow.setText(
"Hide Advanced Settings");
1573 scrollablePane.validate();
1574 scrollablePane.repaint();
1575 scrollablePane.getVerticalScrollBar().setValue(
1576 scrollablePane.getVerticalScrollBar().getValue() + (
int)
preferredHeight*2/3);
1581 JPanel advOptsController =
new JPanel();
1582 advOptsController.add(advOptShow);
1587 this.add(scrollablePane);
1604 ArrayList<Double> y =
new ArrayList<Double>();
1608 cmbPar11.getSelectedItem().toString());
1609 double l = (Double)
spnPar12.getValue();
1610 double s1 = (Double)
spnPar13.getValue();
1611 double s2 = (Double)
spnPar14.getValue();
1613 for (
int level=0; level<100; level++)
1616 level, scheme, l, s1, s2);
1622 e.printStackTrace();
1623 JOptionPane.showMessageDialog(
this,
1624 "<html>Exception occurred while reading growth proability "
1626 +
"Please, report this to the DENOPTIM team.</html>",
1628 JOptionPane.ERROR_MESSAGE,
1629 UIManager.getIcon(
"OptionPane.errorIcon"));
1632 double[][] data =
new double[2][y.size()];
1633 for (
int level=0; level<100; level++)
1635 data[0][level] = level;
1636 data[1][level] = y.get(level);
1661 PlotOrientation.VERTICAL,
1671 plot.getRangeAxis().setRange(0.0, 1.0);
1679 XYLineAndShapeRenderer renderer =
new XYLineAndShapeRenderer();
1680 renderer.setSeriesPaint(0, Color.decode(
"#490092"));
1681 renderer.setSeriesStroke(0,
new BasicStroke(2.0f));
1682 plot.setRenderer(renderer);
1685 Font font3 =
new Font(
"Dialog", Font.PLAIN, 12);
1686 plot.getDomainAxis().setLabelFont(font3);
1687 plot.getRangeAxis().setLabelFont(font3);
1704 ArrayList<Double> y =
new ArrayList<Double>();
1713 for (
int numHeavyAtoms=0; numHeavyAtoms<100; numHeavyAtoms++)
1716 numHeavyAtoms, scheme, l, s1, s2);
1722 e.printStackTrace();
1723 JOptionPane.showMessageDialog(
this,
1724 "<html>Exception occurred while reading croding proability "
1726 +
"Please, report this to the DENOPTIM team.</html>",
1728 JOptionPane.ERROR_MESSAGE,
1729 UIManager.getIcon(
"OptionPane.errorIcon"));
1732 double[][] data =
new double[2][y.size()];
1733 for (
int numHeavyAtoms=0; numHeavyAtoms<100; numHeavyAtoms++)
1735 data[0][numHeavyAtoms] = numHeavyAtoms;
1736 data[1][numHeavyAtoms] = y.get(numHeavyAtoms);
1761 PlotOrientation.VERTICAL,
1771 plot.getRangeAxis().setRange(0.0, 1.0);
1779 XYLineAndShapeRenderer renderer =
new XYLineAndShapeRenderer();
1780 renderer.setSeriesPaint(0, Color.decode(
"#db6d00"));
1781 renderer.setSeriesStroke(0,
new BasicStroke(2.0f));
1782 plot.setRenderer(renderer);
1785 Font font3 =
new Font(
"Dialog", Font.PLAIN, 12);
1786 plot.getDomainAxis().setLabelFont(font3);
1787 plot.getRangeAxis().setLabelFont(font3);
1804 ArrayList<Double> y =
new ArrayList<Double>();
1813 for (
int crowdedness=0; crowdedness<100; crowdedness++)
1816 crowdedness, scheme, l, s1, s2);
1822 e.printStackTrace();
1823 JOptionPane.showMessageDialog(
this,
1824 "<html>Exception occurred while reading mol growth "
1825 +
"proability scheme.<br>"
1826 +
"Please, report this to the DENOPTIM team.</html>",
1828 JOptionPane.ERROR_MESSAGE,
1829 UIManager.getIcon(
"OptionPane.errorIcon"));
1832 double[][] data =
new double[2][y.size()];
1833 for (
int crowdedness=0; crowdedness<100; crowdedness++)
1835 data[0][crowdedness] = crowdedness;
1836 data[1][crowdedness] = y.get(crowdedness);
1861 PlotOrientation.VERTICAL,
1871 plot.getRangeAxis().setRange(0.0, 1.0);
1879 XYLineAndShapeRenderer renderer =
new XYLineAndShapeRenderer();
1880 renderer.setSeriesPaint(0, Color.decode(
"#ff6db6"));
1881 renderer.setSeriesStroke(0,
new BasicStroke(2.0f));
1882 plot.setRenderer(renderer);
1885 Font font3 =
new Font(
"Dialog", Font.PLAIN, 12);
1886 plot.getDomainAxis().setLabelFont(font3);
1887 plot.getRangeAxis().setLabelFont(font3);
1917 cmbPar11.getSelectedItem().toString()))
2017 @SuppressWarnings(
"unchecked")
2022 String valueFieldClass;
2026 valueFieldClass = valueField.getClass().toString();
2034 switch (valueFieldClass)
2036 case "class javax.swing.JTextField":
2037 ((JTextField) valueField).setText(value);
2040 case "class javax.swing.JRadioButton":
2041 ((JRadioButton) valueField).setSelected(
true);
2044 case "class javax.swing.JComboBox":
2048 ((JComboBox<ProbabilityFuncitonShape>) valueField)
2050 value.toUpperCase()));
2052 ((JComboBox<String>) valueField).setSelectedItem(
2053 value.toUpperCase());
2057 case "class javax.swing.table.DefaultTableModel":
2061 ((DefaultTableModel) valueField).addRow(value.split(
" "));
2064 case "class javax.swing.JSpinner":
2068 ((JSpinner) valueField).setValue(Double.parseDouble(value));
2072 throw new Exception(
"<html>Unexpected type for parameter: "
2073 + key +
" (" + valueFieldClass
2074 +
").<br>Please report this to"
2075 +
"the DEMOPTIM team.</html>");
2085 sb.append(
"# Genetic Algorithm - parameters").append(
NL);
2091 throw new Exception(
"<html>No source specified for GA "
2092 +
"parameters.<br>Please, specify the file name.</html>");
Helper methods for the genetic algorithm.
static double getGrowthProbabilityAtLevel(int level, int scheme, double lambda, double sigmaOne, double sigmaTwo)
Calculates the probability of adding a fragment to the given level.
static double getProbability(double value, int scheme, double lambda, double sigmaOne, double sigmaTwo)
Calculated a probability given parameters defining the shape of the probability function and a single...
static double getCrowdingProbabilityForCrowdedness(int crowdedness, int scheme, double lambda, double sigmaOne, double sigmaTwo)
Calculated the crowding probability for a given level of crowdedness.
File opener for DENOPTIM GUI.
static File pickFileForTxtField(JTextField txtField, Component parent)
Parameters for genetic algorithm.
static int convertProbabilityScheme(String option)