[DL-Learner SVN] SF.net SVN: dl-learner: [573]
trunk/src/dl-learner/org/dllearner/gui/ RunPanel.java
From: <ton...@us...> - 2008-02-14 15:58:48
|
Revision: 573 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=573&view=rev Author: tonytacker Date: 2008-02-14 07:58:45 -0800 (Thu, 14 Feb 2008) Log Message: ----------- Add 2 buttons in runPanel. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-02-14 15:08:47 UTC (rev 572) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-02-14 15:58:45 UTC (rev 573) @@ -26,8 +26,6 @@ import javax.swing.*; -// import org.dllearner.core.dl.Concept; - /** * RunPanel let algorithm start and stop and show informations about. * @@ -38,17 +36,18 @@ private static final long serialVersionUID = 1643304576470046636L; - private JButton runButton, stopButton, testButton; + private JButton runButton, stopButton, getBestSolutionButton, + getSolutionScoreButton; private JTextArea infoArea; private Config config; private ThreadRun thread; + private Boolean runBoolean = new Boolean(false); private JPanel showPanel = new JPanel(); private JPanel infoPanel = new JPanel(); - private JPanel testPanel = new JPanel(); + private JPanel solutionPanel = new JPanel(); - RunPanel(Config config) { super(new BorderLayout()); @@ -58,41 +57,51 @@ runButton.addActionListener(this); stopButton = new JButton("Stop"); stopButton.addActionListener(this); - testButton = new JButton("TEST"); - testButton.addActionListener(this); + getBestSolutionButton = new JButton("GetBestSolution"); + getBestSolutionButton.addActionListener(this); + + getSolutionScoreButton = new JButton("GetSolutionScore"); + getSolutionScoreButton.addActionListener(this); + infoArea = new JTextArea(20, 50); JScrollPane infoScroll = new JScrollPane(infoArea); showPanel.add(runButton); showPanel.add(stopButton); - showPanel.add(testButton); infoPanel.add(infoScroll); + solutionPanel.add(getBestSolutionButton); + solutionPanel.add(getSolutionScoreButton); + add(showPanel, BorderLayout.PAGE_START); add(infoPanel, BorderLayout.CENTER); - add(testPanel, BorderLayout.PAGE_END); + add(solutionPanel, BorderLayout.PAGE_END); } public void actionPerformed(ActionEvent e) { + // start if (e.getSource() == runButton && config.getLearningAlgorithm() != null) { - //config.autoInit(); thread = new ThreadRun(config); thread.start(); - // Concept solution = - // config.getLearningAlgorithm().getBestSolution(); - // infoArea.setText(solution.toString()); + this.runBoolean = true; } + // stop if (e.getSource() == stopButton && config.getLearningAlgorithm() != null) { - // config.getLearningAlgorithm().stop(); thread.exit(); - } - if (e.getSource() == testButton) { - } - + // getBestSolution + if (e.getSource() == getBestSolutionButton && runBoolean) { + infoArea.setText(config.getLearningAlgorithm().getBestSolution() + .toString()); + } + // getSolutionScore + if (e.getSource() == getSolutionScoreButton && runBoolean) { + infoArea.setText(config.getLearningAlgorithm().getSolutionScore() + .toString()); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[DL-Learner SVN] SF.net SVN: dl-learner: [673]
trunk/src/dl-learner/org/dllearner/gui/ RunPanel.java
From: <ton...@us...> - 2008-03-02 19:24:07
|
Revision: 673 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=673&view=rev Author: tonytacker Date: 2008-03-02 11:23:08 -0800 (Sun, 02 Mar 2008) Log Message: ----------- could it be a bug in method makeTime()? Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-02 19:04:28 UTC (rev 672) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-02 19:23:08 UTC (rev 673) @@ -25,7 +25,7 @@ import java.awt.event.ActionListener; import javax.swing.*; -import java.lang.Long; +import org.dllearner.utilities.Helper; /** * RunPanel let algorithm start and stop and show informations about. @@ -105,8 +105,8 @@ infoArea.setText(config.getLearningAlgorithm().getSolutionScore().toString()); } // ReasonerStats - if (e.getSource() == getReasonerStatsButton && runBoolean) { - infoArea.setText(""); + if (e.getSource() == getReasonerStatsButton /* && runBoolean*/) { +/* infoArea.setText(""); infoArea.append("Algorithm Runtime: " + makeTime(config.getAlgorithmRunTime()) + "\n"); infoArea.append("OverallReasoningTime: " @@ -128,6 +128,9 @@ infoArea.append("Subsumption (" + config.getReasoningService().getNrOfSubsumptionChecks() + "): " + makeTime(config.getReasoningService().getTimePerSubsumptionCheckNs()) + "\n"); + +*/ infoArea.setText(makeTime(9927255727L)); + } } @@ -138,23 +141,48 @@ * is type of Long and represent a time interval in ns * @return a string like this: 3h 12min 46s 753ms */ - public String makeTime(Long nanoSeconds) { + public String makeTime(long nanoSeconds) { String time = ""; - Integer hours = 0, minutes = 0, seconds = 0, miliSeconds = 0; - nanoSeconds /= 1000000; // miliSeconds - hours = Math.round(nanoSeconds / 1000 / 60 / 60); - minutes = Math.round(nanoSeconds / 1000 / 60); - seconds = Math.round(nanoSeconds / 1000); - miliSeconds = Math.round(nanoSeconds - (hours * 1000 * 60 * 60) - (minutes * 1000 * 60) - - (seconds * 1000)); + long hours, minutes, seconds, millis, mikros, nanos; + + // it cuts last decimals + nanos = nanoSeconds; + mikros = nanos / 1000; + millis = mikros / 1000; + seconds = millis / 1000; + minutes = seconds / 60; + hours = minutes / 60; + + // and calculate back + minutes -= hours * 60; + seconds -= minutes * 60; + millis -= seconds * 1000; + mikros -= millis * 1000; + nanos -= mikros * 1000; + + System.out.println("TEST: " + hours + "h " + minutes + "min " + seconds + "s " + millis + "ms " + mikros + "mikro " + nanos + "nano "); + + + + + + System.out.println(Helper.prettyPrintNanoSeconds(nanoSeconds, true, true)); + + + if (hours > 0) time += hours + "h "; if (minutes > 0) time += minutes + "min "; if (seconds > 0) time += seconds + "s "; - if (miliSeconds > 0) - time += miliSeconds + "ms "; + if (millis > 0) + time += millis + "ms "; + if (mikros > 0) + time += mikros + "ms "; + if (nanos > 0) + time += nanos + "ms "; + // System.out.println("time: " + time); return time; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[DL-Learner SVN] SF.net SVN: dl-learner: [694]
trunk/src/dl-learner/org/dllearner/gui/ RunPanel.java
From: <ton...@us...> - 2008-03-08 04:58:59
|
Revision: 694 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=694&view=rev Author: tonytacker Date: 2008-03-07 20:58:56 -0800 (Fri, 07 Mar 2008) Log Message: ----------- improved output for best solutions Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-08 04:16:34 UTC (rev 693) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-08 04:58:56 UTC (rev 694) @@ -25,8 +25,10 @@ import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.List; import javax.swing.*; + /** * @author Tilo Hielscher * @@ -162,9 +164,10 @@ infoArea.setText(""); // best solutions - if (config.getLearningAlgorithm().getBestSolutions(5) != null) - infoArea.append("BestSolutions:\n" - + config.getLearningAlgorithm().getBestSolutions(5).toString() + "\n\n"); + if (config.getLearningAlgorithm().getBestSolutions(5) != null) { + infoArea.append("Best solutions: \n\n" + + listToString(config.getLearningAlgorithm().getBestSolutions(10)) + "\n"); + } // solution score // if (config.getLearningAlgorithm().getSolutionScore() != null) // infoArea.append("SolutionScore:\n" @@ -278,4 +281,19 @@ gbc.weightx = wx; gbc.weighty = wy; } + + /** + * Make a string from list, every entry in new line. + * + * @param listDescription + * it is the list. + * @return the string. + */ + public String listToString(List<?> list) { + String string = ""; + for (int i = 0; i < list.size(); i++) { + string += list.get(i) + "\n"; + } + return string; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[DL-Learner SVN] SF.net SVN: dl-learner: [695]
trunk/src/dl-learner/org/dllearner/gui/ RunPanel.java
From: <ton...@us...> - 2008-03-08 05:23:22
|
Revision: 695 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=695&view=rev Author: tonytacker Date: 2008-03-07 21:23:20 -0800 (Fri, 07 Mar 2008) Log Message: ----------- cleared code for better reading Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-08 04:58:56 UTC (rev 694) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-08 05:23:20 UTC (rev 695) @@ -28,7 +28,6 @@ import java.util.List; import javax.swing.*; - /** * @author Tilo Hielscher * @@ -98,7 +97,7 @@ percent[i] = new JLabel("-"); } - // name, bar, time + // layout for name, bar, time for (int i = 0; i < 5; i++) { buildConstraints(constraints, 0, i, 1, 1, 1, 1); gridbag.setConstraints(name[i], constraints); @@ -181,10 +180,12 @@ time[0].setText(makeTime(algorithmRunTime)); percent[0].setText("100%"); } - overallReasoningTime = config.getReasoningService().getOverallReasoningTimeNs(); - bar[1].update((double) overallReasoningTime / (double) algorithmRunTime); - time[1].setText(makeTime(overallReasoningTime)); - percent[1].setText(Percent(overallReasoningTime, algorithmRunTime)); + if (config.getReasoningService() != null) { + overallReasoningTime = config.getReasoningService().getOverallReasoningTimeNs(); + bar[1].update((double) overallReasoningTime / (double) algorithmRunTime); + time[1].setText(makeTime(overallReasoningTime)); + percent[1].setText(Percent(overallReasoningTime, algorithmRunTime)); + } if (config.getReasoningService().getNrOfInstanceChecks() > 0) { instanceCheckReasoningTime = config.getReasoningService() .getInstanceCheckReasoningTimeNs(); @@ -285,7 +286,7 @@ /** * Make a string from list, every entry in new line. * - * @param listDescription + * @param list * it is the list. * @return the string. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[DL-Learner SVN] SF.net SVN: dl-learner: [811]
trunk/src/dl-learner/org/dllearner/gui/ RunPanel.java
From: <ton...@us...> - 2008-04-22 17:15:37
|
Revision: 811 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=811&view=rev Author: tonytacker Date: 2008-04-22 10:15:27 -0700 (Tue, 22 Apr 2008) Log Message: ----------- - reinit on run-button Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-04-22 15:23:38 UTC (rev 810) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-04-22 17:15:27 UTC (rev 811) @@ -143,7 +143,6 @@ // start if (e.getSource() == runButton && config.getLearningAlgorithm() != null && !config.getThreadIsRunning()) { - startGUI.init(); thread = new ThreadRun(config); config.getReasoningService().resetStatistics(); thread.start(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[DL-Learner SVN] SF.net SVN: dl-learner: [822]
trunk/src/dl-learner/org/dllearner/gui/ RunPanel.java
From: <ton...@us...> - 2008-04-24 17:39:48
|
Revision: 822 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=822&view=rev Author: tonytacker Date: 2008-04-24 10:39:36 -0700 (Thu, 24 Apr 2008) Log Message: ----------- removed a warning Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-04-24 08:43:22 UTC (rev 821) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-04-24 17:39:36 UTC (rev 822) @@ -39,7 +39,7 @@ private JButton runButton, stopButton, treeButton; private JTextArea infoArea; private Config config; - private StartGUI startGUI; + //private StartGUI startGUI; private ThreadRun thread; @@ -65,7 +65,7 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; + //this.startGUI = startGUI; runButton = new JButton("Run"); runButton.addActionListener(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |