Cosmetics for the Matlab-Interface.
This commit is contained in:
parent
1782c0a4a7
commit
137ef279ac
@ -27,7 +27,10 @@ if ((nargin == 2) || (nargin == 3))
|
|||||||
xTol = int.opts.TolX;
|
xTol = int.opts.TolX;
|
||||||
maxEvals = int.opts.MaxFunEvals;
|
maxEvals = int.opts.MaxFunEvals;
|
||||||
fTol = int.opts.TolFun;
|
fTol = int.opts.TolFun;
|
||||||
|
if (ischar(xTol)) ; xTol = str2num(xTol); end;
|
||||||
|
if (ischar(maxEvals)) ; maxEvals= str2num(maxEvals); end;
|
||||||
|
if (ischar(fTol)) ; fTol = str2num(fTol); end;
|
||||||
|
|
||||||
import eva2.server.go.operators.terminators.PhenotypeConvergenceTerminator;
|
import eva2.server.go.operators.terminators.PhenotypeConvergenceTerminator;
|
||||||
import eva2.server.go.operators.terminators.FitnessConvergenceTerminator;
|
import eva2.server.go.operators.terminators.FitnessConvergenceTerminator;
|
||||||
import eva2.server.go.operators.terminators.CombinedTerminator;
|
import eva2.server.go.operators.terminators.CombinedTerminator;
|
||||||
@ -39,15 +42,16 @@ if ((nargin == 2) || (nargin == 3))
|
|||||||
% values of 1e-4 in . Thats what we do as well
|
% values of 1e-4 in . Thats what we do as well
|
||||||
if (isempty(int.opts.TolX)) ; xTol = 1e-4; end
|
if (isempty(int.opts.TolX)) ; xTol = 1e-4; end
|
||||||
if (isempty(int.opts.TolFun)) ; fTol = 1e-4; end
|
if (isempty(int.opts.TolFun)) ; fTol = 1e-4; end
|
||||||
|
|
||||||
|
evalsForConv=100;
|
||||||
% construct Terminators
|
% construct Terminators
|
||||||
if ((xTol > 0) && (fTol > 0))
|
if ((xTol > 0) && (fTol > 0))
|
||||||
% both criteria are given, use combination
|
% both criteria are given, use combination
|
||||||
convTerm = CombinedTerminator(FitnessConvergenceTerminator(fTol, 100, 1, 1), PhenotypeConvergenceTerminator(xTol, 100, 1, 1), 1);
|
convTerm = CombinedTerminator(FitnessConvergenceTerminator(fTol, evalsForConv, 1, 1), PhenotypeConvergenceTerminator(xTol, evalsForConv, 1, 1), 1);
|
||||||
else if (xTol > 0) % only phenotye convergence
|
else if (xTol > 0) % only phenotye convergence
|
||||||
convTerm = PhenotypeConvergenceTerminator(xTol, 100, 1, 1);
|
convTerm = PhenotypeConvergenceTerminator(xTol, evalsForConv, 1, 1);
|
||||||
else if (fTol > 0 ) % only fitness covnergence
|
else if (fTol > 0 ) % only fitness covnergence
|
||||||
convTerm = FitnessConvergenceTerminator(fTol, 100, 1, 1);
|
convTerm = FitnessConvergenceTerminator(fTol, evalsForConv, 1, 1);
|
||||||
else
|
else
|
||||||
convTerm = 'undef'; % signal that there is no terminator yet
|
convTerm = 'undef'; % signal that there is no terminator yet
|
||||||
end
|
end
|
||||||
|
@ -23,6 +23,9 @@ if (nargin < 2)
|
|||||||
error('invalid number of arguments!');
|
error('invalid number of arguments!');
|
||||||
end
|
end
|
||||||
|
|
||||||
|
int.optParams = [];
|
||||||
|
int.optParamValues = [];
|
||||||
|
|
||||||
if (nargin == 2)
|
if (nargin == 2)
|
||||||
% standard case, just call optimize
|
% standard case, just call optimize
|
||||||
retInt = optimize(int, optType);
|
retInt = optimize(int, optType);
|
||||||
@ -44,7 +47,8 @@ else
|
|||||||
% load parameter/value pairs into an array
|
% load parameter/value pairs into an array
|
||||||
parNames(i) = cellstr(varargin{nextMem});
|
parNames(i) = cellstr(varargin{nextMem});
|
||||||
parValues(i) = {varargin{nextMem+1}};
|
parValues(i) = {varargin{nextMem+1}};
|
||||||
% if (~ischar(parArr(i)))
|
|
||||||
|
% if (~isstr(parNames(i)))
|
||||||
% error('invalid argument, member names must be char');
|
% error('invalid argument, member names must be char');
|
||||||
% end
|
% end
|
||||||
nextMem = nextMem+2;
|
nextMem = nextMem+2;
|
||||||
@ -52,6 +56,6 @@ else
|
|||||||
int.optParams = parNames;
|
int.optParams = parNames;
|
||||||
int.optParamValues = parValues;
|
int.optParamValues = parValues;
|
||||||
retInt = optimize(int, optType, output);
|
retInt = optimize(int, optType, output);
|
||||||
int.optParams = [];
|
retInt.optParams = [];
|
||||||
int.optParamValues = [];
|
retInt.optParamValues = [];
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user