Minor JEInterface changes.
This commit is contained in:
parent
2cb9db4a9d
commit
50dfec343f
@ -42,11 +42,14 @@ end
|
|||||||
if isempty(stopOptimization),
|
if isempty(stopOptimization),
|
||||||
% set switch to 0 now
|
% set switch to 0 now
|
||||||
stopOptimization = 0;
|
stopOptimization = 0;
|
||||||
|
startTime=clock;
|
||||||
|
timeStr=sprintf('%d.%d. %d:%0.2d:%0.2d',startTime(3), startTime(2), startTime(4), startTime(5), round(startTime(6)));
|
||||||
|
disp(sprintf('Starting optimization at %s', timeStr));
|
||||||
% create a cancel button box (case without SBtoolbox)
|
% create a cancel button box (case without SBtoolbox)
|
||||||
boxHandle=figure('Position',[100 600 250 80], 'MenuBar', 'none', 'Name', 'EvA2 optimization running...', 'NumberTitle','off');
|
stopText=sprintf('%s (%s)', stopText, timeStr);
|
||||||
|
boxHandle=figure('Position',[100 600 250 80], 'MenuBar', 'none', 'Name', 'EvA2 optimization...', 'NumberTitle','off');
|
||||||
uicontrol(boxHandle,'Style', 'pushbutton', 'String', 'Cancel', 'Position', [25 25 60 30], 'Callback', 'global stopOptimization; stopOptimization=1;');
|
uicontrol(boxHandle,'Style', 'pushbutton', 'String', 'Cancel', 'Position', [25 25 60 30], 'Callback', 'global stopOptimization; stopOptimization=1;');
|
||||||
uicontrol(boxHandle,'Style', 'text', 'String', stopText, 'Position', [100 25 120 30]);
|
uicontrol(boxHandle,'Style', 'text', 'String', stopText, 'Position', [100 15 130 50]);
|
||||||
drawnow;
|
drawnow;
|
||||||
% set flag for non toolbox optimization
|
% set flag for non toolbox optimization
|
||||||
nontoolboxopt = 1;
|
nontoolboxopt = 1;
|
||||||
|
@ -33,7 +33,7 @@ public class MatlabEvalMediator implements Runnable {
|
|||||||
volatile Object[] optSolSet = null;
|
volatile Object[] optSolSet = null;
|
||||||
MatlabProblem mp = null;
|
MatlabProblem mp = null;
|
||||||
// no good: even when waiting for only 1 ms the Matlab execution time increases by a factor of 5-10
|
// no good: even when waiting for only 1 ms the Matlab execution time increases by a factor of 5-10
|
||||||
final static int sleepTime = 0;
|
final static int sleepTime = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request evaluation from Matlab for the given params.
|
* Request evaluation from Matlab for the given params.
|
||||||
|
@ -37,6 +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";
|
||||||
|
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;
|
||||||
@ -225,6 +227,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
|||||||
// runnable.getGOParams().setPostProcessParams(new PostProcessParams(0, 0.01, 5));
|
// runnable.getGOParams().setPostProcessParams(new PostProcessParams(0, 0.01, 5));
|
||||||
runnable.setTextListener(this);
|
runnable.setTextListener(this);
|
||||||
runnable.setVerbosityLevel(verbosityLevel);
|
runnable.setVerbosityLevel(verbosityLevel);
|
||||||
|
runnable.setOutputAdditionalInfo(true);
|
||||||
|
|
||||||
if ((specParams != null) && (specParams.length > 0)) {
|
if ((specParams != null) && (specParams.length > 0)) {
|
||||||
if ((specValues == null) || (specValues.length != specParams.length)) {
|
if ((specValues == null) || (specValues.length != specParams.length)) {
|
||||||
@ -386,9 +389,17 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void print(String str) {
|
public void print(String str) {
|
||||||
|
if (resOutStream==null) {
|
||||||
|
try {
|
||||||
|
resOutStream = new PrintStream(new FileOutputStream(resOutFile));
|
||||||
|
} 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);
|
||||||
}
|
}
|
||||||
log(str);
|
log(str);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user