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

SPRINT: Refactor parts of the codebase #243

Closed
wants to merge 2 commits into from

Conversation

ljvmiranda921
Copy link
Owner

Description

A large pull request that deals mainly with refactoring some parts of the codebase. Specifically:

  • The tests for topology and high-level optimizers
  • Error-handling from LBYL to EAFP
  • Remove if-else hierarchy in General Optimizer

Related Issues

#232, #240, #241

Motivation and Context

It is important that we make our code scalable, and has a consistent design before we add bigger features.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ljvmiranda921 ljvmiranda921 added unit tests Test-related changes admin System-related and potential overrides v.1.1.0 In pipeline for next version refactor Better code quality, idiomatic Python labels Sep 10, 2018
@ljvmiranda921 ljvmiranda921 added this to the Refactor Sprint 11/15 milestone Sep 10, 2018
@ljvmiranda921 ljvmiranda921 self-assigned this Sep 10, 2018
@ljvmiranda921 ljvmiranda921 changed the title Sprint: Refactor parts of the codebase SPRINT: Refactor parts of the codebase Sep 11, 2018
@ljvmiranda921
Copy link
Owner Author

ljvmiranda921 commented Sep 11, 2018

Refactor GeneralOptimizer

Abstract compute_gbest into one API call

The idea is to change compute_gbest(self, swarm) into something like compute_gbest(self, swarm, **kwargs) so that all other params such as p, k, and r can be relegated locally to the topologies.
From this, you can just use one API call when calling compute_gbest here: https://github.com/ljvmiranda921/pyswarms/blob/development/pyswarms/single/general_optimizer.py#L260

Delegate error handling in __init__ to the actual topologies

Goal is to remove all error-handling in Generaloptimizer. Have the individual topologies handle that:

@ljvmiranda921 ljvmiranda921 deleted the refactor-code-sprint branch September 12, 2018 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin System-related and potential overrides refactor Better code quality, idiomatic Python unit tests Test-related changes v.1.1.0 In pipeline for next version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant