📄 sga_fitness_function.m
字号:
function [ fitness ] = SGA_FITNESS_function( x )
% /*M-FILE FUNCTION SGA_FITNESS_function MMM SGALAB */ %
% /*==================================================================================================
% Simple Genetic Algorithm Pro Toolbox for Matlab 7.x
% ====================================================================================================
%
%File description:
%
% Fitness_function Function is an example fitness function
% Of Simple Genetic Algorithm Program (Version 1.0.0.3 )
% Support multi-dimesion parameters
%
%Input:
% User define-- in the format ( x1, x2, x3,... )
%Output:
% fitness-- is the fitness value
%
%Appendix comments:
%
%Usage:
% [ fitness ] = SGA_FITNESS_function( xi,... )
%===================================================================================================
% See Also: SGA_ENCODING ,
% SGA_DECODING ,
% SGA_SELECTION ,
% SGA_CROSSOVER,
% SGA_MUTATION,
% SGA_FITNESS_FUNCTION,
% SGA_FITNESS_EVALUATING,
% SGA_BENCHMARK_FUNCS,
% SGALAB
%
%===================================================================================================
%
%===================================================================================================
%Revision -
%Date Name Description of Change email Location
%27-Jun-2003 Chen Yi Initial version chen_yi2000@sina.com Chongqing
%14-Jan-2005 Chen Yi update 1003 chenyi2005@gmail.com Shanghai
%HISTORY$
%==================================================================================================*/
%SGA_FITNESS_function begin
%User can design their own fitness function here
%as a standard matlab function
fitness = (x-2)^2;
%
%SGA_FITNESS_function end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -