typing: core algorithm and its imports#666
Open
boombard wants to merge 1 commit intoanyoptimization:mainfrom
Open
typing: core algorithm and its imports#666boombard wants to merge 1 commit intoanyoptimization:mainfrom
boombard wants to merge 1 commit intoanyoptimization:mainfrom
Conversation
boombard
commented
Nov 27, 2024
|
|
||
| # filter the index to have individual where not all attributes have been evaluated | ||
| if skip_already_evaluated: | ||
| I = [i for i, ind in enumerate(pop) if not all([e in ind.evaluated for e in evaluate_values_of])] |
|
|
||
| class Population(np.ndarray): | ||
|
|
||
| def __new__(cls, individuals=[]): |
Author
There was a problem hiding this comment.
Mutable defaults are generally bad, so thought it would be okay to change this
| def merge(a: Population | np.ndarray | Individual | None, b: Population | np.ndarray | Individual | None) -> Population: | ||
| if a is None: | ||
| return b | ||
| assert b is not None, "Merge requires at least on non-empty Individual" |
Author
There was a problem hiding this comment.
Does this follow the intention here?
| if problem is None: | ||
| from pymoo.core.problem import Problem | ||
| problem = Problem() | ||
| # TODO: this line is probably never evaluated. It would raise as Problem is ABC |
| """ | ||
| # set decision variable vector to None | ||
| self._X = None | ||
| self._X: np.ndarray | None = None |
Author
There was a problem hiding this comment.
Is it necessary to assign None to these, or could they be empty as in reset below?
This file contains hidden or 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
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.
Issue #665
mypy now passes when run on
core.algorithm. I tried to avoid changing anything substantial. The tests are passing to the same extent as inmain.Because I was avoiding changing anything too much, there are a lot of ignore statements (there's only so much one can do with annotations).