Class ProblemExpertInterface

Inheritance Relationships

Derived Types

Class Documentation

class ProblemExpertInterface

Interface for managing PDDL problem elements.

This interface defines the methods for manipulating a PDDL problem, including instances, predicates, unctions, and goals.

Subclassed by plansys2::ProblemExpert, plansys2::ProblemExpertClient

Public Functions

inline ProblemExpertInterface()

Default constructor.

virtual std::vector<plansys2::Instance> getInstances() = 0

Get all instances in the problem.

Returns:

std::vector<plansys2::Instance> Vector containing all instances in the problem.

virtual bool addInstance(const plansys2::Instance &instance) = 0

Add a new instance to the problem.

Parameters:

instance[in] The instance to be added.

Returns:

true if the instance was successfully added, false otherwise.

virtual bool removeInstance(const plansys2::Instance &instance) = 0

Remove an instance from the problem.

Parameters:

instance[in] The instance to be removed.

Returns:

true if the instance was successfully removed, false otherwise.

virtual std::optional<plansys2::Instance> getInstance(const std::string &name) = 0

Get a specific instance by name.

Parameters:

name[in] The name of the instance to retrieve.

Returns:

std::optional<plansys2::Instance> The instance if found, empty otherwise.

virtual std::vector<plansys2::Predicate> getPredicates() = 0

Get all predicates in the problem.

Returns:

std::vector<plansys2::Predicate> Vector containing all predicates in the problem.

virtual bool addPredicate(const plansys2::Predicate &predicate) = 0

Add a new predicate to the problem.

Parameters:

predicate[in] The predicate to be added.

Returns:

true if the predicate was successfully added, false otherwise.

virtual bool removePredicate(const plansys2::Predicate &predicate) = 0

Remove a predicate from the problem.

Parameters:

predicate[in] The predicate to be removed.

Returns:

true if the predicate was successfully removed, false otherwise.

virtual bool existPredicate(const plansys2::Predicate &predicate) = 0

Check if a predicate exists in the problem.

Parameters:

predicate[in] The predicate to check.

Returns:

true if the predicate exists, false otherwise.

virtual std::optional<plansys2::Predicate> getPredicate(const std::string &expr) = 0

Get a specific predicate by its expression.

Parameters:

expr[in] The expression of the predicate to retrieve.

Returns:

std::optional<plansys2::Predicate> The predicate if found, empty otherwise.

virtual std::vector<plansys2::Function> getFunctions() = 0

Get all functions in the problem.

Returns:

std::vector<plansys2::Function> Vector containing all functions in the problem.

virtual bool addFunction(const plansys2::Function &function) = 0

Add a new function to the problem.

Parameters:

function[in] The function to be added.

Returns:

true if the function was successfully added, false otherwise.

virtual bool removeFunction(const plansys2::Function &function) = 0

Remove a function from the problem.

Parameters:

function[in] The function to be removed.

Returns:

true if the function was successfully removed, false otherwise.

virtual bool existFunction(const plansys2::Function &function) = 0

Check if a function exists in the problem.

Parameters:

function[in] The function to check.

Returns:

true if the function exists, false otherwise.

virtual bool updateFunction(const plansys2::Function &function) = 0

Update the value of an existing function.

Parameters:

function[in] The function with the updated value.

Returns:

true if the function was successfully updated, false otherwise.

virtual std::optional<plansys2::Function> getFunction(const std::string &expr) = 0

Get a specific function by its expression.

Parameters:

expr[in] The expression of the function to retrieve .

Returns:

std::optional<plansys2::Function> The function if found, empty otherwise.

virtual plansys2::Goal getGoal() = 0

Get the current goal of the problem.

Returns:

plansys2::Goal The current goal.

virtual bool setGoal(const plansys2::Goal &goal) = 0

Set a new goal for the problem.

Parameters:

goal[in] The goal to be set.

Returns:

true if the goal was successfully set, false otherwise.

virtual bool isGoalSatisfied(const plansys2::Goal &goal) = 0

Check if a goal is satisfied in the current state.

Parameters:

goal[in] The goal to check for satisfaction.

Returns:

true if the goal is satisfied, false otherwise.

virtual bool clearGoal() = 0

Clear the current goal from the problem.

Returns:

true if the goal was successfully cleared, false otherwise.

virtual bool clearKnowledge() = 0

Clear all knowledge (instances, predicates, functions, and goal) from the problem.

Returns:

true if the knowledge was successfully cleared, false otherwise.

virtual std::string getProblem() = 0

Get the complete PDDL problem as a string.

Returns:

std::string The complete PDDL problem string.

virtual bool addProblem(const std::string &problem_str) = 0

Add a complete PDDL problem from a string.

Parameters:

problem_str[in] The PDDL problem string to parse and add.

Returns:

true if the problem was successfully added, false otherwise.