Thread Subject: Genetic Algorithm and working with discrete variables

Subject: Genetic Algorithm and working with discrete variables

From: Mohammad

Date: 22 Aug, 2007 12:14:52

Message: 1 of 2

hello
How can I do in the GAtool (genetic algorithm toolbox) if
my variables are allowed to select from a set of special
discrete values? because it works with continuous ranges of
values. thanks. good luck

Subject: Genetic Algorithm and working with discrete variables

From: Thomas Clark

Date: 22 Aug, 2007 14:58:20

Message: 2 of 2

"Mohammad " <john.doe.nospam@mathworks.com> wrote in message
<fah9bs$lne$1@fred.mathworks.com>...
> hello
> How can I do in the GAtool (genetic algorithm toolbox) if
> my variables are allowed to select from a set of special
> discrete values? because it works with continuous ranges of
> values. thanks. good luck

I've not done it; but suggest that you get the mutation
function to optimise over a bounded continuous range; (say
0.5 to 8.5).

In this case, you would have 8 discrete variables. Round the
output of the mutation function - you get 1,2,3,4,5,6,7 or
8. Use the output to index into your discrete variable.

If you need to assign a continuous desirability function,
then do this:

x = [0.5 1 2 3 4 5 6 7 8 8.5];
y = [0 s1 s2 s3 s4 s5 s6 s7 s8 0];
% where sx is the score of
% the corresponding discrete variable
pp = pchip(x,y);
% don't use spline, or it'll
% oscillate like mad

% then access the desirability
% score using:
yi = ppval(xi);

Just a few ideas- hope it helps :)

Tom

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com