Skip to content

Commit 7020d46

Browse files
jhoofwijkbasnijholt
authored andcommitted
test the usage of a ConvexHull
1 parent 1e2713e commit 7020d46

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

adaptive/tests/test_learnernd.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- coding: utf-8 -*-
22

33
from ..learner import LearnerND
4-
from ..runner import replay_log
5-
4+
from ..runner import replay_log, simple
5+
from .test_learners import ring_of_fire, generate_random_parametrization
6+
import scipy.spatial
67

78
def test_faiure_case_LearnerND():
89
log = [
@@ -21,3 +22,15 @@ def test_faiure_case_LearnerND():
2122
]
2223
learner = LearnerND(lambda *x: x, bounds=[(-1, 1), (-1, 1), (-1, 1)])
2324
replay_log(learner, log)
25+
26+
def test_interior_vs_bbox_gives_same_result():
27+
f = generate_random_parametrization(ring_of_fire)
28+
29+
control = LearnerND(f, bounds=[(-1, 1), (-1, 1)])
30+
hull = scipy.spatial.ConvexHull(control._bounds_points)
31+
learner = LearnerND(f, bounds=hull)
32+
33+
simple(control, goal=lambda l: l.loss() < 0.1)
34+
simple(learner, goal=lambda l: l.loss() < 0.1)
35+
36+
assert learner.data == control.data

0 commit comments

Comments
 (0)