-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #530 from vlnistor/I-356/batch-search
Batch search inside stack search
- Loading branch information
Showing
11 changed files
with
207 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class BatchSearchManager: | ||
def __init__(self, stack_search, search_list, min_observations): | ||
"""Manages a batch search over a list of Trajectory instances using a StackSearch instance. | ||
Parameters | ||
---------- | ||
stack_search: `StackSearch` | ||
StackSearch instance to use for the batch search. | ||
search_list: `list[Trajectory]` | ||
List of Trajectory instances to search along the stack. | ||
min_observations: `int` | ||
Minimum number of observations required to consider a candidate. | ||
""" | ||
self.stack_search = stack_search | ||
self.search_list = search_list | ||
self.min_observations = min_observations | ||
|
||
def __enter__(self): | ||
# Prepare memory for the batch search. | ||
self.stack_search.prepare_search(self.search_list, self.min_observations) | ||
return self.stack_search | ||
|
||
def __exit__(self, *_): | ||
""" | ||
This method is called when exiting the context. | ||
It cleans up resources by calling `finish_search` on the StackSearch instance. | ||
We return False to indicate that we do not want to suppress any exceptions that may have been raised. | ||
""" | ||
# Clean up | ||
self.stack_search.finish_search() | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.