UNPKG

pddl-workspace

Version:
58 lines 1.82 kB
"use strict"; /* -------------------------------------------------------------------------------------------- * Copyright (c) Jan Dolejsi 2020. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PddlPlanBuilder = void 0; const Plan_1 = require("../Plan"); /** * Utility for incremental plan building as it is being parsed. */ class PddlPlanBuilder { constructor(epsilon) { this.epsilon = epsilon; this.steps = []; this.outputText = ""; // for information only this.parsingPlan = false; this.makespan = 0; } add(step) { const effectiveEndTime = step.getEffectiveEndTime(); if (this.makespan < effectiveEndTime) { this.makespan = effectiveEndTime; } this.steps.push(step); } getSteps() { return this.steps; } build(domain, problem) { const plan = new Plan_1.Plan(this.steps, domain, problem); plan.statesEvaluated = this.statesEvaluated; if (this.metric !== undefined) { plan.metric = this.metric; } return plan; } getMakespan() { return this.makespan; } setMakespan(makespan) { this.makespan = makespan; } getMetric() { return this.metric; } setMetric(metric) { this.metric = metric; } getStatesEvaluated() { return this.statesEvaluated; } setStatesEvaluated(statesEvaluated) { this.statesEvaluated = statesEvaluated; } } exports.PddlPlanBuilder = PddlPlanBuilder; //# sourceMappingURL=PddlPlanBuilder.js.map