-
Notifications
You must be signed in to change notification settings - Fork 334
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
Add Topologies #117
Merged
Merged
Add Topologies #117
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TODO
from backend.topology import Star
# ... inside the GlobalBestPSO class
def __init__():
topology = Star()
def optimize():
topology.compute_global_best()
|
Wow I solved it. 😮 |
This commit adds the Topology module's __init__ file. The concept behind this module is that if we can add topologies in a modular fashion, we can easily explore different PSO behaviour. Signed-off-by: Lester James V. Miranda <ljvmiranda@gmail.com>
This commit adds the base Topology class that must be inherited by any topology implementation. It raises a NotImplementedError whenever the compute_gbest(), compute_position(), and compute_velocity() are not called. I decided to put the compute_position() and compute_velocity() methods here because there may be cases where these operations are controlled by the Topology itself. In case, standard implementations are required, pyswarms.backend.operators should suffice. Signed-off-by: Lester James V. Miranda <ljvmiranda@gmail.com>
This commit adds the Star class topology for the GlobalBestPSO implementation. Signed-off-by: Lester James V. Miranda <ljvmiranda@gmail.com>
In this commit, we move the global best computation to the Topology classes themselves, but keep the compute_pbest(), compute_position() and compute_velocity() so that people can reuse it. The position and velocity computations are standard implementations, so this is just imported by the Ring and Star topology classes in their own methods Signed-off-by: Lester James V. Miranda <ljvmiranda@gmail.com>
This commit adds the Ring class topology for the LocalBestPSO implementation. In the next iteration, we should start considering having a strict number of neighbors (static and dynamic). But let's solve the BinaryPSO first before going there. Signed-off-by: Lester James V. Miranda <ljvmiranda@gmail.com>
Both GlobalBestPSO and LocalBestPSO now uses the Topology backend. Hooray! Signed-off-by: Lester James V. Miranda <ljvmiranda@gmail.com>
ljvmiranda921
force-pushed
the
add-topologies
branch
from
June 6, 2018 12:24
c8015f8
to
b6d24e1
Compare
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The next few commits should fail, I don't have tests for it yet.