Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

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

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics