Analogical Plan Transfer in Robotics using Functorial Data Migrations


Applied Category Theory Special Session
AMS Joint Mathematics Meeting 2025

Angeline Aguinaldo

Ph.D. in Computer Science
University of Maryland, College Park

January 8, 2025

Talk Outline

  1. Plan Transfer in Robotics
  2. Analogies using Functors and Data Migrations
  3. Using Analogies in Planning
  4. Advantages + Limitations
  5. Future Work

Plan Transfer in Robotics

Transfer plan from the source (left) to the target (right) planning domain

Humanoid robot

Arms

Bins

Mobile robot

Lift

Box

Problem: Designing planning problems and running planners is time-consuming.
(Alnazer and Georgievski 2023) (Ingrand and Ghallab 2017)

Analogies from Cognitive Psychology

Analogies, according to cognitive psychology, are formed by structure mappings
(Gentner and Smith 2012)

Informal Definition: (Analogical Plan Transfer) Analogical plan transfer identifies structural similarities, or analogies, between planning domains and leverages these analogies to adapt plans from one domain to another. (Aguinaldo 2024)

Why analogies?

(Wilkins and DesJardins 2001) argued that an ideal planning system should mimic human behavior by using analogies to transfer solutions from one problem to another.

What are analogies?

According to (Gentner 1983), analogies:

  • have a one-to-one correspondence, each concept in the source domain maps to at most one concept in the target domain
  • adhere to the systematicity principle, where analogical maps connect large, densely connected systems of concepts, instead of just a handful of isolated concepts

Analogies as Functors

Analogies can be mathematically formalized as functors
and analogical transfer as functorial data migrations.

Delta Data Migration

A delta data migration, \(\Delta_F: \catSet{C} \rightarrow \catSet{C^{\prime}}\), is defined by a functor \(F: \cat{C}^{\prime} \rightarrow \cat{C}\). Explicitly:

For a given object \(X\) in \(\catSet{C}\),

\(\Delta_F(X) = X \circ F\)

For a given morphism \(\alpha: X \rightarrow Y\) in \(\catSet{C}\), \(\Delta_F\) acts on \(\alpha\) to produce the following morphism in \(\catSet{C^{\prime}}\)

\(\Delta_F(\alpha)_{c^{\prime}}: X(F(c^{\prime})) \rightarrow Y(F(c^{\prime}))\) for \(c^{\prime} \in \cat{C^{\prime}}\)

(David I. Spivak and Kent 2012)

Quick view of Delta Data Migration

\(\Delta_F : \cat{C}^{\prime} \xrightarrow{F} \cat{C} \xrightarrow{X} \cat{Set}\)

Conjunctive Data Migration

A conjunctive data migration, \(\Delta_F: \catSet{C} \rightarrow \catSet{C^{\prime}}\), is defined by a functor \(F: \cat{C}^{\prime} \rightarrow \cat{Diag^{op}(C)}\). Explicitly:

For a given object \(X\) in \(\catSet{C}\),

\(\Delta_F(X) = F^\ast(X) \circ F\) where,

\(F^\ast(X): \cat{Diag^{op}(C)} \xrightarrow{\cat{Diag^{op}(X)}} \cat{\cat{Diag^{op}(Set)}} \xrightarrow{\mathrm{lim}} \cat{Set}\)

For a given morphism \(\alpha: X \rightarrow Y\) in \(\catSet{C}\), \(\Delta_F\) acts on \(\alpha\) to produce the following morphism in \(\catSet{C^{\prime}}\)

\(\Delta_F(\alpha)_{c^{\prime}}: F^\ast(X)(c^{\prime}) \rightarrow F^\ast(Y)(c^{\prime})\) for \(c^{\prime} \in \cat{C}^{\prime}\)

(Evan Patterson 2021), (David I. Spivak 2021)

Quick view of Conjunctive Data Migration

\(\Delta_F : \cat{C}^{\prime} \xrightarrow{F} \cat{Diag^{op}(C)} \xrightarrow{F^\ast(X)} \cat{Set}\)

