novaplan-decentralized-priv.../nova_plan/interop_catopt.py

25 lines
849 B
Python

"""Interoperability facade between NovaPlan and CatOpt-like Canonical structs.
This module provides simple, importable helpers to convert between NovaPlan's
LocalProblem representations and the canonical CatOpt bridge objects defined in
nova_plan.catopt_bridge.
"""
from __future__ import annotations
from nova_plan.planner import LocalProblem
from nova_plan.catopt_bridge import ObjectI, Morphism, to_object, delta_to_morphism
from nova_plan.contracts import PlanDelta
def local_to_canon(local: LocalProblem) -> ObjectI:
"""Convert a LocalProblem to the canonical ObjectI form."""
return to_object(local)
def canon_delta_to_morphism(delta: PlanDelta) -> Morphism:
"""Convert a PlanDelta into a Morphism as seen by the CatOpt bridge."""
return delta_to_morphism(delta)
__all__ = ["local_to_canon", "canon_delta_to_morphism"]