29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
"""Interoperability helpers for NovaPlan <-> CatOpt bridge.
|
|
|
|
This module provides a tiny, import-friendly entry point to produce a
|
|
CatOpt-compatible pair (Object + Morphism) from a LocalProblem. It leverages
|
|
the existing bridge utilities and keeps integration concerns centralized.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Dict, Any
|
|
|
|
from nova_plan.dsl import LocalProblemDSL
|
|
from nova_plan.planner import LocalProblem
|
|
from nova_plan.catopt_bridge import bridge_pair
|
|
|
|
|
|
def to_catopt_pair_from_dsl(dsl: LocalProblemDSL, source: str, target: str, version: int = 1) -> Dict[str, Any]:
|
|
"""Convert a LocalProblemDSL description to a CatOpt-style pair.
|
|
|
|
This is a convenience facade used by adapters to bootstrap NovaPlan
|
|
primitives into a canonical CatOpt representation.
|
|
"""
|
|
lp: LocalProblem = dsl.to_local_problem()
|
|
return bridge_pair(lp, source=source, target=target, version=version)
|
|
|
|
|
|
def to_catopt_pair_from_lp(lp: LocalProblem, source: str, target: str, version: int = 1) -> Dict[str, Any]:
|
|
"""Convert an existing LocalProblem instance into a CatOpt-style pair."""
|
|
return bridge_pair(lp, source=source, target=target, version=version)
|