@@ -37,8 +37,8 @@ def plan(grid: Grid, start_and_goals: list[StartAndGoal], single_agent_planner_c
3737
3838 # Generate initial solution (no constraints)
3939 for start_and_goal in start_and_goals :
40- path = single_agent_planner_class .plan (grid , start_and_goal .start , start_and_goal .goal , start_and_goal .index , verbose )
41- initial_solution [AgentId (start_and_goal .index )] = path
40+ path = single_agent_planner_class .plan (grid , start_and_goal .start , start_and_goal .goal , start_and_goal .agent_id , verbose )
41+ initial_solution [AgentId (start_and_goal .agent_id )] = path
4242
4343 if verbose :
4444 print ("Initial solution:" )
@@ -62,7 +62,7 @@ def plan(grid: Grid, start_and_goals: list[StartAndGoal], single_agent_planner_c
6262 # This means we found a solution!
6363 print (f"Found a path with constraints after { constraint_tree .expanded_node_count ()} expansions:" )
6464 print (f"Final cost: { constraint_tree_node .cost } " )
65- return (start_and_goals , [constraint_tree_node .paths [start_and_goal .index ] for start_and_goal in start_and_goals ])
65+ return (start_and_goals , [constraint_tree_node .paths [start_and_goal .agent_id ] for start_and_goal in start_and_goals ])
6666
6767 if not isinstance (constraint_tree_node .constraint , ForkingConstraint ):
6868 raise ValueError (f"Expected a ForkingConstraint, but got: { constraint_tree_node .constraint } " )
@@ -108,7 +108,7 @@ def plan(grid: Grid, start_and_goals: list[StartAndGoal], single_agent_planner_c
108108
109109 def get_agents_start_and_goal (start_and_goal_list : list [StartAndGoal ], target_index : AgentId ) -> StartAndGoal :
110110 for item in start_and_goal_list :
111- if item .index == target_index :
111+ if item .agent_id == target_index :
112112 return item
113113 raise RuntimeError (f"Could not find agent with index { target_index } in { start_and_goal_list } " )
114114
@@ -142,11 +142,11 @@ def plan_for_agent(constrained_agent: ConstraintTreeNode,
142142 grid .apply_constraint_points (all_constraints )
143143
144144 # Just plan for agent with new constraint
145- start_and_goal = ConflictBasedSearch .get_agents_start_and_goal (start_and_goals , constrained_agent .agent )
145+ start_and_goal : StartAndGoal = ConflictBasedSearch .get_agents_start_and_goal (start_and_goals , constrained_agent .agent )
146146 try :
147147 if verbose :
148148 print ("\t planning for: {}" , start_and_goal )
149- new_path = single_agent_planner_class .plan (grid , start_and_goal .start , start_and_goal .goal , start_and_goal .index , verbose )
149+ new_path = single_agent_planner_class .plan (grid , start_and_goal .start , start_and_goal .goal , start_and_goal .agent_id , verbose )
150150 return new_path
151151 except Exception as e :
152152 print (f"Error: { e } " )
0 commit comments