Quantcast
Channel: MATLAB Central Newsreader - tag:"optimization"
Viewing all articles
Browse latest Browse all 130

Re: GA bit string constraint

$
0
0
You cannot have any direct constraints when using the 'bitstring' option in GA. However you could implement these constraints indirectly by including the constraint directly in your utility function.

EX.

constraint_factor = 1e5; % some really high number
utilityfunction = @(x) F(x) + constraint_factor*(sum(x) - .5)^2; % F(x) is your utility function

You can then define some tolerance eps, and then keep increasing constraint_factor until abs(sum(x) - .5) < eps.


"Dave B" wrote in message <iulb7j$g7f$1@newscl01ah.mathworks.com>...
> Hi I am using a GA with the bit string representation (0 1). Over the length of the bit string I need to constrain the proportion of 1s or 0s, e.g. for there to always be 50% 1s.
>
> Can anyone advise me on how to implement this please? I cannot seem to work it out. Thanks very much!

Viewing all articles
Browse latest Browse all 130

Trending Articles