Skip to content

Commit 90740e8

Browse files
author
wkrokosz
committed
Add customizable number of points for simple runner ask
1 parent d0aab31 commit 90740e8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

adaptive/runner.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,11 +911,12 @@ def simple(
911911
npoints_goal: int | None = None,
912912
end_time_goal: datetime | None = None,
913913
duration_goal: timedelta | int | float | None = None,
914+
points_per_ask: int | None = 1
914915
):
915916
"""Run the learner until the goal is reached.
916917
917-
Requests a single point from the learner, evaluates
918-
the function to be learned, and adds the point to the
918+
Requests points from the learner, evaluates
919+
the function to be learned, and adds the points to the
919920
learner, until the goal is reached, blocking the current
920921
thread.
921922
@@ -946,6 +947,9 @@ def simple(
946947
calculation. Stop when the current time is larger or equal than
947948
``start_time + duration_goal``. ``duration_goal`` can be a number
948949
indicating the number of seconds.
950+
points_per_ask : int, optional
951+
The number of points to ask for between every interpolation rerun. Defaults
952+
to 1, which can introduce significant overhead on long runs.
949953
"""
950954
goal = _goal(
951955
learner,
@@ -958,7 +962,7 @@ def simple(
958962
)
959963
assert goal is not None
960964
while not goal(learner):
961-
xs, _ = learner.ask(1)
965+
xs, _ = learner.ask(points_per_ask)
962966
for x in xs:
963967
y = learner.function(x)
964968
learner.tell(x, y)

0 commit comments

Comments
 (0)