"""Minimal NovaPlan DSL scaffold. This is intentionally tiny: a single, ergonomic shim to create a LocalProblem out of a high-level DSL-like description. It is designed for MVP experimentation and to bootstrap adapters, not for production parsing. """ from __future__ import annotations from typing import Dict, Callable from nova_plan.planner import LocalProblem class LocalProblemDSL: """Tiny DSL to describe a LocalProblem and convert to a LocalProblem instance.""" def __init__(self, agent_id: str, objective_expr: str, variables: Dict[str, float], constraints: Dict[str, object] | None = None): # Keep the input shape friendly for tests; the actual objective is not # exercised in the MVP tests, so we keep a simple stub objective. self.agent_id = agent_id self.objective_expr = objective_expr self.variables = variables self.constraints = constraints or {} def to_local_problem(self) -> LocalProblem: """Return a LocalProblem instance corresponding to this DSL description.""" # Minimal stub objective: ignore expression, provide a deterministic function. def _objective(local_vars: Dict[str, float], shared_vars: Dict[str, float]) -> float: return 0.0 return LocalProblem(id=self.agent_id, objective=_objective, variables=self.variables, constraints=self.constraints) __all__ = ["LocalProblemDSL"]