Class FinalizedProblem

All Implemented Interfaces:
AtomicFormulaSimplifier<Integer>, Problem, Serializable
Direct Known Subclasses:
DefaultProblem

public abstract class FinalizedProblem extends PostInstantiatedProblem
This class contains all the methods needed to post instantiation process of a planning problem. In particular, this class contains the methods necessary to compactly encode the problem using compact bit set representation.
See Also:
Serialized Form
  • Constructor Details

    • FinalizedProblem

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

    • getActions

      public final List<Action> getActions()
      Returns the list of actions of the problem.
      Returns:
      the list of actions of the problem.
    • getDurativeActions

      public final List<DurativeAction> getDurativeActions()
      Returns the list of instantiated durative actions of the problem.
      Returns:
      the list of instantiated durative actions of the problem.
    • getFluents

      public final List<Fluent> getFluents()
      Returns the list of relevant fluents of the problem.
      Returns:
      the list of relevant fluents of the problem.
    • getNumericFluents

      public final List<NumericFluent> getNumericFluents()
      Returns the list of relevant numeric fluents of the problem.
      Returns:
      the list of relevant numeric fluents of the problem.
    • getInitialState

      public final InitialState getInitialState()
      Returns the initial state of the problem.
      Returns:
      the initial state of the problem.
    • getGoal

      public final Goal getGoal()
      Returns the goal of the problem.
      Returns:
      the goal of the problem.
    • getTaskResolvers

      public List<List<Integer>> getTaskResolvers()
      Returns the relevant operators for the tasks of the problem. The method return null if the problem is not hierarchical.

      Warning a task may have many resolvers event primitives tasks.

      The resolvers returned are indexes of operators. To get the list of resolvers of a specific task t just write:
      
           List<Integer> resolvers = problem.getTaskResolvers().get(t)
       
      Two case must be considered.
      • If the task t is primitive, i.e., problem.getTask(t).isPrimtive() returns true, the list of resolvers contains either indexes of actions either indexes of durative actions. If the index is positive the index represents an action. To get the corresponding action just use problem.getActions(index). If the index is negative the index represents a durative action. To get the corresponding durative action just use problem.getDurativeActions(-index - 1).
      • Symmetrically, if the task t is compound, i.e., problem.getTask(t).isCompound() returns true, the list of resolvers contains either indexes of method either indexes of durative methods. If the index is positive the index represents a method. To get the corresponding method just use problem.getMethods(index). If the index is negative the index represents a durative method. To get the corresponding durative method just use problem.getDurativeMethods(-index - 1).
      Returns:
      the relevant operators for a task.
    • getInitialTaskNetwork

      public TaskNetwork getInitialTaskNetwork()
      Returns the initial task network of the problem.
      Returns:
      the initial task network of the problem.
    • getTasks

      public List<Task> getTasks()
      The list of relevant tasks of the problem.
      Returns:
      the list of relevant tasks of the problem.
    • getMethods

      public List<Method> getMethods()
      Returns the list of instantiated methods of the problem.
      Returns:
      the list of instantiated methods of the problem.
    • getDurativeMethods

      public final List<DurativeMethod> getDurativeMethods()
      Returns the list of instantiated durative methods of the problem.
      Returns:
      the list of instantiated durative methods of the problem.
    • extractRelevantFluents

      protected void extractRelevantFluents()
      Extracts the relevant fluents from the instantiated actions. A fluents is relevant if and only if:
      • 1. it is an initial fact and not a negative ground inertia, or if
      • 2. it is not an initial fact and not a positive ground inertia.
    • extractRelevantFluents

      protected void extractRelevantFluents(Expression<Integer> exp, Set<Expression<Integer>> fluents)
      Extracts the relevant fluents from a specified expression. A fluent is relevant if and only if:
      • 1. it is an initial fluent and not a negative ground inertia, or if
      • 2. it is not an initial fact and not a positive ground inertia.
      Parameters:
      exp - the expression.
      fluents - the set of relevant fluents.
    • extractRelevantNumericFluents

      protected void extractRelevantNumericFluents()
      Extracts the relevant numeric fluents.
    • initOfMapFluentIndex

      protected void initOfMapFluentIndex()
      Initializes the map that store for each relevant fluent its index to speedup the bit set encoding of the action.
    • initMapOfNumericFluentIndex

      protected void initMapOfNumericFluentIndex()
      Create a map of the relevant numeric fluents with their index to speedup the bit set encoding of the actions.
    • finalizeActions

      protected void finalizeActions() throws UnexpectedExpressionException
      Encode a list of specified actions into BitSet representation. Several specified map is used to speed-up the search by mapping the an expression to this index.
      Throws:
      UnexpectedExpressionException
    • finalizeGoal

      protected void finalizeGoal()
      Encode a specified goal in a disjunction of BitExp. The specified map is used to speed-up the search by mapping an expression to this index. The goal of the problem is set to null if it can be simplified to false.
    • finalizeCondition

      protected Condition finalizeCondition(Expression<Integer> exp) throws UnexpectedExpressionException
      Encode an specified Expression that represents a condition in its BitExp representation. The map of fluent index is used to speed-up the encoding.
      Parameters:
      exp - the Expression.
      Returns:
      the condition encoded.
      Throws:
      UnexpectedExpressionException
    • finalizeTimeCondition

      protected TemporalCondition finalizeTimeCondition(Expression<Integer> exp) throws UnexpectedExpressionException
      Encode an specified Expression that represents a condition in its BitExp representation. The map of fluent index is used to speed-up the encoding.
      Parameters:
      exp - the Expression.
      Returns:
      the condition encoded.
      Throws:
      UnexpectedExpressionException
    • finalizeInitialState

      protected void finalizeInitialState()
      Encode a specified initial state in it bit compact representation. The map of the fluent index is used to speedup the encoding.
    • finalizeInitialNumericFluent

      protected void finalizeInitialNumericFluent()
      Encode the numeric fluent of the initial state.
    • toString

      public final String toString(Action action)
      Returns a string representation of a specified operator.
      Parameters:
      action - the action.
      Returns:
      a string representation of the specified operator.
    • toString

      public final String toString(DurativeAction action)
      Returns a string representation of a specified operator.
      Parameters:
      action - the action.
      Returns:
      a string representation of the specified operator.
    • toString

      public final String toString(Condition state)
      Returns a string representation of a state.
      Parameters:
      state - the state.
      Returns:
      a string representation of the state.
    • toString

      public final String toString(TemporalCondition condition)
      Returns a string representation of a temporal condition.
      Parameters:
      condition - the condition.
      Returns:
      a string representation of the specified temporal condition.
    • toString

      public final String toString(ConditionalEffect effect)
      Returns a string representation of a conditional effect.
      Parameters:
      effect - the conditional effect.
      Returns:
      a string representation of the specified condition effect.
    • toString

      public final String toString(TemporalConditionalEffect effect)
      Returns a string representation of a temporal conditional effect.
      Parameters:
      effect - the temporal conditional effect.
      Returns:
      a string representation of the specified temporal condition effect.
    • toString

      public final String toString(Effect effect)
      Returns a string representation of the effect of an action.
      Parameters:
      effect - the effect.
      Returns:
      a string representation of the effect.
    • toString

      public final String toString(TemporalEffect effect)
      Returns a string representation of a temporal effect.
      Parameters:
      effect - the effect.
      Returns:
      a string representation of the effect.
    • toString

      public final String toString(NumericAssignment assignment)
      Returns a string representation of a numeric assignment.
      Parameters:
      assignment - the assignment.
      Returns:
      a string representation of a numeric assignment.
    • toString

      public final String toString(State state)
      Returns a string representation of a closed world state.
      Parameters:
      state - the state.
      Returns:
      a string representation of the specified expression.
    • toString

      public String toString(InitialState state)
      Returns a string representation of a initial state.
      Parameters:
      state - the state.
      Returns:
      a string representation of the specified expression.
    • toString

      public String toString(Fluent fluent)
      Returns a string representation of a fluent.
      Parameters:
      fluent - the fluent.
      Returns:
      a string representation of the specified fluent.
    • toString

      public String toString(NumericFluent fluent)
      Returns a string representation of a numeric fluent.
      Parameters:
      fluent - the numeric fluent.
      Returns:
      a string representation of the specified numeric fluent.
    • toString

      public String toString(NumericVariable variable)
      Returns a string representation of a numeric variable.
      Parameters:
      variable - the numeric variable.
      Returns:
      a string representation of the specified numeric variable.
    • toString

      public final String toString(Plan plan)
      Return a string representation of a search.
      Parameters:
      plan - the search.
      Returns:
      a string representation of the specified search.
    • toString

      public final String toString(Method method)
      Returns a string representation of the specified method.
      Parameters:
      method - the method.
      Returns:
      a string representation of the specified method.
    • toString

      public final String toString(DurativeMethod method)
      Returns a string representation of the specified method.
      Parameters:
      method - the method.
      Returns:
      a string representation of the specified method.
    • toString

      public final String toString(TaskNetwork tasknetwork)
      Returns a string representation of the specified task network.
      Parameters:
      tasknetwork - the task network.
      Returns:
      a string representation of the specified task network.
    • toString

      public String toString(Task task)
      Returns a string representation of a task.
      Parameters:
      task - the formula.
      Returns:
      a string representation of the specified expression.
    • toString

      public String toString(Hierarchy hierarchy)
      Returns a string representation of a hierarchical decomposition of plan.
      Parameters:
      hierarchy - the hierarchical decomposition to convert into string represention.
      Returns:
      the string representation of the he hierarchical decomposition in parameter.
    • toString

      public String toString(NumericConstraint constraint)
      Returns a string representation of a numeric constraints.
      Parameters:
      constraint - the numeric constraints.
      Returns:
      the string representation of the specified numeric constraint.
    • toString

      public String toString(ArithmeticExpression expression)
      Returns a string representation of a numeric expression.
      Parameters:
      expression - the numeric expression.
      Returns:
      the string representation of the specified numeric expression.
    • toString

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

      public final String toShortString(AbstractInstantiatedOperator operator)
      Returns a short string representation of the specified operator, i.e., its name and its instantiated parameters. This method can be used for actions and methods.
      Parameters:
      operator - the operator.
      Returns:
      a string representation of the specified operator.
    • toStringCost

      public final String toStringCost(Plan plan)
      Return a detailed string representation of a search. Not compatible with VAL.
      Parameters:
      plan - the search.
      Returns:
      a string representation of the specified search.
    • extractRelevantTasks

      protected void extractRelevantTasks()
      Extract all the relevant task of the problem from the list of primitive and compund tasks of the problem.
    • initMapOfTaskIndex

      protected void initMapOfTaskIndex()
      Creates the map index for the task.
    • initTaskResolvers

      protected void initTaskResolvers()
      Init the resolvers for each task.
    • finalizeInitialTaskNetwork

      protected void finalizeInitialTaskNetwork()
      Encode the initial task networl into its compact bit set representation.
    • finalizeMethods

      protected void finalizeMethods()
      Encode a list of specified methods into the final compact representation. Several specified maps are used to speed-up the search by mapping an expression to this index.