Browse code

add 'add_data' argument to the IntegratorLearner and raise an error when 'add_data=False'

Bas Nijholt authored on 18/07/2018 20:18:29
Showing 1 changed files
... ...
@@ -10,11 +10,11 @@ import numpy as np
10 10
 from scipy.linalg import norm
11 11
 from sortedcontainers import SortedSet
12 12
 
13
-from ..notebook_integration import ensure_holoviews
14 13
 from .base_learner import BaseLearner
15 14
 from .integrator_coeffs import (b_def, T_left, T_right, ns, hint,
16 15
                                 ndiv_max, min_sep, eps, xi, V_inv,
17 16
                                 Vcond, alpha, gamma)
17
+from ..notebook_integration import ensure_holoviews
18 18
 
19 19
 
20 20
 def _downdate(c, nans, depth):
... ...
@@ -414,7 +414,10 @@ class IntegratorLearner(BaseLearner):
414 414
                 self._stack.append(x)
415 415
         self.ivals.add(ival)
416 416
 
417
-    def ask(self, n):
417
+    def ask(self, n, add_data=True):
418
+        if not add_data:
419
+            raise NotImplementedError(
420
+                "Asking points irreversibly changes the learner's data structure.")
418 421
         points, loss_improvements = self.pop_from_stack(n)
419 422
         n_left = n - len(points)
420 423
         while n_left > 0: