Class AbstractProblem

java.lang.Object
fr.uga.pddl4j.problem.AbstractProblem
All Implemented Interfaces:
AtomicFormulaSimplifier<Integer>, Problem, Serializable
Direct Known Subclasses:
PreInstantiatedProblem

public abstract class AbstractProblem extends Object implements Problem
This class contains all the methods needed to encode a planning problem into int representation before instantiation.
See Also:
Serialized Form
  • Constructor Details

    • AbstractProblem

      public AbstractProblem(DefaultParsedProblem problem)
      Creates a new problem from a domain and problem.
      Parameters:
      problem - the problem.
  • Method Details

    • getParsedProblem

      public final DefaultParsedProblem getParsedProblem()
      Returns the parsed problem used to create this problem.
      Specified by:
      getParsedProblem in interface Problem
      Returns:
      the parsed problem used to create this problem.
    • getRequirements

      public final Set<RequireKey> getRequirements()
      Returns the requirements of the problem.
      Specified by:
      getRequirements in interface Problem
      Returns:
      the requirements of the problem.
    • getTypes

      public final List<String> getTypes()
      Returns the list of the type symbols of the problem.
      Specified by:
      getTypes in interface Problem
      Returns:
      the list of the type symbols of the problem.
    • getDomains

      public final Map<Integer,​Set<Symbol<Integer>>> getDomains()
      Returns the domains for each type of the problem.
      Specified by:
      getDomains in interface Problem
      Returns:
      the domains for each type of the problem.
    • getConstantSymbols

      public final List<String> getConstantSymbols()
      Returns the list of constant symbols of the problem.
      Specified by:
      getConstantSymbols in interface Problem
      Returns:
      the list of constant symbols of the problem.
    • getPredicateSymbols

      public final List<String> getPredicateSymbols()
      Returns the list of predicate symbols of the problem.
      Specified by:
      getPredicateSymbols in interface Problem
      Returns:
      the list predicate symbols of the problem.
    • getPredicateSignatures

      public final List<List<Symbol<Integer>>> getPredicateSignatures()
      Returns the signatures of the predicates defined in the problem.
      Specified by:
      getPredicateSignatures in interface Problem
      Returns:
      the signatures of the predicates defined in the problem.
    • getTaskSymbols

      protected List<String> getTaskSymbols()
      Returns the list of task symbols of the problem.
      Returns:
      the list of task symbols of the problem.
    • getTaskSignatures

      protected List<List<Symbol<Integer>>> getTaskSignatures()
      Returns the signatures of the task defined in the problem.
      Returns:
      the signatures of the task defined in the problem.
    • getFunctions

      protected List<String> getFunctions()
      Returns the list of function symbols of the problem.
      Returns:
      the list of function symbols of the problem.
    • getFunctionSignatures

      protected List<List<Symbol<Integer>>> getFunctionSignatures()
      Returns the signatures of the functions defined in the problem.
      Returns:
      the signatures of the functions defined in the problem.
    • getPrimitiveTaskSymbols

      protected Set<String> getPrimitiveTaskSymbols()
      Returns the list of primitive task symbols of the problem.
      Returns:
      the list of primitive task symbols of the problem.
    • getCompoundTaskSymbols

      protected Set<String> getCompoundTaskSymbols()
      Returns the list of compound tasks symbols of the problem.
      Returns:
      the list of compound tasks symbols of the problem.
    • instantiate

      public final void instantiate()
      Instantiates the problem. This method calls in this order the methods initialization(), preinstantiation(), instantiation(), postinstantiation() and finalization(). This methods must be override in each concrete classe.
      Specified by:
      instantiate in interface Problem
    • initialization

      protected abstract void initialization()
      This methods initializes the structures needed to the instantiation process from the PDDL domain and problem given in parameters of the constructor of the class. First, it collects the constants, the types, the predicate, the function and the tasks symbols. Then, it encodes the actions, the methods, the goal and the initial tasks network of the problem into compact int representation.
    • preinstantiation

      protected abstract void preinstantiation()
      This method carries out all the necessary treatment to preinstantiate the problem. In particular, it calculates the static properties (Inertia) of the problem in order to prune as soon as possible the actions that can never be triggered.
    • instantiation

      protected abstract void instantiation()
      This methods carries out the instantiation of the planning operators and the goal of the problem in to actions.
    • postinstantiation

      protected abstract void postinstantiation()
      This method carries out all the necessary treatment to postinstantiate the problem. In particular, it simplifies the actions instantiated based on static properties based on the initial state information of the problem in order to prune the actions that can never be triggered.
    • finalization

      protected abstract void finalization()
      This methods finalize the domain, i.e., it encodes the planning problem into it final compact representation using bit set.
    • initRequirements

      protected void initRequirements() throws RequirementNotSupportedException
      Init the list of requirement of the problem.
      Throws:
      RequirementNotSupportedException - if the requirements of the domain and the problem are not supported.
    • initTypes

      protected void initTypes()
      Initializes the list of type symbols form the list declared in the domain. The corresponding domain of values of the type is created. The domain is empty.
    • initConstants

      protected void initConstants()
      Initializes the constants declared in the domain and the problem and initialise the domains of values of each type.
    • initEitherTypes

      protected void initEitherTypes()
      Initializes the composite type, i.e., type of the form (either t1 t2), through a specified domain and problem and creates their respective domain. Warning: constants must be collected before using this method. It is necessary to correctly initialized the domain of the either types collected.
    • initPredicates

      protected void initPredicates()
      Initializes the predicate information (symbols and signatures) declared in the domain.
    • initFunctions

      protected void initFunctions()
      Initializes the function information (symbols and signatures) declared in the domain.
    • initTasks

      protected void initTasks()
      Initializes the tasks information (symbols and signatures) declared in the domain.
    • initPrimitiveTaskSymbols

      protected void initPrimitiveTaskSymbols()
      Initializes the primitive task symbols from the actions of the domain.
    • initCompoundTaskSymbols

      protected void initCompoundTaskSymbols()
      Initializes the compound task symbols from the methods of the domain.
    • getIntActions

      protected List<IntAction> getIntActions()
      Returns the list of actions under its integer representation of the problem.
      Returns:
      the list of actions under its integer representation of the problem.
      See Also:
      IntAction
    • getIntInitialState

      protected Set<Expression<Integer>> getIntInitialState()
      Returns the list of fluent in the form of Expression of the initial state.
      Returns:
      the list of fluent in the form of Expression of the initial state.
      See Also:
      Expression
    • getIntTimedFluents

      protected Set<Expression<Integer>> getIntTimedFluents()
      Returns the list of timed fluent in the form of Expression of the initial state.
      Returns:
      the list of timed fluent in the form of Expression of the initial state.
      See Also:
      Expression
    • getIntInitFunctionCost

      protected Map<Expression<Integer>,​Double> getIntInitFunctionCost()
      Returns the map that store the value of the numeric fluents in the form of Expression of the initial state.
      Returns:
      the map that store the value of the numeric fluents in the form of Expression of the initial state.
      See Also:
      Expression
    • getIntGoal

      protected Expression<Integer> getIntGoal()
      Returns the goal of the problem as an Expression.
      Returns:
      the goal of the problem as an Expression.
      See Also:
      Expression
    • getIntInitFunctions

      protected Set<Expression<Integer>> getIntInitFunctions()
      Returns the list of numeric fluents in the form of Expression of the initial state.
      Returns:
      the list of numeric fluents in the form of Expression of the initial state.
      See Also:
      Expression
    • getIntMethods

      protected List<IntMethod> getIntMethods()
      Returns the list of methods of the problem into its integer representation.
      Returns:
      the list of methods of the problem into its integer representation.
    • getIntInitialTaskNetwork

      protected IntTaskNetwork getIntInitialTaskNetwork()
      Returns the initial task network into its integer representation.
      Returns:
      the initial task network into its integer representation.
    • setIntInitialTaskNetwork

      protected final void setIntInitialTaskNetwork(IntTaskNetwork taskNetwork)
      Sets the integer initial task network of thi problem.
      Parameters:
      taskNetwork - the task network to set.
    • initInitialState

      protected void initInitialState()
      Encodes a specified initial state into its integer representation.
    • initGoal

      protected void initGoal()
      Encodes a specified goal into its integer representation.
    • initActions

      protected void initActions()
      Encodes the actions of the domain into a compact integer representation.
    • initMethods

      protected void initMethods()
      Encodes the methods of the domain into a compact integer representation.
    • initInitialTaskNetwork

      protected void initInitialTaskNetwork()
      Encodes a specified task network into its integer representation.
    • initTaskNetwork

      protected IntTaskNetwork initTaskNetwork(ParsedTaskNetwork parsedTaskNetwork, List<String> parameters, List<Integer> types)
      Encodes a specified task network into its integer representation.
      Parameters:
      parsedTaskNetwork - the parsed task network.
      parameters - the parameters of the task network.
      types - the type of parameters.
      Returns:
      the a integer representation of the task network in parameter.
    • initExpression

      protected Expression<Integer> initExpression(Expression<String> exp, List<String> variables)
      Encodes an specified expression into its integer representation.

      Notes:

      • equal predicate used specified value of -1.
      • variables used negative values in [-1,-infinity[.
      Parameters:
      exp - the expression to encode.
      variables - the list of variable already encoded.
      Returns:
      the integer representation of the specified expression.
    • toString

      protected String toString(IntAction action)
      Returns a string representation of the specified action.
      Parameters:
      action - the operator to print.
      Returns:
      a string representation of the specified operator.
    • toString

      protected String toString(IntMethod method)
      Returns a string representation of the specified method.
      Parameters:
      method - the method to print.
      Returns:
      a string representation of the specified method.
    • toString

      protected String toString(AbstractIntOperator operator)
      Returns a string representation of the specified operator.
      Parameters:
      operator - the operator.
      Returns:
      a string representation of the specified operator.
    • toString

      public String toString(IntTaskNetwork taskNetwork)
      Returns a string representation of the specified task network.
      Parameters:
      taskNetwork - the task network to print.
      Returns:
      a string representation of the specified method.
    • toString

      protected String toString(Expression<Integer> exp)
      Returns a string representation of an expression.
      Parameters:
      exp - the expression.
      Returns:
      a string representation of the specified expression.
    • toString

      protected String toString(Expression<Integer> exp, String separator)
      Returns a string representation of an expression.
      Parameters:
      exp - the expression.
      separator - the string separator between predicate symbol and arguments.
      Returns:
      a string representation of the specified expression.
    • toString

      protected String toString(Expression<Integer> exp, String baseOffset, String separator)
      Returns a string representation of an expression.
      Parameters:
      exp - the expression.
      baseOffset - the offset white space from the left used for indentation.
      separator - the string separator between predicate symbol and arguments.
      Returns:
      a string representation of the specified expression node.
    • toString

      protected String toString(AbstractProblem.Data data)
      Returns a string representation of the internal data structure used during instantiation process.
      Parameters:
      data - the internal data structure.
      Returns:
      a string representation of the internal data structure used during instantiation process.
    • toShortString

      public String toShortString(AbstractInstantiatedOperator operator, List<String> constants)
      Returns a short string representation of the specified operator, i.e., its name and its instantiated parameters.
      Parameters:
      operator - the operator.
      constants - the table of constants.
      Returns:
      a string representation of the specified operator.