Types of Analogies (in analogical plan transfer)

Analogies with Task Planning

PDDL1 does not have built-in support for domain comparison or domain ontology alignment. Therefore, a new planning language that supports these capabilities is a prerequisite for analogical plan transfer. (Aguinaldo 2024)

State Transition System Model for Planning

  • States, \(S = \{s_0, s_1, s_2, \dots\}\) set of all possible states
  • Actions, \(A = \{a_0, a_1, a_2, \dots\}\) set of all possible actions
    • Preconditions, \(\mathrm{Pre}(a)\) conditions that must be true in the state for the action to be applied
    • Effects, \(\mathrm{Eff}(a)\) conditions are true in the state after the action is applied
  • Transition function, \(\gamma: A \times S \rightarrow S\) partial function that maps an action and a state to the resulting state
    • Checking applicability an action \(a \in A\) is at state \(s \in S\) if \(\gamma(a, s)\) is defined

(Ghallab, Nau, and Traverso 2004)

Source: https://www.aiai.ed.ac.uk/~gwickler/prop-fwd-ssp.html

Planning States as \(\cat{C}\)-sets

Definition: (\(\cat{C}\)-set, schema category) A \(\cat{C}\)-set is a functor from \(\cat{C} \rightarrow \cat{Set}\). \(\cat{C}\) is referred to as the schema category (i.e. ontology). \(\cat{Set}\) is a category whose objects are sets and whose morphisms are set function maps.

Example:

A \(\cat{C}\)-set, \(X\), that stores data about what boxes are on which surface.

The category of elements construction (Riehl 2016) makes \(X\) interoperable with RDF triple syntax (subject, predicate, object), facilitating its use in knowledge graphs (David I. Spivak and Kent 2012).

Planning Actions using Spans and DPO Rewriting

Definition: (\(\catSet{C}\)) The category \(\catSet{C}\) is a category whose objects are \(\cat{C}\)-set functors and whose morphisms are natural transformations.

A span in \(\catSet{C}\) is a diagram of shape (\(\bullet \leftarrow \bullet \rightarrow \bullet\)) in \(\catSet{C}\).

Actions are spans (\(\mathrm{Pre} \hookleftarrow \mathrm{Keep} \rightarrow \mathrm{Eff}\)) in \(\catSet{C}\)

Actions are applied to state \(X\) to produce state \(Y\) using Double-Pushout (DPO) Rewriting

(Aguinaldo et al. 2023)

\(\hookleftarrow\) is a monomorphism (e.g. injective function in \(\cat{Set}\)). \(\urcorner\) and \(\ulcorner\) is a pushout (e.g. quotiented disjoint union in \(\cat{Set}\)).

Planning using \(\catSet{C}\) and DPO Rewriting

Existing state-space planning algorithms can be adapted to work with this planning representation.

Example: ForwardPlan() executes depth-first search (DFS) to find a sequence of actions.

function ForwardPlan(world::ACSet, goal::ACSet, actions::Dict, 
                      action_limits::Dict, action_usage::Dict, 
                      plan::List)

  # Exit criteria: goal is reached if there is a monic morphism from goal to world
  if homomorphism(goal, world, monic=true) !== nothing 
    println("Goal reached.")
    return plan
  end

  # Find applicable actions for the current world state
  applicable = find_applicable_actions(world, actions)

  # Backtrack criteria: no applicable actions
  if length(applicable) <= 0
    throw("No applicable actions found! Terminate path...")
  end

  # Iterate over all applicable actions
  for action in applicable
    action_name = action.first
    match_morphism = action.second

    # Backtrack criteria: action applied too many times
    try
      if action_usage[action_name] >= action_limits[action_name]
        println("Abort path. Action used too many times.")
        continue
      end
    catch
      # Initialize action usage if it doesn't exist
      action_usage[action_name] = 1  
    end

    # Save current world state for backtracking
    prev_world = world
    selected_action = action[action_name].rule

    # Apply the selected action to the current world state
    try
      world = rewrite(selected_action, world)
    catch e
      throw("Could not apply action!")
    end

    # Record the action and corresponding match morphism in the current plan
    append!(plan, [selected_action => match_morphism])

    try
      # Recursively call ForwardPlan with updated world state
      plan = ForwardPlan(world, goal, actions, action_limits, 
                          action_usage, plan)
      return plan
    catch e
      # Backtrack to previous world state if path fails
      world = prev_world
      pop!(plan)
      println("Path failed. Try a different path.")
    end
  end

  # If no valid plan is found, report failure
  println("No plan found.")
end

Transfer using Functorial Data Migration, \(\Delta_F\)

High-level Steps in Analogical Plan Transfer

  1. Define the Source Domain: Start by defining the ontology, \(\cat{D}_S\), and actions, \(A_S\), for the source domain, \(\textbf{D}_S\).
  2. Define the Planning Problem: Establish the initial and goal states, \(P_S = (I, G)\) within domain \(\textbf{D}_S\).
  3. Plan: Solve for a valid plan, \(\pi_S\), that solves for \(P_S\) within domain \(\textbf{D}_S\).
  4. Define the Target Domain Ontology: Specify the target ontology, \(\cat{D}_T\), in the new domain, \(\textbf{D}_T\).
  5. Align Ontologies: Create a translation map, \(F: \cat{D}_T \rightarrow \cat{D}_S\), linking the types and predicates from the target domain ontology to the source domain ontology.
  6. Transfer the Plan: Use the translation map to transfer the grounded plan via \(\Delta_F\), resulting in \(\pi_T\).
  7. Validate the Plan: Check that the end state after \(\pi_T\) contains \(\Delta_F(G)\).

(Aguinaldo, Patterson, and Regli 2024)

Step #5 Align the ontologies

Step #6 and #7 Transfer and Validate the Plan

Stacking Blocks \(\sim\) Making a Sandwich

Kitchenworld ontology derived from AI2-Thor Object Type Documentation
(Allen Institute for Artificial Intelligence 2024)

Uses an ontology alignment map that is functorial

Result

Kitchenworld simulation from AI2-Thor (Allen Institute for Artificial Intelligence 2024)

Advantages and Limitations of Categorical Structure for Planning

Advantages

  • Preserves ontological structure when applying actions and transferring plans
  • Predictable runtime complexity w.r.t. PDDL and its extensions, e.g. typing and transitive closure constraints
  • Generalized transfer for pair of domains
  • Symbolic action (skill) generation

Limitations

  • Reliance on advanced mathematical theory
  • Higher runtime complexity for checking applicability of actions, \(O(n^k)\), w.r.t. PDDL, \(O(nk)\)
  • Depends on proper (functorial) ontological alignment
  • Difficulty handling structurally dissimilar domains

Areas of Future Work

Scaling Studies: Empirical and Theoretical

  • More planning and plan transfer problems
  • Scale by the size of the world state and ontology
  • Scale by length of plan
  • Design benchmarks, e.g. transfer accuracy
  • Study functoriality of migration for certain ontology maps

A Software Tool for Category Theory-Based Planning and Transfer

  • Run planners
  • Automate discovery of functorial ontology alignments
  • Perform analogical plan transfer
  • Compose plans with other plans using sequential transfer
  • Check plans satisfy abstract behavior using hierarchical transfer

Knowrob (Tenorth and Beetz 2017) and Factory of the Future (Schäfer et al. 2021) ontologies

Acknowledgements

Collaborators and Mentors

  • Evan Patterson, AlgebraicJulia
  • Kristopher Brown, AlgebraicJulia
  • Kevin Arlin, AlgebraicJulia
  • Owen Lynch, AlgebraicJulia
  • James Fairbanks, AlgebraicJulia
  • Brendan Fong, Topos Institute
  • David Spivak, Topos Institute
  • Jaime Ruiz, University of Florida
  • Sophie Libkind, Topos Institute
  • Nelson Niu, Univ. of Washington
  • Priyaa Varshinee Srinivasan, Tallin Univ. of Tech.
  • Spencer Breiner, NIST
  • Dana Nau, UMD
  • Yiannis Aloimonos, UMD
  • Dinesh Manocha, UMD
  • Huan Xu, UMD
  • Mark Fuge, UMD/ETH Zurich
  • Eswaran Subrahmanian, CMU/NIST
  • William Regli, UMD (Advisor)

