Skip to content

Commit

Permalink
Dev (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbussemaker authored Jan 9, 2025
2 parents 0a3c2d9 + 802c3a5 commit 13a43b4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sb_arch_opt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.5.4'
__version__ = '1.5.5'
1 change: 1 addition & 0 deletions sb_arch_opt/algo/segomoe_interface/algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def set_pop(self, pop: Population = None):
self._x = self._x_failed = self._y = None
else:
self._x, self._x_failed, self._y = self._get_xy(pop)
self._save_results()

def run_optimization(self):
capture_log()
Expand Down
5 changes: 3 additions & 2 deletions sb_arch_opt/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,9 @@ def _correct_x(self, x: np.ndarray, is_active: np.ndarray):
"""

def __repr__(self):
"""repr() of the class, should be unique for unique Pareto fronts"""
raise NotImplementedError
"""repr() of the class, should be unique for unique Pareto fronts. As fallback it returns a random repr."""
import random
return f'{self.__class__.__name__}{random.randint(1000000, 9999999)}()'


class ArchOptRepair(Repair):
Expand Down
13 changes: 13 additions & 0 deletions sb_arch_opt/tests/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,16 @@ def test_explicit_design_space():
problem_try_mod = DummyExplicitDesignSpaceProblem(write_x_out=True)
with pytest.raises(ValueError):
problem_try_mod.evaluate(x_all)


def test_ds_stub_problem():
problem = HierarchicalDummyProblem()
stub_problem = ArchOptProblemBase(problem.design_space)
x = HierarchicalSampling().do(stub_problem, 100).get('X')
assert x.shape[0] > 0

n = 12
problem = HierarchicalDummyProblem(n=n)
stub_problem = ArchOptProblemBase(problem.design_space)
x = HierarchicalSampling().do(stub_problem, 100).get('X')
assert x.shape[0] > 0

0 comments on commit 13a43b4

Please sign in to comment.