Particle swarm optimization (6)-----Several evaluation functions of fitness

Source: Internet
Author: User

Several fitness evaluation functions are given, and the graphical representation is given.

The first few days of the virus, reinstall the system, accidentally the program all formatted, crying!!! No way, a lot of programs are missing, now put these several typical functions rewritten, give them out, even if the particle swarm algorithm is an end! Hate virus!!!!

The first function: The Griewank function, the graph looks like this:

The fitness function is as follows: (for maximum value, I went to the opposite number of all function values)

function y=Griewank(x)
%Griewan函数
%输入x,给出相应的y值,在x=(0,0,…,0)处有全局极小点0.
%编制人:
%编制日期:
[row,col]=size(x);
if row>1
     error('输入的参数错误');
end
y1=1/4000*sum(x.^2);
y2=1;
for h=1:col
     y2=y2*cos(x(h)/sqrt(h));
end
y=y1-y2+1;
y=-y;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.