Funding

  • Johns Hopkins University Applied Physics
  • Adv. Robotics for Manu. ARM-18-01
  • DARPA #HR00112220004

Thank you for your attention!

Angeline Aguinaldo

E-mail: [email protected]

Website: angelineaguinaldo.com

Appendix

What is category theory?

Category theory (Eilenberg and MacLane 1945) is often referred to as the “mathematics of mathematics”.

Connects different areas of mathematics by studying the relationships between structures.

Category theory has been applied in many domains outside mathematics1, and such works contribute to the field of Applied Category Theory (ACT).

Definition: (Category) A category, \(\cat{C}\), consists of:

  • a collection of objects, \(\text{Ob}(\cat{C})\)
  • a collection of morphisms for every pairs of objects, \(\text{Hom}_\cat{C}(X,Y)\) for \(X, Y \in \text{Ob}(\cat{C})\)
  • a composition operation, if \(f: X \rightarrow Y\), \(g: Y \rightarrow Z\) then \(g \circ f: X \rightarrow Z\)
  • an identity morphism for every object, \(1_X: X \rightarrow X\)

satisfying the associativity law \(h \circ (g \circ f) = (h \circ g) \circ f\) and unitality laws \(f \circ 1_x = f\) and \(1_y \circ f = f\) whenever these equations make sense.

Functors and natural transformations

Functors map, e.g. \(\; F: \cat{P(\{1,2\})} \rightarrow \cat{\mathbb{N}_{\leq}}\):

  • Objects to objects
  • Morphisms to morphisms
  • Preserves composition in the source category

Functors and natural transformations

Functors map, e.g. \(\; F: \cat{P(\{1,2\})} \rightarrow \cat{\mathbb{N}_{\leq}}\):

  • Objects to objects
  • Morphisms to morphisms
  • Preserves composition in the source category

Natural transformations map functors, e.g. \(\alpha: F \rightarrow G\):

  • Defines morphism in target category, \(\cat{\mathbb{N}_{\leq}}\), per object in source category, e.g. \(\cat{P(\{1,2\})}\)
  • Preserves composition in the source category

References

