- Use the MATLAB® performance and memory tools to help diagnose what is going on in your code.
- Use patternsearch instead of ga for optimization. patternsearch is usually faster, more robust, and easier to tune than ga.
How to minimize RAM utilization in GA Optimization tool ?
3 次查看(过去 30 天)
显示 更早的评论
I want to use GA optimisation to minimise my function.
My main function , which I am using to minimise the quantity is:
function Z = WFD_optimization(para)
global theta mu Ks y_bar A Omega Psi Mw Md ag eqt g yd;
global tspan G dtt tResult xResult tf N_react t_react F_hor t_hor xw_abs aw_abs G_all;
global set_time stick_slip Fric_force;
angle = 20;
Ks = para(1);
pre_t = para(2);
wedge_damper_input_v1 %Read Input File
theta = angle*pi()/180; %wedge slope
y_bar=pre_t/Ks;
global A1 A2 B1 B2 C1 C2 Phi1 Phi2 Hpp Hpm Hmm Hmp ;
global count1 count2 count3 count4 count5 count6;
dt = dtt;
para = [theta;mu;E;I;L;Mw;Md;Ks;g;y_bar];
tspan = 0:dt:tf ;
tResult = [];
xResult = [];
[A1,A2,B1,B2,C1,C2,Psi,Phi1,Phi2,Hpp,Hpm,Hmm,Hmp] = get_const(para);
G_dir = 'E:\IITB\MTP\MATLAB\New\Chevron v2\Results\Actual EQ\elcentro vibrationdata\Input\';
G = earthquake_data(0.02,1/5,2,G_dir);
PGA=max(abs(G(:,3)));
eqn = 1; % Initial Equation
count=0;
while t0<tf-dtt
[t,x] = wedge_inte(dt,eqn,t0,x0);
if (sign(x(end,1)) ~= sign(x0(1,1)) && t0~=0)
[eqn,t0,x0,dt] = y1_change(t0,x0,t,x,eps,dt,eqn);
elseif sign(x(end,2)) ~= sign(x0(1,2))
[eqn,t0,x0,dt] = y2_change(t0,x0,t,x,eps,dt,eqn);
else
t0 = t(end,1);
x0 = x(end, : );
tResult = cat(1, tResult, t0);
xResult = cat(1, xResult, x0);
end
end
Z(1) = max(abs(xResult(:,1)));
% Z(2) = max(abs());
end
Its uses several other functions to run.
I am using optimtool UI for optimization. My LB are [500 500] and UB are [15000 20000]. I kept the population size 10 and stopping criteria- generation at 10 , get results quicker for testing my algorithm.
The avg time required to run this algorithm (Not in optimization), just to optain 1 'Z' value is around 250 secs.
When I run GA optimization, It runs for a day , then it stops as MATLAB is irresponsive. The same error show memory utilization of about 14.9GB and my RAM is 16GB.
I have kept RAM utilization at 100%.
What exactly is the problem in this algorithm, why the full RAM is required? What changes can I do in this algorithm to get results on this same PC (RAM 16GB)?
0 个评论
采纳的回答
Alan Weiss
2018-3-6
Your problem seems to be optimizing parameters of an ODE. I have no idea why your code uses so much memory, because you didn't provide details about what your code does.
Nevertheless, I suggest that you try two things:
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
0 个评论
更多回答(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!