Skip to content

Commit

Permalink
remove more code
Browse files Browse the repository at this point in the history
  • Loading branch information
jrapin committed Feb 10, 2021
1 parent 6468afc commit b827283
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions nevergrad/parametrization/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ def satisfies_constraints(self) -> bool:
bool
True iff the constraint is satisfied
"""
if self._parameters is not None and not self.parameters.satisfies_constraints():
inside = self._treecall("satisfies_constraints")
if not all(inside):
return False
if not self._constraint_checkers:
return True
Expand Down Expand Up @@ -595,18 +596,6 @@ def _internal_spawn_child(self: D) -> D:
child._content = {k: v.spawn_child() for k, v in self._content.items()}
return child

def _set_random_state(self, random_state: np.random.RandomState) -> None:
super()._set_random_state(random_state)
for param in self._content.values():
if isinstance(param, Parameter):
param._set_random_state(random_state)

def satisfies_constraints(self) -> bool:
compliant = super().satisfies_constraints()
return compliant and all(
param.satisfies_constraints() for param in self._content.values() if isinstance(param, Parameter)
)


class Dict(Container):
"""Dictionary-valued parameter. This Parameter can contain other Parameters,
Expand Down

0 comments on commit b827283

Please sign in to comment.