Aguinaldo, Angeline. 2024. “Sequential, Hierarchical, and Analogical Plan Transfer in Robotics.” Ph.D. Dissertation, University of Maryland, College Park.
Aguinaldo, Angeline, Evan Patterson, James Fairbanks, William Regli, and Jaime Ruiz. 2023. A Categorical Representation Language and Computational System for Knowledge-Based Planning.” In 2023 AAAI Fall Symposium on Unifying Representations for Robot Application Development.
Aguinaldo, Angeline, Evan Patterson, and William Regli. 2024. “Automating Transfer of Robot Task Plans Using Functorial Data Migrations.” https://arxiv.org/abs/2406.15961.
Allen Institute for Artificial Intelligence. 2024. AiTHOR Object Types Documentation.” https://ai2thor.allenai.org/ithor/documentation/objects/object-types.
Alnazer, Ebaa, and Ilche Georgievski. 2023. “Understanding Real-World AI Planning Domains: A Conceptual Framework.” In Service-Oriented Computing, edited by Marco Aiello, Johanna Barzen, Schahram Dustdar, and Frank Leymann, 3–23. Cham: Springer Nature Switzerland.
Brown, Kristopher, Evan Patterson, Tyler Hanks, and James Fairbanks. 2023. “Computational Category-Theoretic Rewriting.” Journal of Logical and Algebraic Methods in Programming 134: 100888. https://doi.org/https://doi.org/10.1016/j.jlamp.2023.100888.
Coecke, Bob, and Aleks Kissinger. 2017. “286Categorical Quantum Mechanics i: Causal Quantum Processes.” In Categories for the Working Philosopher. Oxford University Press. https://doi.org/10.1093/oso/9780198748991.003.0012.
Eilenberg, Samuel, and Saunders MacLane. 1945. General Theory of Natural Equivalences.” Transactions of the American Mathematical Society 58 (2): 231. https://doi.org/10.2307/1990284.
Evan Patterson. 2021. Categories of diagrams in data migration and computational physics.” https://www.algebraicjulia.org/assets/slides/topos-colloquium-2021.pdf.
Fong, Brendan, and David I. Spivak. 2018. Seven sketches in compositionality: An invitation to applied category theory. Cambridge University Press. https://arxiv.org/abs/1803.05316.
Gentner, Dedre. 1983. Structure Mapping: A Theoretical Framework for Analogy.” Cognitive Science 7: 155–70. file://localhost/Volumes/alexvanvenrooij 1/Elektronische Artikelen/Papers/Unknown/2004-34.pdf.
Gentner, Dedre, and L. Smith. 2012. Analogical Reasoning. 2nd ed. Vol. 1. Elsevier Inc. https://doi.org/10.1016/B978-0-12-375000-6.00022-7.
Ghallab, Malik, Craig Knoblock, Drew McDermott, Ashwin Ram, Manuela Veloso, Daniel Weld, and David Wilkins. 1998. PDDL - The Planning Domain Definition Language (Version 1.2).” Yale Center for Computational Vision; Control.
Ghallab, Malik, Dana Nau, and Paolo Traverso. 2004. Automated Planning: Theory and Practice. Morgan Kaufmann Publishers. https://doi.org/10.1016/B978-1-55860-856-6.X5000-5.
Ingrand, Félix, and Malik Ghallab. 2017. Deliberation for autonomous robots: A survey.” Artificial Intelligence 247: 10–44. https://doi.org/10.1016/j.artint.2014.11.003.
Patterson, Evan, Andrew Baas, Timothy Hosgood, and James Fairbanks. 2022. “A Diagrammatic View of Differential Equations in Physics.” Mathematics in Engineering 5 (2): 1–59. https://doi.org/10.3934/mine.2023036.
Patterson, Evan, Owen Lynch, and James Fairbanks. 2021. Categorical Data Structures for Technical Computing.” Compositionality 4 (5): 1–27. http://arxiv.org/abs/2106.04703.
Riehl, Emily. 2016. Category theory in context. Aurora: Dover Modern Math Originals. http://www.math.jhu.edu/$\sim$eriehl/context/%0Ahttps://store.doverpublications.com/048680903x.html.
Schäfer, Philipp Matthias, Franz Steinmetz, Stefan Schneyer, Timo Bachmann, Thomas Eiband, Florian Samuel Lay, Abhishek Padalkar, Christoph Sürig, Freek Stulp, and Korbinian Nottensteiner. 2021. Flexible Robotic Assembly Based on Ontological Representation of Tasks, Skills, and Resources.” Proceedings of the 18th International Conference on Principles of Knowledge Representation and Reasoning, KR 2021, 702–6. https://doi.org/10.24963/kr.2021/73.
Shinavier, Joshua, and Ryan Wisnesky. 2019. “Algebraic Property Graphs.” ArXiv abs/1909.04881.
Spivak, David I. 2021. Functorial aggregation.” ArXiv. http://arxiv.org/abs/2111.10968.
Spivak, David I., and Robert E. Kent. 2012. Ologs: A categorical framework for knowledge representation.” PLoS ONE 7 (1). https://doi.org/10.1371/journal.pone.0024274.
Spivak, David I, and Robert E Kent. 2011. Ologs: a categorical framework for knowledge representation.” PLOS ONE. https://arxiv.org/pdf/1102.1889.pdf.
Tenorth, Moritz, and Michael Beetz. 2017. Representations for robot knowledge in the KNOWROB framework.” Artificial Intelligence 247: 151–69. https://doi.org/10.1016/j.artint.2015.05.010.
Wilkins, D. E., and M. DesJardins. 2001. A call for knowledge-based planning.” AI Magazine 22 (1): 99–115.