About the Multi-Agent Planning Ontology (maPO)

As multi-agent systems become more autonomous, particularly in complex coordination tasks like Multi-Agent Path Finding (MAPF), the need for transparent and interpretable decision-making becomes critical. While execution traces from MAPF algorithms provide rich insight, existing methods for explainability remain fragmented.

We introduce the Multi-Agent Planning Ontology (maPO), a unified semantic schema designed to transform raw MAPF traces into a single, queryable knowledge graph. This ontology formalizes key concepts like segmentation snapshots, conflict alerts, and replanning strategies, making the planner's behavior transparent and auditable.

History: maPO builds on Planning Ontology (PO) and extends it to multi-agent planning needs.

The Problem

Coordinating multiple autonomous agents to reach individual goals without collisions is a foundational challenge in robotics and AI. Modern planners, search-based or learning-based approaches, achieve high performance but often act as "black boxes," offering little transparency into their decision-making processes. This lack of interpretability is a major barrier to deploying these systems in safety-critical applications.

Our Solution

The maPO framework provides a structured, planner-agnostic way to represent and query MAPF execution data. By ingesting planner outputs and transforming them into ontology instances, we can use SPARQL queries to generate on-demand, human-readable explanations for complex behaviors. This approach allows us to answer "why" questions about an agent's path, delays, and plan changes without modifying the underlying planning algorithms.

Key Contributions

  • The MA-Ontology (maPO) Schema: A formal ontology that captures MAPF-specific constructs, including agent properties, collision events, and replanning strategies.
  • Log-to-Graph Pipeline: A transformation process that turns standard planner logs into a rich knowledge graph.
  • SPARQL-based Explanation Generation: A framework for generating logical and contrastive explanations through standardized queries.

The maPO Schema

Ontology Diagram

MA-Ontology Schema Diagram

The maPO schema, illustrating the classes and properties for modeling the MAPF planning and conflict-resolution workflow.

The maPO extends the foundational concepts of the standard Planning Ontology (PO) to address the unique complexities of multi-agent scenarios. It creates a formal, queryable knowledge base that supports on-demand explainability. To ensure interoperability, maPO reuses concepts from established W3C and IEEE standards.

Core Components

  • Agent and State Representation: Models each agent's identity, capabilities, and location at specific points in time. The ma:Agent class is defined as a subclass of both plan:ProblemObject and sosa:Platform to ground it as an entity capable of perception and action.
  • Multi-Agent Plan Representation: Defines the hierarchy of a global ma:JointPlan composed of individual ma:AgentSubPlan instances. It distinguishes between the initial ma:OriginalSubPlan and any subsequent ma:ResolvedSubPlan generated after conflict resolution.
  • Conflict and Resolution Modeling: Captures the entire lifecycle of a conflict, from a ma:CollisionEvent to a ma:ConflictAlert and the resulting ma:ReplanningStrategy. It uses the PROV Ontology (PROV-O) to create a traceable, auditable record of how and why a plan was revised, using properties like prov:wasDerivedFrom to link plan versions.

Ontologies Reused

To ground our ontology in established semantic standards and enhance interoperability, maPO reuses concepts from several widely adopted resources:

  • SOSA/SSN: To model agents as platforms capable of sensing and acting.
  • Provenance Ontology (PROV-O): To formally link original and revised plans, creating a traceable history of the planner's conflict resolution decisions.
  • OWL-Time: To represent time instants and intervals for events, states, and path segments.
  • CORA: To define agent capabilities in a structured manner.
  • RDF Schema: To structure agent path sequences and other foundational data types.

Ontology Prefixes

Prefix IRI
ma http://example.org/ma#
plan https://ai4society.github.io/planning-ontology#
owl http://www.w3.org/2002/07/owl#
prov http://www.w3.org/ns/prov#
rdf http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs http://www.w3.org/2000/01/rdf-schema#
sosa http://www.w3.org/ns/sosa/
time http://www.w3.org/2006/time#
xsd http://www.w3.org/2001/XMLSchema#

Use Cases & Competency Questions

To ensure our ontology effectively supports explainability, its design was guided by a set of competency questions (CQs). These questions represent concrete explanatory needs an end-user would have when analyzing a multi-agent plan.

  • C1: Which CollisionEvents (including their time, type, location, and involved agents) were detected during planning?
  • C2: For a given CollisionEvent, which agent(s) received a ConflictAlert?
  • C3: What was an agent's original, conflict-unaware plan, and how does it compare to its final, resolved plan?
  • C4: Why did a specific agent have to wait or reroute in its final plan?
  • C5: For a given ConflictAlert, which ReplanningStrategy did the agent use?
  • C6: What was the cost change associated with a revised AgentSubPlan?
  • C7: Why was a particular agent (from a set of conflicting agents) chosen to be the one to replan? (i.e., what was the planner's selectionRationale?)
  • C8: What is the final JointPlan after all conflicts are resolved, and what is its overall makespan?

Below are key examples of how these questions are answered, along with the SPARQL queries and Natural Language templates used to generate the explanations.

C1 & C2: List an Agent's Conflicts

Purpose: In a MAPF setting, this question is fundamental for debugging and analysis. It helps diagnose why a plan might be inefficient or complex by pinpointing every moment of contention (a vertex or edge conflict) that the planner had to resolve for a specific agent. It identifies the "what, where, when, and who" of every conflict.

SPARQL Query

SELECT ?conflict ?timestamp ?type 
  (GROUP_CONCAT(DISTINCT ?otherAgentName; separator=", ") as ?involvedAgents) 
  (GROUP_CONCAT(CONCAT("(", STR(?y), ",", STR(?x), ")"); separator=";") as ?locations) 
WHERE { 
  ?conflict a ma:CollisionEvent ; 
            ma:involvesAgentsEvent ma:agent-1, ?otherAgent ; 
            ma:occursAtTime/time:inXSDDateTimeStamp ?timestamp ; 
            ma:conflictTypeEvent ?type ; 
            ma:conflictLocation ?locNode . 
  ?locNode ma:xCoordinate ?x ; ma:yCoordinate ?y . 
  FILTER(?otherAgent != ma:agent-1) 
  BIND(STRAFTER(STR(?otherAgent), "#") AS ?otherAgentName) 
} GROUP BY ?conflict ?timestamp ?type ORDER BY ?timestamp

Natural Language Template

[Agent Name] was involved in these conflicts (highlighted on grid):
Time: [timestamp]
Type: [type]
Location: [locations]
With: [involvedAgents]

C4: Explain Why an Agent Waited

Purpose: This is crucial for understanding plan sub-optimality. Waiting is a primary strategy to avoid collisions, but it directly impacts an agent's travel time and the overall plan efficiency (makespan). This query provides a direct causal link, explaining that a wait was not arbitrary but a necessary action to prevent a specific, identified conflict with another agent.

SPARQL Query

SELECT ?startTS ?endTS ?otherAgentName ?conflictTS ?x ?y 
WHERE { 
  ?resolvedPlan a ma:ResolvedSubPlan; ma:belongsToAgent ma:agent-1 . 
  FILTER EXISTS { ma:FinalJointPlan ma:composedOfSubPlans ?resolvedPlan . } 
  ?resolvedPlan ma:planData ?seg1, ?seg2 . 
  ?seg1 ma:hasPathSequence/rdf:rest*/rdf:first ?locNode . 
  ?seg1 ma:hasValidTime/time:hasBeginning/time:inXSDDateTimeStamp ?startTS . 
  ?seg2 ma:hasPathSequence/rdf:rest*/rdf:first ?locNode . 
  ?seg2 ma:hasValidTime/time:hasBeginning/time:inXSDDateTimeStamp ?endTS . 
  ?resolvedPlan ma:resolvesConflict ?conflict . 
  ?conflict ma:involvesAgentsEvent ?otherAgent ; 
            ma:occursAtTime/time:inXSDDateTimeStamp ?conflictTS ; 
            ma:conflictLocation ?locNode . 
  ?locNode ma:xCoordinate ?x ; ma:yCoordinate ?y . 
  FILTER(?otherAgent != ma:agent-1) 
  BIND(STRAFTER(STR(?otherAgent), "#") AS ?otherAgentName) 
}

Natural Language Template

[Agent Name] had to wait for a total of [Total Wait] second(s) in its final plan. 
This was necessary to avoid a planned conflict with [Other Agent Name] that would have occurred at ([X],[Y]) at T=[Conflict Time].

C3, C5, C7: Show Plan Change & Rationale

Purpose: This provides a complete audit trail of the planner's reasoning. It addresses contrastive questions ("Why this path and not the original one?") by showing the sequence of conflict-detection and resolution steps. It reveals not only *that* a plan changed, but also the specific strategy and justification (the selectionRationale) the planner used at each decision point, making the entire process transparent.

SPARQL Query

SELECT ?planType ?planCost ?timestamp ?x ?y ?rationale (GROUP_CONCAT(DISTINCT ?otherAgentName) AS ?otherAgents)
WHERE {
  BIND(ma:agent-1 AS ?agent)
  { 
    ?plan a ma:OriginalSubPlan ; ma:belongsToAgent ?agent .
    BIND("Original Plan" as ?planType) ...
  } UNION {
    ?plan a ma:ResolvedSubPlan ;
          ma:belongsToAgent ?agent ;
          ma:resolvesConflict ?conflict ;
          ma:generatedBy ?activity .
    ?activity prov:used/ma:triggeredBy/ma:selectionRationale ?rationale .
    ?conflict ma:occursAtTime/time:inXSDDateTimeStamp ?timestamp ;
              ma:conflictLocation ?locNode ;
              ma:involvesAgentsEvent ?otherAgent .
    ?locNode ma:xCoordinate ?x ; ma:yCoordinate ?y .
    FILTER (?otherAgent != ?agent)
    BIND("Resolved Plan" as ?planType)
    BIND(STRAFTER(STR(?otherAgent), "#") as ?otherAgentName)
  }
} GROUP BY ?plan ?planType ?planCost ?timestamp ?x ?y ?rationale ORDER BY ?timestamp

Natural Language Template

A conflict occurred at location [Locations]. To resolve the conflict with [Other Agent Name], [Replanning Agent Name] changed its plan. 
This changed the plan cost from [Original Cost] to [New Cost].
Rationale: Using a [Alert Type] strategy, [Rationale].

C6 & C8: Global & Agent-Specific Performance

Purpose: These queries provide a high-level summary of the final solution's quality. C8 (makespan) is a key metric for overall efficiency, while C6 (per-agent cost) helps identify which agents had the most difficult or longest paths. This is essential for evaluating whether the plan is balanced and fair, or if certain agents bear a disproportionate burden.

SPARQL Queries

# Query for Global Makespan (C8)
SELECT ?makespan WHERE {
  ma:FinalJointPlan ma:hasGlobalMakespan ?makespan .
}

# Query for Per-Agent Final Cost (C6)
SELECT (STRAFTER(STR(?agent), "#") AS ?agentName) ?cost WHERE {
  ma:FinalJointPlan ma:composedOfSubPlans ?plan .
  ?plan ma:belongsToAgent ?agent ;
        ma:hasPlanCost ?cost .
}

Natural Language Template

Here is a summary of the final joint plan:
The overall makespan is [Makespan].
The sum of individual plan costs is [Sum of Costs].
To achieve this solution, a total of [Replan Count] replans were required.

Interactive Demo

Explore the capabilities of the maPO framework through our interactive dashboard. The demo allows you to upload a knowledge graph generated from a MAPF planner's trace and visually analyze the solution. You can step through the simulation, inspect conflicts, and ask natural language questions to generate real-time explanations.

Key Features

  • Knowledge Graph Upload: Start by uploading a `.ttl` file containing the MAPF execution trace.
  • Grid Simulation: Visualize the multi-agent plan on a grid, with agents, obstacles, and paths clearly marked.
  • Time-Step Simulation: Use the slider to step through the plan execution and see agent movements over time.
  • Explanation Panel: Click on agents or grid cells to ask context-specific questions, or choose from a list of general queries to understand the plan's global properties.
  • SPARQL Query Interface: For advanced users, an integrated SPARQL editor allows you to run custom queries against the loaded knowledge graph.

Demo Video