First attempt at Markdown-ifying the text output
This commit is contained in:
parent
41280c8d01
commit
c28401e19d
@ -251,7 +251,7 @@ final class CommandLineStatistics implements InterfaceStatistics {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printToTextListener(String s) {
|
||||
public void printToTextListener(String... s) {
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
* the number of multiple runs has been reached.
|
||||
*/
|
||||
while (isOptimizationRunning() && (runCounter < statistics.getStatisticsParameters().getMultiRuns())) {
|
||||
LOGGER.info(String.format("Starting Optimization %d/%d", runCounter + 1, statistics.getStatisticsParameters().getMultiRuns()));
|
||||
LOGGER.info(String.format("Starting Optimization %d/%d", runCounter, statistics.getStatisticsParameters().getMultiRuns()));
|
||||
statistics.startOptimizationPerformed(getInfoString(), runCounter, optimizationParameters, getInformerList());
|
||||
|
||||
problem.initializeProblem();
|
||||
|
@ -99,7 +99,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
private List<InterfaceAdditionalPopulationInformer> lastInformerList = null;
|
||||
private PopulationInterface lastSols = null;
|
||||
private String textFieldDelimiter = "\t";
|
||||
private String textFieldDelimiter = " | ";
|
||||
private int defaultFitCriterion = 0; // ToDo this might be a user chosen int - or even more elegantly, a MOSOConverter
|
||||
|
||||
protected StringSelection lastFieldSelection = null; // store the graph selection at the beginning of a multi-run
|
||||
@ -238,6 +238,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
@Override
|
||||
public void startOptimizationPerformed(String infoString, int runNumber, InterfaceOptimizationParameters params, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||
if (printRunIntroVerbosity()) {
|
||||
printToTextListener("# Optimization");
|
||||
}
|
||||
|
||||
if (runNumber == 0) {
|
||||
// store the initial graph selection state, so that modifications during runtime cannot cause inconsistencies
|
||||
@ -275,22 +278,11 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
feasibleFoundAfterSum = -1;
|
||||
numOfRunsFeasibleFound = 0;
|
||||
|
||||
}
|
||||
feasibleFoundAfter = -1;
|
||||
bestCurrentIndy = null;
|
||||
bestOfRunIndy = null;
|
||||
currentBestFeasibleFit = null;
|
||||
bestOfRunFeasibleIndy = null;
|
||||
lastInformerList = null;
|
||||
lastSols = null;
|
||||
iterationCounter = 0;
|
||||
if (printRunIntroVerbosity()) {
|
||||
printToTextListener("\n****** Multirun " + runNumber);
|
||||
}
|
||||
if (params != null) {
|
||||
if (printRunIntroVerbosity()) {
|
||||
printToTextListener("\nOptimization parameters: \n");
|
||||
printToTextListener("\n### Optimization parameters \n```\n");
|
||||
printToTextListener(BeanSerializer.serializeObject(params));
|
||||
printToTextListener("\n```\n\n");
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -300,6 +292,21 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
printToTextListener(BeanInspector.niceToString(getStatisticsParameters()) + '\n');
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
if (printRunIntroVerbosity()) {
|
||||
printToTextListener("## Multirun " + (runNumber + 1) + "\n");
|
||||
}
|
||||
|
||||
feasibleFoundAfter = -1;
|
||||
bestCurrentIndy = null;
|
||||
bestOfRunIndy = null;
|
||||
currentBestFeasibleFit = null;
|
||||
bestOfRunFeasibleIndy = null;
|
||||
lastInformerList = null;
|
||||
lastSols = null;
|
||||
iterationCounter = 0;
|
||||
functionCalls = 0;
|
||||
fireDataListenersStartStop(runNumber, true, true);
|
||||
}
|
||||
@ -387,9 +394,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
}
|
||||
if (printRunStoppedVerbosity()) {
|
||||
if (resultPop != null && (resultPop.size() > 0)) {
|
||||
printToTextListener("Resulting population: \n");
|
||||
printToTextListener("### Resulting population \n");
|
||||
for (int i = 0; i < resultPop.size(); i++) {
|
||||
printToTextListener(AbstractEAIndividual.getDefaultStringRepresentation(resultPop.getEAIndividual(i)));
|
||||
printToTextListener(AbstractEAIndividual.getDefaultStringRepresentation(resultPop.getEAIndividual(i)) + " ");
|
||||
printToTextListener("\n");
|
||||
}
|
||||
}
|
||||
@ -612,13 +619,14 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
|
||||
@Override
|
||||
public void printToTextListener(String s) {
|
||||
public void printToTextListener(String... s) {
|
||||
String text = StringTools.concatFields(s, "");
|
||||
if ((resultOut != null)) {
|
||||
resultOut.print(s);
|
||||
resultOut.print(text);
|
||||
}
|
||||
for (InterfaceTextListener l : textListeners) {
|
||||
if (statisticsParameter.getOutputTo() != InterfaceStatisticsParameters.OutputTo.FILE) {
|
||||
l.print(s);
|
||||
l.print(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1068,7 +1076,10 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
if (iterationCounter == 0) {
|
||||
String headerLine = StringTools.concatFields(currentStatHeader, textFieldDelimiter);
|
||||
if (printHeaderByVerbosity()) {
|
||||
printToTextListener(headerLine + '\n');
|
||||
printToTextListener("| " + headerLine + " | \n");
|
||||
String[] tableSeparator = new String[currentStatHeader.length];
|
||||
Arrays.fill(tableSeparator, "---");
|
||||
printToTextListener("| " + StringTools.concatFields(tableSeparator, textFieldDelimiter) + " | \n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1076,7 +1087,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
Pair<String, Object[]> addData = getOutputData(informerList, lastSols);
|
||||
if (doTextOutput()) { // this is where the text output is actually written
|
||||
if (printLineByVerbosity(iterationCounter)) {
|
||||
printToTextListener(addData.head() + '\n');
|
||||
printToTextListener("| " + addData.head() + " | \n");
|
||||
}
|
||||
}
|
||||
currentStatObjectData = addData.tail();
|
||||
|
@ -31,7 +31,7 @@ public interface InterfaceStatistics {
|
||||
|
||||
boolean removeTextListener(InterfaceTextListener listener);
|
||||
|
||||
void printToTextListener(String s);
|
||||
void printToTextListener(String... s);
|
||||
|
||||
void createNextGenerationPerformed(PopulationInterface Pop, InterfaceOptimizer opt, List<InterfaceAdditionalPopulationInformer> informerList);
|
||||
|
||||
|
@ -174,6 +174,14 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
|
||||
arrayEditor.selectDeselectAll();
|
||||
}
|
||||
};
|
||||
|
||||
ActionListener cliButtonListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
System.out.println("Generating CLI call");
|
||||
}
|
||||
};
|
||||
|
||||
ActionListener sal = new ActionListener() {
|
||||
|
||||
@Override
|
||||
@ -181,8 +189,11 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
|
||||
jobList.saveSelectedJobs(arrayEditor);
|
||||
}
|
||||
};
|
||||
|
||||
arrayEditor.addUpperActionButton("Get CLI", cliButtonListener);
|
||||
arrayEditor.addUpperActionButton("(De-)Sel. all", sl);
|
||||
arrayEditor.addUpperActionButton("Test Stats", al);
|
||||
|
||||
arrayEditor.addLowerActionButton("Save selected", sal);
|
||||
|
||||
arrayEditor.addPopupItem("Reuse as current settings", getReuseActionListener(parent, jobList));
|
||||
|
@ -74,7 +74,7 @@ public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printToTextListener(String s) {
|
||||
public void printToTextListener(String... s) {
|
||||
if (consoleOut) {
|
||||
System.out.println(s);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public class MultirunRefiner {
|
||||
*/
|
||||
public void loadFile() {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setDialogTitle("Select an Multirun.TXT File");
|
||||
fc.setDialogTitle("Select a Multirun.TXT File");
|
||||
fc.setFileFilter(new TXTFileFilter());
|
||||
int returnVal = fc.showDialog(this.mainFrame, "Load Multirun.TXT");
|
||||
if (returnVal == 0) {
|
||||
|
@ -7,9 +7,6 @@ public class Tag implements java.io.Serializable {
|
||||
protected int id;
|
||||
protected String text;
|
||||
|
||||
public Tag() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user