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);
Best Answer