UNPKG

pddl-planning-service-client

Version:
69 lines (68 loc) 2.69 kB
import { Plan, ProblemInfo, DomainInfo, parser, planner } from 'pddl-workspace'; import { PlannerService, ServerRequest, ServerResponse } from './PlannerService'; /** Wraps the `/request` planning web service interface. */ export declare class PlannerAsyncService extends PlannerService<AsyncServerRequest, AsyncServerResponse> { private asyncPlannerConfiguration; static readonly DEFAULT_TIMEOUT = 60; private timeout; private asyncMode; private planTimeScale; private lastPlanPrinted; constructor(plannerUrl: string, asyncPlannerConfiguration: AsyncServiceConfiguration, providerConfiguration: planner.ProviderConfiguration); getTimeout(): number; createUrl(): string; createRequestBody(domainFileInfo: DomainInfo, problemFileInfo: ProblemInfo): Promise<AsyncServerRequest | null>; static toPlanTimeScale(planTimeUnit: PlanTimeUnit): number; processServerResponseBody(_origUrl: string, responseBody: AsyncServerResponse, planParser: parser.PddlPlannerOutputParser, callbacks: planner.PlannerResponseHandler): Promise<Plan[]>; parsePlan(plan: AsyncResponsePlan, planParser: parser.PddlPlannerOutputParser): Promise<void>; static createDefaultConfiguration(timeout: number): AsyncServiceOnlyConfiguration; } export interface AsyncServiceOnlyConfiguration { planFormat: string; planTimeUnit?: PlanTimeUnit; timeout?: number; } export interface AsyncServiceConfiguration extends planner.PlannerRunConfiguration, AsyncServiceOnlyConfiguration { } /** Async service request body. */ interface AsyncServerRequest extends ServerRequest { domain: AsyncServerRequestFile; problem: AsyncServerRequestFile; configuration?: AsyncServiceConfiguration; callbacks?: AsyncServiceCallback[]; } interface AsyncServerRequestFile { name: string; format: 'PDDL'; content: string; } interface AsyncServiceCallback { type: 'STATES' | 'PLAN' | 'STATES'; url: string; token: string; } /** Async service response body. */ interface AsyncServerResponse extends ServerResponse { status: { status: "NOT_INITIALIZED" | "INITIATING" | "SEARCHING_INITIAL_PLAN" | "STOPPED" | "SEARCHING_BETTER_PLAN" | "FAILED"; error: { message: string; }; reason: "TIMEOUT"; }; plans: AsyncResponsePlan[]; output: string; } interface AsyncResponsePlan { makespan: number; metricValue: number; searchPerformanceInfo: { statesEvaluated: number; timeElapsed: string; }; timeUnit: PlanTimeUnit; format?: string; content: string; } type PlanTimeUnit = "MINUTE" | "MILLISECOND" | "HOUR" | "DAY" | "WEEK" | "SECOND"; export {};