Skip to content
Snippets Groups Projects
Commit 7020d461 authored by Jorn Hoofwijk's avatar Jorn Hoofwijk Committed by Bas Nijholt
Browse files

test the usage of a ConvexHull

parent 1e2713ee
No related branches found
No related tags found
1 merge request!127Resolve "(LearnerND) allow any convex hull as domain"
Pipeline #13252 passed
# -*- coding: utf-8 -*-
from ..learner import LearnerND
from ..runner import replay_log
from ..runner import replay_log, simple
from .test_learners import ring_of_fire, generate_random_parametrization
import scipy.spatial
def test_faiure_case_LearnerND():
log = [
......@@ -21,3 +22,15 @@ def test_faiure_case_LearnerND():
]
learner = LearnerND(lambda *x: x, bounds=[(-1, 1), (-1, 1), (-1, 1)])
replay_log(learner, log)
def test_interior_vs_bbox_gives_same_result():
f = generate_random_parametrization(ring_of_fire)
control = LearnerND(f, bounds=[(-1, 1), (-1, 1)])
hull = scipy.spatial.ConvexHull(control._bounds_points)
learner = LearnerND(f, bounds=hull)
simple(control, goal=lambda l: l.loss() < 0.1)
simple(learner, goal=lambda l: l.loss() < 0.1)
assert learner.data == control.data
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment