Updates to the Matlab interface
This commit is contained in:
parent
023bea7ee2
commit
aff7042a51
@ -110,8 +110,10 @@ display(getOptions(int));
|
||||
if (isempty(int.initialRange))
|
||||
int.mp = eva2.server.go.problems.MatlabProblem(int.dim, int.range);
|
||||
else
|
||||
if (eq(size(int.range), size(int.initialRange)))
|
||||
if (isempty(int.range) || eq(size(int.range), size(int.initialRange)))
|
||||
int.mp = eva2.server.go.problems.MatlabProblem(int.dim, int.range, int.initialRange);
|
||||
%int.mp.getIndividualTemplate().setMutationOperator( ...
|
||||
% eva2.server.go.operators.mutation.MutateEAMixer(eva2.server.go.operators.mutation.MutateGASwapBits, eva2.server.go.operators.mutation.MutateGAUniform));
|
||||
else
|
||||
error('Mismatching dimensions of range and initial range!');
|
||||
end
|
||||
|
@ -32,10 +32,13 @@ if ((nargin == 2) || (nargin == 3))
|
||||
if (ischar(fTol)) ; fTol = str2num(fTol); end;
|
||||
|
||||
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.PopulationMeasureTerminator;
|
||||
import eva2.server.go.operators.terminators.PopulationMeasureTerminator.*;
|
||||
import eva2.server.go.operators.terminators.CombinedTerminator;
|
||||
import eva2.server.go.operators.terminators.EvaluationTerminator;
|
||||
import eva2.OptimizerFactory;
|
||||
import eva2.server.go.problems.MatlabProblem;
|
||||
|
||||
% set some default values if theyre not given
|
||||
% fminsearch, for example, always uses TolX and TolFun with default
|
||||
@ -46,11 +49,12 @@ if ((nargin == 2) || (nargin == 3))
|
||||
% construct Terminators
|
||||
if ((xTol > 0) && (fTol > 0))
|
||||
% both criteria are given, use combination
|
||||
convTerm = CombinedTerminator(FitnessConvergenceTerminator(fTol, int.opts.TolFunEvals, 1, 1), PhenotypeConvergenceTerminator(xTol, int.opts.TolXEvals, 1, 1), 1);
|
||||
convTerm = CombinedTerminator(MatlabProblem.makeFitConvTerm(fTol, int.opts.TolFunEvals), ...
|
||||
MatlabProblem.makePhenConvTerm(xTol, int.opts.TolXEvals), 1);
|
||||
else if (xTol > 0) % only phenotye convergence
|
||||
convTerm = PhenotypeConvergenceTerminator(xTol, int.opts.TolXEvals, 1, 1);
|
||||
convTerm = MatlabProblem.makePhenConvTerm(xTol, int.opts.TolXEvals);
|
||||
else if (fTol > 0 ) % only fitness covnergence
|
||||
convTerm = FitnessConvergenceTerminator(fTol, int.opts.TolFunEvals, 1, 1);
|
||||
convTerm = MatlabProbelm.makeFitConvTerm(fTol, int.opts.TolFunEvals);
|
||||
else
|
||||
convTerm = 'undef'; % signal that there is no terminator yet
|
||||
end
|
||||
|
@ -2,7 +2,7 @@ function testEvalFunc(int)
|
||||
% Test the fitness function output format.
|
||||
wordwidth=32;
|
||||
|
||||
if (isempty(int.range)==1)
|
||||
if (isempty(int.range))
|
||||
% binary problem
|
||||
s=sprintf('Binary problem of bitwidth %d', int.dim);
|
||||
disp(s);
|
||||
@ -21,8 +21,12 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
disp('Testing value: ')
|
||||
disp(x);
|
||||
if (isempty(int.range))
|
||||
msg=sprintf('\nTesting value: %d, bin.: %s', x, dec2bin(x, int.dim));
|
||||
else
|
||||
msg=sprintf('\nTesting value: %d', x);
|
||||
end
|
||||
disp(msg);
|
||||
|
||||
try
|
||||
if (isempty(int.args))
|
||||
|
Loading…
x
Reference in New Issue
Block a user