error in fitness function (gaoptimset) ??? despite convex function gaoptimset does not optimise 2010b
Afficher commentaires plus anciens
I have a single variable objective function. This variable goes into my for loop.
irrespective of what lower and upper bonds I assign; initial range i give and with vectorize option 'on'.
does not optimize. I get following values
x: 100.000000.
fval: 8231923.58.
My objective function does have a convex behavior. this plot was generated by manually setting the forloop upto 10000

And went I set the options = gaoptimset(options,'Vectorized', 'off');
??? Subscripted assignment dimension mismatch.
Error in ==> fcnvectorizer at 14
y(i,:) = feval(fun,(pop(i,:)));
numberOfVariables = 1; % always 1
PopulationSize_input = 100; % can vary between 20 to 100
%%Bounds on our flowrate
lb =100; %100;
ub = 1000; %0.00050
%%---- parametarising Genetic algorithm-----------%%
options = gaoptimset;
% Modify options setting
%options = gaoptimset(options,'PopInitRange' ,[0 ; 0.00050]);
options = gaoptimset(options,'PopInitRange' ,[lb ; ub]);
options = gaoptimset(options,'MutationFcn' ,@mutationadaptfeasible);
options = gaoptimset(options,'CrossoverFcn' ,@crossoverarithmetic);
options = gaoptimset(options,'PopulationSize', PopulationSize_input);
options = gaoptimset(options,'Display', 'off');
options = gaoptimset(options,'PlotFcns', { @gaplotbestf @gaplotbestindiv @gaplotrange @gaplotselection });
options = gaoptimset(options,'Vectorized', 'off');
options = gaoptimset(options,'UseParallel', 'never');
%options = gaoptimset(options,'HybridFcn' ,@fminsearch);
%options = gaoptimset('OutputFcns', @gaoutputgen);
%options = gaoptimset(options,'OutputFcns' ,{ @gaplotbestf @gaplotbestindiv @gaplotrange @gaplotselection });
FitFcnn = @(f) HydraulicCOAX(f);
[x, fval] = ga(FitFcnn,numberOfVariables,[],[],[],[],lb,ub,[],options);
fprintf('The flow rate: %6.6f.\n',x);
fprintf('The Qeng: %6.2f.\n',fval);
Réponse acceptée
Plus de réponses (1)
Swarup
le 23 Mai 2014
0 votes
Catégories
En savoir plus sur Nonlinear Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!