MAPF

1 Introduction

In a shared environment, plan paths for multiple agents simultaneously, enabling each agent to reach its goal from its start position while avoiding collisions with each other. 

Collision types :

  • vertex conflict
  • edge conflict
  • following conflict

2 CBS (conflict-based search)

2.1 Two-level search structure.

High level: Conflict Tree. 1) detect conflict 2) add constrains.

Low level: Single-agent path planning (A*). Replan under constraints.

2.2 CBS Workflow:

  1. Plan shortest path for each agent independently.
  2. Detect if any conflicts exist
  3. Conflict found -> Split node, add constraint
  4. Replan conflicting Agent's path
  5. Repeat until no conflicts remain

3 Pseudocode

3.1 CBS

Function CBS (agents, grid):
	// High-level search
	root = Create new CT Node
	root.constraints = empty set
	// Plan path for each agent independently
	for each agent in agents:
		root.paths[agent] = LowLevel(agent, root.constraints, grid)
		if root.paths[agent] = null:
			return NO_SOLUTION

	root.cost = SumOfCost(root.paths)
	// Priority queue (sorted by cost)
	OPEN = {root}
	while OPEN is not empty:
		P = OPEN.pop()
		// Detect conflicts
		conflict = FindFirstConflict(P.paths)

		if conflict == null:
			return P.paths // No conflict, optimal solution found
		for each agent in conflict.agents:
			Q = Copy node P
			// Add new constraint
			newConstraint = Constraint(agent, conflict.location, conflict.time)
			Q.constraints = P.constraints + newConstraint
			// Replan
			Q.paths[agent] = LowLevel (agent, Q.constraints, grid)
			if Q.paths[agent] != null:
				Q.cost = SumOfCost(Q.paths)
				Open.add(Q)

3.2 Conflict Detection 

Function FindFirstConflict(paths) :
	maxTime = max(length of all paths) 
	for t = 0 to maxTime:
		for each pair(i, j) of agents:
			pos_i = GetPos(paths[i], t)
			pos_j = GetPos(paths[j], t)
			if pos_i == pos_j:
				return Conflict(VERTEX, [i,j], pos_i, t)
	return null

 

3.3 Low-level Search is a traditional A* Algorithm. It has another dimension t(time). And you can use huristic method to calculate G and H.

posted @ 2026-08-05 11:00  ylxn  阅读(1)  评论(0)    收藏  举报