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

fix parmameter doesnot match #328

Merged
merged 1 commit into from
Apr 23, 2019
Merged

Conversation

Kutim
Copy link
Contributor

@Kutim Kutim commented Apr 15, 2019

Sorry, I used the wrong branch in PR#324,Please ignore it.

Description

Fix:

when i use "RandomSearch" with parmameter "bounds", the class "SearchBase" method "generate_score" has a issue:

parmameter "self.vclamp" will be assign to parmameter "bh_strategy" in the "optimizer" ,
such as class "GlobalBestPSO",class "GeneralOptimizerPSO" and class "LocalBestPSO".

Should use python keyword argument to fix it

use python keyword argument to change

# pyswarms/utils/search/base_search.py line:101

self.n_particles, self.dims, options, self.bounds, self.vclamp

to

self.n_particles, self.dims, options, self.bounds, velocity_clamp=self.vclamp

Motivation and Context

Bug fix

How Has This Been Tested?

g = RandomSearch(GlobalBestPSO, n_particles=n_particles, dimensions=dimensions,
                 options=options, objective_func=targetfunction, iters=5, n_selection_iters=3, bounds=bounds)

best_score, best_options = g.search()

Screenshots (if appropriate):

The error I encountered is as follows:

The class "SearchBase" method "generate_score" has a issue: parmameter "self.vclamp" will be assign to parmameter "bh_strategy" in class "GlobalBestPSO",class "GeneralOptimizerPSO" and class "LocalBestPSO".
Should use python keyword argument to fix it
@ljvmiranda921 ljvmiranda921 self-requested a review April 23, 2019 22:54
@ljvmiranda921
Copy link
Owner

Hello @Kutim , sorry it took some time! LGTM! Thank you for your contribution!

@ljvmiranda921 ljvmiranda921 merged commit a04b7e5 into ljvmiranda921:master Apr 23, 2019
@ljvmiranda921
Copy link
Owner

@allcontributors[bot] please add @Kutim for bug fix

@allcontributors
Copy link
Contributor

@ljvmiranda921

I've put up a pull request to add @Kutim! 🎉

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

Successfully merging this pull request may close these issues.

2 participants