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

Optimise function calls in built-in algorithms #15

Closed
saxarona opened this issue Jan 28, 2023 · 1 comment
Closed

Optimise function calls in built-in algorithms #15

saxarona opened this issue Jan 28, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@saxarona
Copy link
Collaborator

Right now, algorithms use the code almost verbatim—as presented in Kochenderfer's book. However, there a few improvements that can be made regarding function calls.

As an example, the old version of the GA algorithms had an additional step in which the function was evaluated at the end to find the optimum before reporting it. This would extract the index in the population. To return the fitness, the function was evaluated again on that individual, as the fitness was not being saved. This resulted in an extra call.

We solved it by using the findmin function, which allowed us to return both the minimum and its index. In this way we make 1 fewer call.

Is it worth it if it's just 1 fewer call? Yes, because maybe each evaluation takes a million seconds to complete. We want to keep it at minimum.

@saxarona saxarona added the enhancement New feature or request label Feb 28, 2023
@saxarona
Copy link
Collaborator Author

Closing this one as we continue in a project now. See updates in #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant