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

Support more benchmark functions #15

Closed
HaaLeo opened this issue Jul 21, 2020 · 12 comments · Fixed by #17
Closed

Support more benchmark functions #15

HaaLeo opened this issue Jul 21, 2020 · 12 comments · Fixed by #17
Labels
enhancement New feature or request visualization Issues related to the visualization framework.

Comments

@HaaLeo
Copy link
Owner

HaaLeo commented Jul 21, 2020

Description

The currently used benchmark functions namely ackley and michalewicz are hard coded in the library.
Consuming the functions instead via an external library (pypi package) could enable access to way more functions.

@HaaLeo HaaLeo added the enhancement New feature or request label Jul 21, 2020
@HaaLeo HaaLeo added the visualization Issues related to the visualization framework. label Jul 21, 2020
@NimishVerma
Copy link
Contributor

I would like to suggest pygmo for this. It even has benchmark CEC functions :). It is implementable but due to the project structure, there is a repetition of code. Each algorithm has its own subparser to get the argument of the evaluation function, is it possible to add this in the main parser file?

@HaaLeo
Copy link
Owner Author

HaaLeo commented Jul 22, 2020

I took a look at pygmo. Since swarmlib is shipped via pip, my only concern is that pygmo is only available for linux through pip (refernce). I do not know whether I want to drop support for windows and macOS "just" for a bunch of additional functions.
I also found opfunu. With this should be possible to still support all major platforms.

@NimishVerma
Copy link
Contributor

I have worked with pygmo in past in Windows as well, I dont have a MAC to check, but pretty sure it works out in MAC too.

@HaaLeo
Copy link
Owner Author

HaaLeo commented Jul 23, 2020

But you have installed it via pip? Ok then I'll give it a try an will check whether it works on macOS, too.

@HaaLeo
Copy link
Owner Author

HaaLeo commented Aug 4, 2020

Just tried to install pygmo via pip for macOSX. However it led to the following error:

(.venv) $ pip3 install pygmo
ERROR: Could not find a version that satisfies the requirement pygmo (from versions: none)
ERROR: No matching distribution found for pygmo

I think we cannot use pygmo until esa/pygmo2#6 or esa/pygmo2#32 is resolved.

@alxfmpl
Copy link
Contributor

alxfmpl commented Oct 16, 2020

What about landscapes? Looks pretty pythonic to me and has quite a few functions available.

@HaaLeo
Copy link
Owner Author

HaaLeo commented Oct 16, 2020

Hi @alxfmpl thank you for the suggestion. landscapes LGTM.
I just submitted a PR nathanrooy/landscapes#3 to add the michalewicz function to ensure backwards compability of swarmlib when using it as a dependency.

@alxfmpl
Copy link
Contributor

alxfmpl commented Oct 17, 2020

Maybe consider adding it as a optional dependency? I don't think it should be a hard requirement. I'm happy to help with this btw.

@HaaLeo
Copy link
Owner Author

HaaLeo commented Oct 18, 2020

What are the benefits of using it as an optional dependency? As it is lightweight package in pure python it would be ok for me to add it as normal dependency.

If you want to implement it, I am happy to review a PR on this.
You would basically have to adjust the main.py files of each algorithm that uses such a function.
To ensure backwards backwards compability I want the users still to be able to use the michalewicz and ackley functions.
So you can either wait until nathanrooy/landscapes#3 is merged or do something like:

if function == 'michalewicz':
    use swarmlibs implementation of michalewicz
else:
    if function in landscapes and 2D or n-dimensional:
         use landscapes function
    else:
        raise Error function is not supported

Maybe the implementation can be encapsulated in the functions.py, then we do not duplicate that much code. If you face any issues during the implementation, do not hesitate to ping me on gitter.

@alxfmpl
Copy link
Contributor

alxfmpl commented Oct 19, 2020

To ensure backwards backwards compability I want the users still to be able to use the michalewicz and ackley functions.

I think we're on the same page with this. I'm happy to implement it, but won't get round to have a deeper look into it until the end of the week. Will keep you posted though.

@nathanrooy
Copy link

Hi @HaaLeo, I've merged your Michalewicz function PR and updated the PyPi package.

@HaaLeo
Copy link
Owner Author

HaaLeo commented Oct 20, 2020

@nathanrooy thanks a lot for merging the PR that quick. I really appreciate it 👍🏼. @alxfmpl will take a look on how we can integrate landscapes into swarmlib later this week.

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

Successfully merging a pull request may close this issue.

4 participants