jmejia8 / Metaheuristics.jl

High-performance metaheuristics for optimization coded purely in Julia.
https://jmejia8.github.io/Metaheuristics.jl/stable/
Other
255 stars 26 forks source link

Combinatorial Space #87

Closed atthom closed 1 year ago

atthom commented 1 year ago

I am using your package for an Integer/Boolean problem ( closely related to the N-queen problem) I can see that BitArraySpace and PermutationSpace are available. Is there an alternative for Combinatorial Spaces for Integer vectors? Also cardinality function is not accessible in the docs and from the package.

Thank you for this package. It is really easy to use and well-documented.

jmejia8 commented 1 year ago

Hi!

Is there an alternative for Combinatorial Spaces for Integer vectors?

Another alternative is to use box-constraints, and indicating integer values:

julia> f(x) = sum(diff(x));

julia> bounds = boxconstraints(ones(Int, 10), 100ones(Int, 10));

julia> optimize(f, bounds, GA)

The cardinality function will be accessible in following minor release, currently can be accessed from module SearchSpaces reexported by Metaheuristcs.jl:

julia> SearchSpaces.cardinality(bounds)
7766279631452241920

Suggestions, feature request or contributions are very welcome!