From 825696d0fa76239a007cb8ae0db37a3ece3a37ea Mon Sep 17 00:00:00 2001 From: crides <zhuhaoqing@live.cn> Date: Tue, 11 Oct 2022 14:46:49 -0500 Subject: [PATCH] no trace --- verse/analysis/simulator.py | 17 +++++++++-------- verse/scenario/scenario.py | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/verse/analysis/simulator.py b/verse/analysis/simulator.py index 77a9ab93..69e2f198 100644 --- a/verse/analysis/simulator.py +++ b/verse/analysis/simulator.py @@ -53,7 +53,7 @@ class Simulator: # Perform BFS through the simulation tree to loop through all possible transitions while simulation_queue != []: node: AnalysisTreeNode = simulation_queue.pop(0) - pp(("start sim", node.start_time, {a: (*node.mode[a], *node.init[a]) for a in node.mode})) + # pp(("start sim", node.start_time, {a: (*node.mode[a], *node.init[a]) for a in node.mode})) remain_time = round(time_horizon - node.start_time, 10) if remain_time <= 0: continue @@ -63,9 +63,9 @@ class Simulator: mode = node.mode[agent_id] init = node.init[agent_id] if self.config.incremental: - pp(("check hit", agent_id, mode, init)) + # pp(("check hit", agent_id, mode, init)) cached = self.cache.check_hit(agent_id, mode, init) - pp(("check hit res", agent_id, len(cached.transitions) if cached != None else None)) + # pp(("check hit res", agent_id, len(cached.transitions) if cached != None else None)) else: cached = None if agent_id in node.trace: @@ -85,7 +85,7 @@ class Simulator: trace[:, 0] += node.start_time trace = trace.tolist() node.trace[agent_id] = trace - pp(("cached_segments", cached_segments.keys())) + # pp(("cached_segments", cached_segments.keys())) # TODO: for now, make sure all the segments comes from the same node; maybe we can do # something to combine results from different nodes in the future node_ids = list(set((s.run_num, s.node_id) for s in cached_segments.values())) @@ -97,7 +97,7 @@ class Simulator: old_node = find(past_runs[old_run_num].nodes, lambda n: n.id == old_node_id) assert old_node != None new_cache, paths_to_sim = to_simulate(old_node.agent, node.agent, cached_segments) - pp(("to sim", new_cache.keys(), len(paths_to_sim))) + # pp(("to sim", new_cache.keys(), len(paths_to_sim))) # else: # print("!!!") @@ -115,7 +115,8 @@ class Simulator: node.trace[agent_idx] = node.trace[agent_idx][:transition_idx+1] if asserts != None: - print(transition_idx) + pass + # print(transition_idx) # pp({a: len(t) for a, t in node.trace.items()}) else: # If there's no transitions (returned transitions is empty), continue @@ -124,7 +125,7 @@ class Simulator: for agent_id in node.agent: if agent_id not in cached_segments: self.cache.add_segment(agent_id, node, [], full_traces[agent_id], [], transition_idx, run_num) - print(red("no trans")) + # print(red("no trans")) continue transit_agents = transitions.keys() @@ -186,7 +187,7 @@ class Simulator: ) node.child.append(tmp) simulation_queue.append(tmp) - print(red("end sim")) + # print(red("end sim")) # Put the node in the child of current node. Put the new node in the queue # node.child.append(AnalysisTreeNode( # trace = next_node_trace, diff --git a/verse/scenario/scenario.py b/verse/scenario/scenario.py index c0b9d27c..0c4d8adc 100644 --- a/verse/scenario/scenario.py +++ b/verse/scenario/scenario.py @@ -421,7 +421,7 @@ class Scenario: _transitions = [trans.transition for seg in cache.values() for trans in seg.transitions] # _transitions = [trans.transition for seg in cache.values() for trans in seg.transitions if trans_close(trans.inits, node.init)] - pp(("cached trans", _transitions)) + # pp(("cached trans", _transitions)) if len(_transitions) == 0: return None, None, 0 min_trans_ind = min(_transitions) @@ -432,7 +432,7 @@ class Scenario: # pp(("chosen tran", agent_id, tran)) cached_trans[agent_id].append((agent_id, tran.disc, tran.cont, tran.paths)) if len(paths) == 0: - print(red("full cache")) + # print(red("full cache")) return None, dict(cached_trans), min_trans_ind path_transitions = defaultdict(int) -- GitLab