ODE15s vectorization in GA Optimization
2 views (last 30 days)
Show older comments
Hi there,
I'm trying to optimize a certain system. I'm using ga. There I've selected the 'UseVectorized' option.
options=optimoptions('ga','UseVectorized',true,'PopulationSize',popsize,'InitialPopulationMatrix',population);
I also provide a small initial population (17) for sake of initial tests. The problem has 16 variables.
[x,fval]=ga(@optimize_exp07_1,16,[],[],[],[],[],[],[],options);
The function @ODEfun is then integrated in regard to its 19 differential equations.
options = odeset('RelTol',1e-9,'Vectorized','on','MaxStep',1e-1);
[t,y]=ode15s(@ODEfun,experiment.timespan_min,y0,options);
Note that I selected 'Vectorized' as 'on' here as well. The @ODEfun, which calculate the derivatives, receives the following initial values y0:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/423948/image.jpeg)
The output (derivatives) is generated as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/423953/image.jpeg)
The problem is, in whatever format I try to return these derivatives, I get error from odeset:
19x17:
Error using odearguments (line 93)
POLYMERIZE/ODEFUN must return a column vector.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in polymerize (line 54)
[t,y]=ode15s(@ODEfun,experiment.timespan_min,y0,options);
323x1 (column vector):
Index exceeds matrix dimensions.
Error in odenumjac (line 151)
absFdelRm = abs(Fdel((0:ny-1)*nF + Rowmax));
Error in ode15s (line 353)
[dfdy,Joptions.fac,nF] = odenumjac(odeFcn, {t,y,odeArgs{:}}, f0, Joptions);
Error in polymerize (line 54)
[t,y]=ode15s(@ODEfun,experiment.timespan_min,y0,options);
Do you have any suggestion on how to make this vectorization of ODE15s work in this problem?
Thanks in advance!
3 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!