Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Optimization using Genetic Algorithm
Date: Mon, 7 Apr 2008 12:58:02 +0000 (UTC)
Organization: Pieper GmbH
Lines: 28
Message-ID: <ftd5oq$lje$1@fred.mathworks.com>
References: <fsqc4b$hab$1@fred.mathworks.com> <ftco9j$c80$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1207573082 22126 172.30.248.38 (7 Apr 2008 12:58:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 7 Apr 2008 12:58:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 605234
Xref: news.mathworks.com comp.soft-sys.matlab:461492



There is a mistake in the fitness function. Here is the 
corrected version:

function Result = Fitness(Individual)

% Check inequality constraints
if (Individual(1) > 200) && (Individual(1) < 650) ...
&& (Individual(2) > 0.2) && (Individual(2) < 0.6) ...
&& (Individual(3) > 200) && (Individual(3) < 550)

 % Fitness value of a parameter combination that fulfills
 % the constraints.

 Result = -(11445.34 + ...
            Individual * [0.1133 -0.0183 -0.07788]');

else

 % Fitness function of a parameter combination that 
 % violates the constraints. It seems that the objective
 % function can't get negative or zero, so zeros is a
 % suitable upper bound for the fitness function. 
 Result = 0;

end;

end