ODE15s vectorization in GA Optimization
5 次查看(过去 30 天)
显示 更早的评论
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:
The output (derivatives) is generated as follows:
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!