Updating the JEInterface Matlab code

This commit is contained in:
Marcel Kronfeld 2009-03-11 12:51:32 +00:00
parent 22f50cb45d
commit c6da979e51

View File

@ -75,12 +75,12 @@ cnt=1;
% repeat the mediator thread and eval call until finished % repeat the mediator thread and eval call until finished
try try
while (~int.mediator.isFinished()) while (~int.mediator.isFinished())
% disp(sprintf('running mediator id %d',cnt)); % disp(sprintf('running mediator id %d',cnt));
int.mediator.run(cnt); int.mediator.run(cnt);
% disp(sprintf('after running mediator id %d',cnt)); % disp(sprintf('after running mediator id %d',cnt));
cnt=cnt+1; cnt=cnt+1;
if (~int.mediator.isFinished()) if (~int.mediator.isFinished())
%disp('getting question'); % disp('getting question');
x = int.mediator.getQuestion(); x = int.mediator.getQuestion();
%disp('question asked'); %disp('question asked');
if (isempty(int.range)) if (isempty(int.range))
@ -96,7 +96,7 @@ try
else else
res = feval(int.f, x, int.args); res = feval(int.f, x, int.args);
end end
% disp(sprintf('res is %d',res)); % disp(sprintf('res is %d',res));
%res %res
catch ME catch ME
disp('function evaluation failed:'); disp('function evaluation failed:');
@ -104,8 +104,7 @@ try
stopOptimization=1; stopOptimization=1;
end end
int.mediator.setAnswer(res); int.mediator.setAnswer(res);
%disp('answer provided'); if (createStopBox == 1) ; drawnow; end;
drawnow;
if ((stopOptimization==1) && (stopOnce==1)) if ((stopOptimization==1) && (stopOnce==1))
disp('User interrupt requested ...'); disp('User interrupt requested ...');
stopOptimize(int); stopOptimize(int);
@ -141,6 +140,7 @@ if nontoolboxopt == 1,
if createStopBox==1 if createStopBox==1
if (ishandle(boxHandle)) , close(boxHandle); end if (ishandle(boxHandle)) , close(boxHandle); end
end end
clear boxHandle
clear global stopOptimization clear global stopOptimization
end end
% disp('runEvalLoop done'); % disp('runEvalLoop done');