def __init__(self, name: str, config: gymdata.EvaluateConfig, gympath: gymdata.GymPath, monitoring_q: mpq.Queue, endevent: multiprocessing.Event, logging_q: mpq.Queue, predict_request_qs: 'list[mpq.Queue]', predict_response_q: mpq.Queue, graph: GameGraph): super().__init__() graph.truncate_to_roots() self.name = name self._mcts_graphs = [graph.deepcopy(), graph.deepcopy()] self._mcts_searchtables = [dict(), dict()] self._mcts_current_expansions = set() self.config = config self.endevent = endevent self.logging_q = logging_q self.predict_request_qs = predict_request_qs self.predict_response_q = predict_response_q self.gympath = gympath self.monitoring_q = monitoring_q self.logger: logging.Logger self.debug_stats = { 'searches': 0, 'select_wait': [], 'predict_wait': [] } self.scores: 'list[int]' = []
def __init__(self, name: str, config: gymdata.SelfPlayConfig, gympath: gymdata.GymPath, monitoring_q: mpq.Queue, endevent: multiprocessing.Event, logging_q: mpq.Queue, predict_request_q: mpq.Queue, predict_response_q: mpq.Queue, graph: GameGraph): super().__init__() graph.truncate_to_roots() self.name = name self._mcts_graph = graph.deepcopy() self._mcts_searchtable = dict() self._mcts_current_expansions = set() self.config = config self.endevent = endevent self.logging_q = logging_q self.predict_request_q = predict_request_q self.predict_response_q = predict_response_q self.gympath = gympath self.monitoring_q = monitoring_q self.logger: logging.Logger self.debug_stats = { 'searches': 0, 'select_wait': [], 'predict_wait': [] } self._gamelogs = deque(()) self.modeliteration: int with open(self.gympath.modelinfo_file) as f: self.modeliteration = gymdata.ModelInfo.from_json( f.read()).iterationNr
def test_returntypes(Graph: GameGraph): assert isinstance(Graph.as_json(), str) assert Graph.truncate_to_roots() == None for v in sample(Graph.vertices, k=min(MAX_VERTEX_CHECK, len(Graph.vertices))): assert isinstance(Graph.children_at(v, autoexpand=True), tuple) assert isinstance(Graph.edges_at(v), set) assert isinstance(Graph.equivalenceclass_of(v), set) assert isinstance(Graph.representative_of(v), type(v)) assert isinstance(Graph.score_at(v), float) if not Graph.open_at(v): assert isinstance(Graph.terminal_at(v), bool) assert isinstance(Graph.numpify(v), ndarray) assert isinstance(Graph.deepcopy(), Graph.__class__)