Skip to content
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

Errors using PM and MIPM mutations #72

Closed
mmiller-max opened this issue Nov 20, 2020 · 1 comment
Closed

Errors using PM and MIPM mutations #72

mmiller-max opened this issue Nov 20, 2020 · 1 comment
Labels

Comments

@mmiller-max
Copy link

Hi, thanks for the package!

I'm running into a couple of errors with PM and MIPM

using Evolutionary
f(x) = x[1]^2 + 1
x0 = [0]
res = Evolutionary.optimize(f, x0, GA(selection=ranklinear(1), mutation=PM([-1.0], [3.0])))
ERROR: AssertionError: Need to set p_int for integer variables

I think this is because this line needs to pass a dummy value for p_float before p:

return mipmmutation(lower, upper, p)

When I try with MIPM I get this

julia> res = Evolutionary.optimize(f, x0, GA(selection=ranklinear(1), mutation=MIPM([-1.0], [3.0])))
ERROR: InexactError: Int64(-0.9692105629432188)

Which I think is because this line will result in a float always:

S = u .^ (1 ./ P) # random var following power distribution

The second problem goes away when the initial condition is a vector of floats - should it always be this or is the intention for it to work with a vector of ints?

Cheers

@wildart wildart added the bug label Nov 30, 2020
@wildart
Copy link
Owner

wildart commented Nov 30, 2020

It's a bug, there is no truncation implemented for integer values.

@wildart wildart closed this as completed in 07d4547 Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants