运用粒子群和改进粒子群算法求解典型函数 具有可视化的功能

源代码在线查看: rosenbrock.m

软件大小: 737 K
上传用户: zhoubin2048
关键词: 粒子群 典型 函数 可视化
下载地址: 免注册下载 普通下载 VIP

相关代码

				% Rosenbrock.m
				% Rosenbrock function
				%
				% described by Clerc in ...
				% http://clerc.maurice.free.fr/pso/Semi-continuous_challenge/Semi-continuous_challenge.htm
				%
				% used to test optimization/global minimization problems 
				% in Clerc's "Semi-continuous challenge"
				%
				% f(x) = sum([ 100*(x(i+1) - x(i)^2)^2 + (x(i) -1)^2])
				% 
				% x = N element row vector containing [x0, x1, ..., xN]
				% each row is processed independently,
				% you can feed in matrices of timeXN no prob
				%
				% example: cost = Rosenbrock([1,2;5,6;0,-50])
				% note: known minimum =0 @ all x = 1
				
				% Brian Birge
				% Rev 1.0
				% 9/12/04
				function [out]=Rosenbrock(in)
				 
				 x0=in(:,1:end-1);
				 x1=in(:,2:end);
				
				 out = sum( (100*(x1-x0.^2).^2 + (x0-1).^2) , 2);			

相关资源