Class ActionSignature

All Implemented Interfaces:
Cloneable, Signature

public class ActionSignature extends FolSignature
This class represents an action signature, which consists of a set of fluent names (representing environment states) and a set of action names (representing actions). These names are represented by first-order predicates to allow for a simple implementation of a grounding mechanism.

Authors: Sebastian Homann

  • Constructor Details

    • ActionSignature

      public ActionSignature()
      Creates an empty action signature.
    • ActionSignature

      public ActionSignature(Collection<?> c) throws IllegalArgumentException
      Creates an action signature with the given objects, which should be sorts, constants, predicates, or formulas.
      Parameters:
      c - a collection of items to be added to the signature.
      Throws:
      IllegalArgumentException - if at least one of the given objects is neither a constant, a sort, a predicate, nor a formula.
    • ActionSignature

      public ActionSignature(FolFormula f)
      Creates a new ActionSignature for a single first-order formula.
      Parameters:
      f - a FOL formula.
  • Method Details

    • getActionNames

      public Set<FolActionName> getActionNames()
      Retrieves the set of action names contained in this action signature.
      Returns:
      a `Set` of `FolActionName` objects representing the action names in this signature.
    • getFluentNames

      public Set<FolFluentName> getFluentNames()
      Retrieves the set of fluent names contained in this action signature.
      Returns:
      a `Set` of `FolFluentName` objects representing the fluent names in this signature.
    • isValidFormula

      public boolean isValidFormula(Formula f)
      Checks if a given formula is valid in the sense of an action description. A valid formula contains only predicates that are either fluent names or action names, and contains neither quantifiers nor functions.
      Parameters:
      f - the formula to be checked.
      Returns:
      true if the given formula is a valid action description, false otherwise.
    • containsActionName

      public boolean containsActionName(String actionName)
      Returns true if the given action name is contained in this action signature.
      Parameters:
      actionName - an action name.
      Returns:
      true if the action name is contained in this signature, false otherwise.
    • containsFluentName

      public boolean containsFluentName(String fluentName)
      Returns true if the given fluent name is contained in this action signature.
      Parameters:
      fluentName - a fluent name.
      Returns:
      true if the fluent name is contained in this action signature, false otherwise.
    • getActionName

      public FolActionName getActionName(String action)
      Returns the action name predicate with the given name if one exists, null otherwise.
      Parameters:
      action - the name of the action.
      Returns:
      the action name predicate with the given name, or null if it does not exist.
    • getFluentName

      public FolFluentName getFluentName(String fluentName)
      Returns the fluent name predicate with the given name if one exists, null otherwise.
      Parameters:
      fluentName - the name of the fluent.
      Returns:
      the fluent name predicate with the given name, or null if it does not exist.
    • containsActionName

      public boolean containsActionName(FolActionName actionName)
      Returns true if the given action name is contained in this signature.
      Parameters:
      actionName - a FOL action name.
      Returns:
      true if the action name is contained in this signature, false otherwise.
    • containsFluentName

      public boolean containsFluentName(FolFluentName fluentName)
      Returns true if the given fluent name is contained in this signature.
      Parameters:
      fluentName - a FOL fluent name.
      Returns:
      true if the fluent name is contained in this signature, false otherwise.
    • containsPredicate

      public boolean containsPredicate(Predicate predicate)
      Returns true if the given predicate is contained in this signature.
      Parameters:
      predicate - some predicate.
      Returns:
      true if the predicate is contained in this signature, false otherwise.
    • getAllGroundedFluentAtoms

      public Set<FolAtom> getAllGroundedFluentAtoms()
      Returns the set of all possible grounded atoms in this signature based on all fluent predicates.
      Returns:
      the set of all possible grounded fluent atoms.
    • getAllGroundedActionNameAtoms

      public Set<FolAtom> getAllGroundedActionNameAtoms()
      Returns the set of all possible grounded atoms in this signature based on all action name predicates.
      Returns:
      the set of all possible grounded action atoms.
    • add

      public void add(Object obj) throws IllegalArgumentException
      Adds an object to the action signature.
      Specified by:
      add in interface Signature
      Overrides:
      add in class FolSignature
      Parameters:
      obj - the object to be added.
      Throws:
      IllegalArgumentException - if the object type is not supported.
    • toString

      public String toString()
      Provides a string representation of the action signature.
      Specified by:
      toString in interface Signature
      Overrides:
      toString in class FolSignature
      Returns:
      a string representation of the action signature, including all sorts, action names, and fluent names.