|
"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
|