Skip to content
Snippets Groups Projects
Commit 296dc067 authored by aastorg2's avatar aastorg2
Browse files

adding search_part to agbot

parent 42721b28
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,15 @@ import z3
from dtree_learner import DTreeLearner as Learner
from agbot_stanley_teacher import DTreeAgBotStanleyGurobiTeacher as AgBotTeacher
def search_part(partition, state):
assert len(partition) == len(state)
bounds = []
for sorted_list, v in zip(partition, state):
i = np.searchsorted(sorted_list, v)
if i == 0 or i == len(sorted_list):
return None
bounds.append((sorted_list[i-1], sorted_list[i]))
return tuple(bounds)
def load_examples_from_npz(file_name: str, teacher:AgBotTeacher, partition):
print("Loading examples from .npz")
......
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