Skip to content

Commit

Permalink
Update pymoo version (#2145)
Browse files Browse the repository at this point in the history
### Changes

- Fixed `pymoo` version.
- Added patch for the `IntegerRandomSampling` to avoid errors.

### Reason for changes

- Bugfix
  • Loading branch information
KodiaqQ authored Sep 18, 2023
1 parent df3b70f commit b000230
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion nncf/experimental/torch/nas/bootstrapNAS/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
ValFnType = Callable[[TModel, DataLoaderType], float]


class FixIntegerRandomSampling(IntegerRandomSampling):
"""
Wrapper for the IntegerRandomSampling with the fix for https://github.com/anyoptimization/pymoo/issues/388.
"""

def _do(self, problem, n_samples, **kwargs):
n, (xl, xu) = problem.n_var, problem.bounds()
return np.column_stack([np.random.randint(xl[k], xu[k] + 1, size=(n_samples)) for k in range(n)])


class EvolutionaryAlgorithms(Enum):
NSGA2 = "NSGA2"

Expand Down Expand Up @@ -207,7 +217,7 @@ def __init__(
if evo_algo == EvolutionaryAlgorithms.NSGA2.value:
self._algorithm = NSGA2(
pop_size=self.search_params.population,
sampling=IntegerRandomSampling(),
sampling=FixIntegerRandomSampling(),
crossover=SBX(
prob=self.search_params.crossover_prob,
eta=self.search_params.crossover_eta,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def find_version(*file_paths):
"pandas>=1.1.5,<2.1",
"psutil",
"pydot>=1.4.1",
"pymoo @ git+https://github.com/anyoptimization/pymoo.git@695cb26923903f872c7256a9013609769f3cc2bd",
"pymoo>=0.6.0.1",
# The recent pyparsing major version update seems to break
# integration with networkx - the graphs parsed from current .dot
# reference files no longer match against the graphs produced in tests.
Expand Down

0 comments on commit b000230

Please sign in to comment.