build(agent): new-agents#a6e6ec iteration
This commit is contained in:
parent
f22fda1273
commit
88805d1286
|
|
@ -22,6 +22,9 @@ Architecture scaffolding: Bridge and Adapters
|
|||
- catopt_grid.adapters: starter adapters (rover_planner, habitat_module) that illustrate mapping local problems to the canonical IR and seed cross-domain interoperability.
|
||||
- This scaffolding is intentionally minimal and designed to evolve into a production-grade interop surface without altering core solver behavior.
|
||||
|
||||
Interop helper
|
||||
- lp_to_ir(lp): Convert a local problem instance to a vendor-agnostic IRObject for cross-domain exchange. Accepts various LocalProblem shapes (core.LocalProblem, admm_lite.LocalProblem) and returns an IRObject carrying dimension/id and lightweight metadata.
|
||||
|
||||
Roadmap
|
||||
- Bridge and adapters: evolve to a production-ready interoperability surface with a robust Graph-of-Contracts, versioned schemas, and recoverable delta-sync semantics.
|
||||
- Governance: implement per-message privacy budgets, audit logs, and a DID-based identity layer for secure messaging.
|
||||
|
|
|
|||
|
|
@ -87,4 +87,35 @@ __all__ = [
|
|||
"IRObject",
|
||||
"IRMorphism",
|
||||
"GraphOfContracts",
|
||||
"lp_to_ir",
|
||||
]
|
||||
|
||||
|
||||
def lp_to_ir(lp: object) -> IRObject:
|
||||
"""Convert a local problem instance to a vendor-agnostic IR Object.
|
||||
|
||||
This helper is intentionally permissive to accommodate multiple LocalProblem
|
||||
shapes that exist in this repo (e.g., core.LocalProblem and admm_lite.LocalProblem).
|
||||
It extracts common attributes when present and falls back to sensible defaults.
|
||||
"""
|
||||
# Fallback defaults
|
||||
default_id = getattr(lp, "id", None) or getattr(lp, "name", None) or "lp"
|
||||
# Dimension could be named differently across implementations
|
||||
dim = getattr(lp, "dimension", None)
|
||||
if dim is None:
|
||||
dim = getattr(lp, "n", None)
|
||||
try:
|
||||
dim_int = int(dim)
|
||||
except Exception:
|
||||
dim_int = 0
|
||||
|
||||
# Collect a small amount of metadata if available
|
||||
meta: Dict[str, object] = {}
|
||||
if hasattr(lp, "data"):
|
||||
meta["data"] = getattr(lp, "data")
|
||||
if hasattr(lp, "lb"):
|
||||
meta["lb"] = getattr(lp, "lb")
|
||||
if hasattr(lp, "ub"):
|
||||
meta["ub"] = getattr(lp, "ub")
|
||||
|
||||
return IRObject(id=str(default_id), dimension=dim_int, metadata=meta)
|
||||
|
|
|
|||
Loading…
Reference in New Issue