UNPKG

pddl-workspace

Version:
56 lines (55 loc) 2.06 kB
import { Plan } from '../Plan'; import { PlanStep } from '../PlanStep'; import { ProblemInfo } from '../ProblemInfo'; import { DomainInfo } from '../DomainInfo'; import { URI } from 'vscode-uri'; export interface PddlPlanParserOptions { epsilon: number; minimumPlansExpected?: number; } /** * Parses plan in the PDDL form incrementally - line/buffer at a time. * It can parse a continuous output of a planner, which may contain multiple plans. */ export declare class PddlPlannerOutputParser { private domain; private problem; readonly options: PddlPlanParserOptions; private onPlanReady?; private readonly plans; private pddlPlanParser; private planBuilder; private endOfBufferToBeParsedNextTime; private xmlPlanBuilder; private planTimeScale; constructor(domain: DomainInfo, problem: ProblemInfo, options: PddlPlanParserOptions, onPlanReady?: ((plans: Plan[]) => void) | undefined); setPlanMetaData(makespan: number, metric: number, statesEvaluated: number, _elapsedTimeInSeconds: number, planTimeScale: number): void; /** * Appends and parses the planner output. * @param text planner output */ appendBuffer(text: string): void; appendXplan(planXml: string): Promise<Plan[]>; /** * Parses one line of parser output. * @param outputLine one line of planner output */ appendLine(outputLine: string): void; /** * Appends plan step. Use this when the plan does not need parsing. * @param planStep plan step to add to the plan */ appendStep(planStep: PlanStep): void; /** * Call this when the planning engine stopped. This flushes the last line in the buffered output through the parsing * and adds the last plan to the collection of plans. */ onPlanFinished(): void; /** Gets current plan's provisional makespan. */ getCurrentPlanMakespan(): number; /** * Gets all plans. */ getPlans(): Plan[]; static parseOnePlan(planText: string, planUri: URI, epsilon: number): Plan; }