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

Major API Changes for Emitter #207

Closed
wants to merge 29 commits into from
Closed

Conversation

itsdawei
Copy link
Collaborator

@itsdawei itsdawei commented Jun 13, 2022

Description

This PR introduces major API changes for the Emitter class. Emitter class now requires a Ranker object and a Selector object.

The Ranker object will define a rank function which returns the index of the solutions in the descending order that they should be in. It will also define a reset function which resets the internal states of the object.

RandomDirectionEmitter, OptimizingEmitter, and ImprovementEmitter are now all combined into EvolutionStrategyEmitter, which can be configured to use different Ranker's.

We also introduce FilterSelector and MuSelector objects which defines a select() function that decides how many parents to select from the potential parents.

EvolutionStrategyEmitter(x0, sigma0, ranker=Ranker, string, selector, ES, restart_rule, bounds, batch_size, seed)
If ranker=str, then we create the object for you

TODO

Rankers

  • Implement EvolutionStrategyEmitter
  • Implement ImprovementRanker
  • Implement TwoStageImprovementRanker
  • Implement RandomDirectionRanker
  • Implement TwoStageRandomDirectionRanker
  • Implement ObjectiveRanker
  • Implement TwoStageObjectiveRanker
  • Implement get_ranker(str) -> Ranker

Selector

  • MuSelector
  • FilterSelector

RestartChecker

  • come up with an API for this

Others

Status

  • I have read the guidelines in CONTRIBUTING.md.
  • I have formatted my code using yapf
  • I have tested my code by running pytest
  • I have linted my code with pylint
  • I have added a one-line description of my change to the changelog in HISTORY.md.
  • This PR is ready to go

@btjanaka
Copy link
Member

Make the directory name be rankers

@itsdawei itsdawei changed the title Major API Change for Emitter Major API Changes for Emitter Jun 13, 2022
@itsdawei itsdawei requested a review from btjanaka June 15, 2022 19:37
@itsdawei itsdawei added the API label Jun 15, 2022
@itsdawei itsdawei self-assigned this Jun 15, 2022
@itsdawei itsdawei added this to the v0.5.0 milestone Jun 15, 2022
@itsdawei itsdawei linked an issue Jun 15, 2022 that may be closed by this pull request
@itsdawei itsdawei removed this from the v0.5.0 milestone Jun 15, 2022
ribs/emitters/rankers/_ranker_base.py Outdated Show resolved Hide resolved
ribs/emitters/rankers/_ranker_base.py Outdated Show resolved Hide resolved
ribs/emitters/rankers/_ranker_base.py Outdated Show resolved Hide resolved
ribs/emitters/rankers/_ranker_base.py Outdated Show resolved Hide resolved
ribs/emitters/rankers/_two_stage_improvement_ranker.py Outdated Show resolved Hide resolved
ribs/emitters/selectors/_mu_selector.py Outdated Show resolved Hide resolved
ribs/emitters/selectors/_filter_selector.py Outdated Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Outdated Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Show resolved Hide resolved
@itsdawei itsdawei requested a review from btjanaka June 17, 2022 23:32
ribs/_docstrings.py Show resolved Hide resolved
ribs/_docstrings.py Show resolved Hide resolved
ribs/_docstrings.py Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Show resolved Hide resolved
ribs/emitters/_evolution_strategy_emitter.py Show resolved Hide resolved
ranker,
selector,
evolution_strategy,
restart_rule="no_improvement",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make a restarter object just like for selectors and rankers.

@itsdawei
Copy link
Collaborator Author

Closing this PR because the changes intended by this PR has been dealt with in #209, #217, and #220.

@itsdawei itsdawei closed this Jun 30, 2022
@btjanaka btjanaka deleted the emitter-major-api-change branch July 2, 2022 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce duplicate code between CMA-ME emitters
2 participants