sga_fitness_function.m

来自「一个matlab环境下编制的使用很方便的多目标程序」· M 代码 · 共 52 行

M
52
字号
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 + =
减小字号Ctrl + -
显示快捷键?