简体   繁体   中英

Recording CPU time for GA algorithm in Matlab using optimization toolbox

I am using global optimization toolbox to run genetic algorithm on Matlab. However, I do not see any documentation or function to record the CPU time.

You can use the function cputime explained here . It returns time in seconds. Although, tic and toc are a better choice for measuring performance in Matlab codes.

A sample code :

startTime = cputime;
% GA Code
endTime = cputime;
cpu_time_consumed = endTime - startTime;

我意识到,这也可以使用Matlab中提供的“运行和时间”选项来完成。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM