Repaired output over Matlab interface
This commit is contained in:
parent
6142b21ea8
commit
45fb50d766
@ -37,8 +37,8 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
|||||||
transient PrintStream dos = null;
|
transient PrintStream dos = null;
|
||||||
private double range[][] = null;
|
private double range[][] = null;
|
||||||
private static String defTestOut = "matlabproblem-debug.log";
|
private static String defTestOut = "matlabproblem-debug.log";
|
||||||
private static String resOutFile = "matlabproblem-output.txt";
|
// private static String resOutFile = "matlabproblem-output.txt";
|
||||||
transient PrintStream resOutStream = null;
|
// transient PrintStream resOutStream = null;
|
||||||
int verbosityLevel = 0;
|
int verbosityLevel = 0;
|
||||||
private MatlabEvalMediator handler = null;
|
private MatlabEvalMediator handler = null;
|
||||||
private boolean isDouble = true;
|
private boolean isDouble = true;
|
||||||
@ -228,9 +228,12 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
|||||||
handler.setFinished(false);
|
handler.setFinished(false);
|
||||||
runnable = OptimizerFactory.getOptRunnable(optType, (AbstractOptimizationProblem)this, outputFilePrefix);
|
runnable = OptimizerFactory.getOptRunnable(optType, (AbstractOptimizationProblem)this, outputFilePrefix);
|
||||||
// runnable.getGOParams().setPostProcessParams(new PostProcessParams(0, 0.01, 5));
|
// runnable.getGOParams().setPostProcessParams(new PostProcessParams(0, 0.01, 5));
|
||||||
// log("in MP optimize B\n");
|
log("in MP optimize B\n");
|
||||||
|
log("Setting text listener, verbo " + verbosityLevel + "\n");
|
||||||
runnable.setTextListener(this);
|
runnable.setTextListener(this);
|
||||||
runnable.setVerbosityLevel(verbosityLevel);
|
runnable.setVerbosityLevel(verbosityLevel);
|
||||||
|
if (verbosityLevel>0) runnable.setOutputTo(2); // both file + window
|
||||||
|
else runnable.setOutputTo(1); // only window
|
||||||
runnable.setOutputAdditionalInfo(true);
|
runnable.setOutputAdditionalInfo(true);
|
||||||
|
|
||||||
// log("in MP optimize C\n");
|
// log("in MP optimize C\n");
|
||||||
@ -396,17 +399,18 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void print(String str) {
|
public void print(String str) {
|
||||||
if (resOutStream==null) {
|
// System.err.println("MP print: " + str);
|
||||||
try {
|
// if (resOutStream==null) {
|
||||||
resOutStream = new PrintStream(new FileOutputStream(resOutFile));
|
// try {
|
||||||
} catch (FileNotFoundException e) {
|
// resOutStream = new PrintStream(new FileOutputStream(resOutFile));
|
||||||
e.printStackTrace();
|
// } catch (FileNotFoundException e) {
|
||||||
}
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
if (verbosityLevel > 0) {
|
if (verbosityLevel > 0) {
|
||||||
// matlab displays sysout output in the command window, so we simply use this channel
|
// matlab displays sysout output in the command window, so we simply use this channel
|
||||||
System.out.print(str);
|
System.out.print(str);
|
||||||
if (resOutStream != null) resOutStream.print(str);
|
// if (resOutStream != null) resOutStream.print(str);
|
||||||
}
|
}
|
||||||
log(str);
|
log(str);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addTextListener(InterfaceTextListener listener) {
|
public void addTextListener(InterfaceTextListener listener) {
|
||||||
if (!textListeners.contains(listener)) textListeners.add(listener);
|
if (!textListeners.contains(listener)) {
|
||||||
|
textListeners.add(listener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeTextListener(InterfaceTextListener listener) {
|
public boolean removeTextListener(InterfaceTextListener listener) {
|
||||||
|
@ -37,7 +37,7 @@ import eva2.tools.Mathematics;
|
|||||||
public class StatisticsStandalone extends AbstractStatistics implements InterfaceStatistics, Serializable {
|
public class StatisticsStandalone extends AbstractStatistics implements InterfaceStatistics, Serializable {
|
||||||
private static final long serialVersionUID = 2621394534751748968L;
|
private static final long serialVersionUID = 2621394534751748968L;
|
||||||
|
|
||||||
private static String m_MyHostName = "not def";
|
private static String m_MyHostName = "unknown";
|
||||||
|
|
||||||
private String m_InfoString;
|
private String m_InfoString;
|
||||||
private ArrayList<ArrayList<double[]>[]> m_Result;
|
private ArrayList<ArrayList<double[]>[]> m_Result;
|
||||||
|
@ -96,8 +96,11 @@ public class StatsParameter implements InterfaceStatisticsParameter, Serializabl
|
|||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String ret = "\r\nStatParameter:\r\nm_MultiRuns=" + m_MultiRuns +
|
String ret = "\r\nStatParameter:\r\nm_MultiRuns=" + m_MultiRuns +
|
||||||
"\r\nm_Textoutput=" + m_Textoutput +
|
"\nm_Textoutput=" + m_Textoutput +
|
||||||
"\r\nm_Plotoutput=" + m_Plotoutput;
|
"\nm_Plotoutput=" + m_Plotoutput +
|
||||||
|
"\nverbosity= " + outputVerbosity.getSelectedString() +
|
||||||
|
"\n" + outputTo.getSelectedString() +
|
||||||
|
"\n";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user