-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multidimensional individuals #35
Comments
If you are working with 2D arrays, you just need to write the fitness function to get a vector, the rest would look the same. using Evolutionary
using Base.Iterators
# Matrix 2x2
function eval_data(t::Matrix)
...
end
# x vector 4
function fitness(x::Vector)
input = collect( partition(x, 2) )
return eval_data( hcat(input...) )
end
es(fitness, 4) |
I considered this, but looking at the code, the restriction forcing inputs to be 1D vectors seems to be arbitrary and the only impact is on interpreting the initPopulation parameter - hence, my suggestion to widen support. I'm currently investigating this on a local fork. |
For me it makes no sense to use 2D arrays, you will have to modify the whole package, besides GA and DE consider vectors in their theoretical definition. As with convex optimization problems, you need to rewrite your problem before the solver can solve it. |
Majority of mutation and recombination operations work on vectors only. You'll need to write your own for 2D transfomations. |
Implemented in new api, see Docs/Dev/Population |
I'm currently looking at a problem I'm trying to apply GA to which has 2D individuals. This implementation only supports 1D individuals but I don't see any reason not to support individuals of arbitrary dimension.
Major changes required are to getIndividual and population generation. The easy way to do this would probably be to change the dimensionality parameter N to instead specify the type of an individual.
What are your thoughts?
The text was updated successfully, but these errors were encountered: