Effacer les filtres
Effacer les filtres

How can i use ga optimization to generate bit solutions in a vector?

1 vue (au cours des 30 derniers jours)
Vitor Ribeiro
Vitor Ribeiro le 7 Mai 2014
Modifié(e) : Alan Weiss le 16 Mai 2014
Hi.
I am trying to use optimization toolbox with ga solver or only with ga function to find a solution that contains only bit variables present in a vector with 9 positions. Each position contains 0 or 1, as a representation of the "on/off" of 9 branches in a distribution network.
I've set: Polpulation type as : bitString Creation funtion as : uniform Mutation function as: uniform Crossover funtion as: scaterred
As was said by toolbox warning that appears when bitString population is choosen.
I've defined an equality constraint to confine the solutions to 6 and only 6 bits. For that, I set:
Aeq=[1,1,1,1,1,1,1,1,1].
beq=6
The problem is that generated solutions are not only bits. Some solutions do not respect the population type specified, so they are not valid.
I mean, when it should generate solutions like [1,1,1,1,1,1,0,0,0].
In many cases it generates a solution like [1.6161, 0, 0, 0.7306, 0, 0.7306, 0.7306, 0.7306, 0].
So I do not understand what is happening, and I think that I am probably missing some parameter that is adulterating the solutions generated in each iteration.
So if anyone can help me I really appreciate.
Best regards, Vitor Ribeiro.

Réponse acceptée

Alan Weiss
Alan Weiss le 8 Mai 2014
The bit string population type does not accept linear constraints, as the documentation states.
I suggest that you use mixed integer GA. This form does not take equality constraints, but, as documented, you can use two inequality constraints, possibly with a bit of slack.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  2 commentaires
Vitor Ribeiro
Vitor Ribeiro le 15 Mai 2014
Firstly, I want you to know that I very appreciate your answer.
So, I tried to use your recommendation but I'm affraid that I may not be able to do that changes, cause I am not so conversant with toolbox as I probably should.
If I wanted to keep bit string population, could I create a nonlinear constraint function for having [9x1] vector solutions with all nine positions composed by bits and only 6 positions of a solution with bit 1? Limiting all inside a nonlcon funtion?
If yes, pls tell me how to learn creating nonlinear constraints.
Thanks by answering me. I really appreciate that.
Regards, Vitor Ribeiro.
Alan Weiss
Alan Weiss le 15 Mai 2014
Modifié(e) : Alan Weiss le 16 Mai 2014
The documentation link I gave states the following for the bit string population type:
You cannot use a Hybrid function, and ga ignores all constraints, including bounds, linear constraints, and nonlinear constraints.
It is very easy to use mixed integer GA, I suggest again that you look at it.
Alan Weiss
MATLAB mathematical toolbox documentation

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by