Adaptions of EvA2-renaming in the Matlab m-Files of JEInterface
This commit is contained in:
parent
3013e905d6
commit
8136704b1b
@ -1,5 +1,5 @@
|
||||
function int = JEInterface(interfaceName, fhandle, range, varargin)
|
||||
% JavaEva Interface for Matlab
|
||||
% EvA2 Interface for Matlab
|
||||
% JEInterface(interfaceName, fhandle, range [, optset, defaultargs])
|
||||
% arguments:
|
||||
% interfaceName: a JEInterface instance needs to know its own
|
||||
@ -9,7 +9,7 @@ function int = JEInterface(interfaceName, fhandle, range, varargin)
|
||||
% upper bounds.
|
||||
% optset: (optional) an optimset struct defining optimization parameters,
|
||||
% especially tolerance and maximum function calls. Defaults to the
|
||||
% JavaEvA default values.
|
||||
% EvA2 default values.
|
||||
% defaultArgs: (optional) additional constant argument to the target
|
||||
% function, empty by default.
|
||||
% Recognized options are:
|
||||
@ -26,7 +26,7 @@ function int = JEInterface(interfaceName, fhandle, range, varargin)
|
||||
% any case, set TolX=TolFun=0 and MaxFunEvals=10^5.
|
||||
|
||||
int.args = [];
|
||||
int.opts = optimset('MaxFunEvals', javaeva.OptimizerFactory.getDefaultFitCalls, 'TolX', 1e-4, 'TolFun', 1e-4);
|
||||
int.opts = optimset('MaxFunEvals', eva2.OptimizerFactory.getDefaultFitCalls, 'TolX', 1e-4, 'TolFun', 1e-4);
|
||||
int.finished = 1;
|
||||
int.result = [];
|
||||
int.resultArr = [];
|
||||
@ -80,7 +80,7 @@ switch nargin
|
||||
end
|
||||
|
||||
% finally create the java object
|
||||
int.mp = javaeva.server.go.problems.MatlabProblem(int.callback, int.dim, int.range);
|
||||
int.mp = eva2.server.go.problems.MatlabProblem(int.callback, int.dim, int.range);
|
||||
|
||||
|
||||
|
||||
|
@ -2,9 +2,9 @@ function desc = getDesc(int, ID)
|
||||
% Return the String description of an indicated optimizer
|
||||
% with member descriptions.
|
||||
|
||||
import javaeva.gui.BeanInspector;
|
||||
import javaeva.server.modules.GOParameters;
|
||||
import javaeva.OptimizerFactory;
|
||||
import eva2.gui.BeanInspector;
|
||||
import eva2.server.modules.GOParameters;
|
||||
import eva2.OptimizerFactory;
|
||||
|
||||
params = OptimizerFactory.getParams(ID, int.mp);
|
||||
desc = BeanInspector.getDescription(params.getOptimizer, false);
|
||||
|
@ -1,4 +1,4 @@
|
||||
function str = getMessage(int)
|
||||
% Get information string received from JavaEvA.
|
||||
% Get information string received from EvA2.
|
||||
|
||||
str = int.msg;
|
||||
|
@ -1,6 +1,7 @@
|
||||
function [sols, fits] = getMultipleResults(int)
|
||||
% Returns a set of optimization solutions if the run has been finished, or
|
||||
% a singel intermediate solution if the run has not finished yet or an
|
||||
% If a post processing step was performed: return a set of
|
||||
% optimization solutions if the run has been finished, or
|
||||
% a single intermediate solution if the run has not finished yet or an
|
||||
% empty array if there is no intermediate solution yet.
|
||||
|
||||
if (isFinished(int))
|
||||
|
@ -1,5 +1,5 @@
|
||||
function retInt = optimize(int, optType, varargin)
|
||||
% Start a JavaEvA optimization run.
|
||||
% Start a EvA2 optimization run.
|
||||
% optimize(interface, optType, [, outputFilePrefix ] )
|
||||
% where
|
||||
% interface: instance of JEInterface
|
||||
@ -28,11 +28,11 @@ if ((nargin == 2) || (nargin == 3))
|
||||
maxEvals = int.opts.MaxFunEvals;
|
||||
fTol = int.opts.TolFun;
|
||||
|
||||
import javaeva.server.go.operators.terminators.PhenotypeConvergenceTerminator;
|
||||
import javaeva.server.go.operators.terminators.FitnessConvergenceTerminator;
|
||||
import javaeva.server.go.operators.terminators.CombinedTerminator;
|
||||
import javaeva.server.go.operators.terminators.EvaluationTerminator;
|
||||
import javaeva.OptimizerFactory;
|
||||
import eva2.server.go.operators.terminators.PhenotypeConvergenceTerminator;
|
||||
import eva2.server.go.operators.terminators.FitnessConvergenceTerminator;
|
||||
import eva2.server.go.operators.terminators.CombinedTerminator;
|
||||
import eva2.server.go.operators.terminators.EvaluationTerminator;
|
||||
import eva2.OptimizerFactory;
|
||||
|
||||
% set some default values if theyre not given
|
||||
% fminsearch, for example, always uses TolX and TolFun with default
|
||||
@ -61,13 +61,13 @@ if ((nargin == 2) || (nargin == 3))
|
||||
% maxEvals = OptimizerFactory.getDefaultFitCalls;
|
||||
end
|
||||
convTerm = EvaluationTerminator(maxEvals);
|
||||
javaeva.OptimizerFactory.setTerminator(convTerm);
|
||||
eva2.OptimizerFactory.setTerminator(convTerm);
|
||||
else % there is a convergence terminator
|
||||
javaeva.OptimizerFactory.setTerminator(convTerm); % so set it
|
||||
eva2.OptimizerFactory.setTerminator(convTerm); % so set it
|
||||
if (~isempty(maxEvals) && (maxEvals > 0))
|
||||
% if TolX/TolFun plus MaxFunEvals is defined additionally, combine an
|
||||
% EvaluationTerminator in disjunction, as Matlab does.
|
||||
javaeva.OptimizerFactory.addTerminator(EvaluationTerminator(maxEvals), 0);
|
||||
eva2.OptimizerFactory.addTerminator(EvaluationTerminator(maxEvals), 0);
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
function retInt = optimizeWith(int, optType, varargin)
|
||||
% Start a JavaEvA optimization run with specific optimizer parameter settings.
|
||||
% Start a EvA2 optimization run with specific optimizer parameter settings.
|
||||
% optimize(interface, optType, [, outputFilePrefix ] [, memName, memVal]* )
|
||||
% where
|
||||
% interface: instance of JEInterface
|
||||
@ -54,4 +54,4 @@ else
|
||||
retInt = optimize(int, optType, output);
|
||||
int.optParams = [];
|
||||
int.optParamValues = [];
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
function int=runEvalLoopJE(int, optOrPostProc, optType, outputFilePrefix, steps, sigmaClust, nBest)
|
||||
% Internal method starting a JavaEvA optimization loop.
|
||||
% Internal method starting a EvA2 optimization loop.
|
||||
% Calling this directly may interfere with optimization.
|
||||
|
||||
% This function handles the communciation between JE and Matlab, main
|
||||
@ -21,16 +21,16 @@ if ~isempty(int.mediator)
|
||||
end
|
||||
|
||||
% set up a mediator and inform JE
|
||||
int.mediator = javaeva.server.go.problems.MatlabEvalMediator;
|
||||
int.mediator = eva2.server.go.problems.MatlabEvalMediator;
|
||||
int.mp.setMediator(int.mediator);
|
||||
JEMediator=int.mediator;
|
||||
|
||||
% start the JE thread
|
||||
if (optOrPostProc == 1)
|
||||
stopText='Stop JavaEvA optimization';
|
||||
stopText='Stop EvA2 optimization';
|
||||
int.mp.optimize(optType, outputFilePrefix, int.optParams, int.optParamValues);
|
||||
else % post processing
|
||||
stopText='Stop JavaEvA post processing';
|
||||
stopText='Stop EvA2 post processing';
|
||||
int.mp.requestPostProcessing(steps, sigmaClust, nBest);
|
||||
end
|
||||
|
||||
@ -44,7 +44,7 @@ if isempty(stopOptimization),
|
||||
stopOptimization = 0;
|
||||
|
||||
% create a cancel button box (case without SBtoolbox)
|
||||
boxHandle=figure('Position',[100 600 250 80], 'MenuBar', 'none', 'Name', 'JavaEvA optimization running...', 'NumberTitle','off');
|
||||
boxHandle=figure('Position',[100 600 250 80], 'MenuBar', 'none', 'Name', 'EvA2 optimization running...', 'NumberTitle','off');
|
||||
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]);
|
||||
drawnow;
|
||||
|
@ -1,9 +1,9 @@
|
||||
function int = setResultArrayJE(int, arrData)
|
||||
% Interface function to be called by JavaEvA 2.
|
||||
% Interface function to be called by EvA2.
|
||||
|
||||
% Write back a whole solution set
|
||||
|
||||
int.finished = 1;
|
||||
int.msg=int.mp.getInfoString;
|
||||
int.funCalls=int.mp.getFunctionCalls;
|
||||
int.resultArr = arrData;
|
||||
int.resultArr = arrData;
|
||||
|
@ -1,5 +1,5 @@
|
||||
function int = setJEResult(int, result)
|
||||
% Interface function to be called by JavaEvA 2.
|
||||
% Interface function to be called by EvA2.
|
||||
|
||||
% Write back the solution and retrieve some additional data.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
function showOptimizers(int)
|
||||
% Show a list of JavaEvA optimizers accessible through the JEInterface
|
||||
% Show a list of EvA2 optimizers accessible through the JEInterface
|
||||
% and their access ID numbers.
|
||||
|
||||
javaeva.OptimizerFactory.showOptimizers
|
||||
eva2.OptimizerFactory.showOptimizers
|
||||
|
Loading…
x
Reference in New Issue
Block a user