Path: news.mathworks.com!not-for-mail
From: "Dave Yap" <dyfw@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Optimization using Genetic Algorithm
Date: Wed, 14 Oct 2009 06:47:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 35
Message-ID: <hb3s56$1hb$1@fred.mathworks.com>
References: <fsqc4b$hab$1@fred.mathworks.com> <ftco9j$c80$1@fred.mathworks.com> <ftd5oq$lje$1@fred.mathworks.com>
Reply-To: "Dave Yap" <dyfw@hotmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255502822 1579 172.30.248.35 (14 Oct 2009 06:47:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 14 Oct 2009 06:47:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1933276
Xref: news.mathworks.com comp.soft-sys.matlab:577136


Dear OkinawaDolphin,

Good day to you. I've tried your suggested code on setting the upperbound and lowerbound values for a, b and c. However, when i run ga, it still gives me a value between 0 and 1. Hope to get some solutions from u.

Thanks.

"OkinawaDolphin " <OkinawaDolphin@Hotmail.com> wrote in message <ftd5oq$lje$1@fred.mathworks.com>...
> 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
>