Skip to content

Commit 13a43b4

Browse files
authored
Dev (#29)
2 parents 0a3c2d9 + 802c3a5 commit 13a43b4

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

sb_arch_opt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.5.4'
1+
__version__ = '1.5.5'

sb_arch_opt/algo/segomoe_interface/algo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def set_pop(self, pop: Population = None):
184184
self._x = self._x_failed = self._y = None
185185
else:
186186
self._x, self._x_failed, self._y = self._get_xy(pop)
187+
self._save_results()
187188

188189
def run_optimization(self):
189190
capture_log()

sb_arch_opt/problem.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,9 @@ def _correct_x(self, x: np.ndarray, is_active: np.ndarray):
464464
"""
465465

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

470471

471472
class ArchOptRepair(Repair):

sb_arch_opt/tests/test_problem.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,16 @@ def test_explicit_design_space():
498498
problem_try_mod = DummyExplicitDesignSpaceProblem(write_x_out=True)
499499
with pytest.raises(ValueError):
500500
problem_try_mod.evaluate(x_all)
501+
502+
503+
def test_ds_stub_problem():
504+
problem = HierarchicalDummyProblem()
505+
stub_problem = ArchOptProblemBase(problem.design_space)
506+
x = HierarchicalSampling().do(stub_problem, 100).get('X')
507+
assert x.shape[0] > 0
508+
509+
n = 12
510+
problem = HierarchicalDummyProblem(n=n)
511+
stub_problem = ArchOptProblemBase(problem.design_space)
512+
x = HierarchicalSampling().do(stub_problem, 100).get('X')
513+
assert x.shape[0] > 0

0 commit comments

Comments
 (0)