Class PermutationSearch

java.lang.Object
edu.cmu.tetrad.search.PermutationSearch

public class PermutationSearch extends Object

Implements common elements of a permutation search. The specific parts for each permutation search are implemented as a SuborderSearch.

This class specifically handles an optimization for tiered knowledge, whereby tiers in the knowledge can be searched one at a time in order from the lowest to highest, taking all variables from previous tiers as a fixed for a later tier. This allows these permutation searches to search over many more variables than otherwise, so long as tiered knowledge is available to organize the search.

This class is configured to respect the knowledge of forbidden and required edges, including knowledge of temporal tiers.

Author:
bryanandrews
See Also:
  • Constructor Details

    • PermutationSearch

      public PermutationSearch(SuborderSearch suborderSearch)
      Constructs a new PermutationSearch using the given SuborderSearch.
      Parameters:
      suborderSearch - The SuborderSearch (see).
      See Also:
  • Method Details

    • getGraph

      public static Graph getGraph(List<Node> nodes, Map<Node,Set<Node>> parents, boolean cpDag)
      Construct a graph given a specification of the parents for each node.
      Parameters:
      nodes - The nodes.
      parents - A map from each node to its parents.
      cpDag - Whether a CPDAG is wanted, if false, a DAG.
      Returns:
      The constructed graph.
    • getGraph

      public static Graph getGraph(List<Node> nodes, Map<Node,Set<Node>> parents, Knowledge knowledge, boolean cpDag)
      Constructs a graph given a specification of the parents for each node.
      Parameters:
      nodes - The nodes.
      parents - A map from each node to its parents.
      knowledge - the knowledge to use to construct the graph.
      cpDag - Whether a CPDAG is wanted, if false, a DAG.
      Returns:
      The construted graph.
    • getGraph

      public static Graph getGraph(List<Node> nodes, Map<Node,Set<Node>> parents, Knowledge knowledge, boolean cpDag, boolean replicating)
      Constructs a graph given a specification of the parents for each node.
      Parameters:
      nodes - The list of nodes to include in the graph.
      parents - A map specifying the parents for each node. Each key is a node, and its value is the set of parent nodes.
      knowledge - The knowledge object, if any, to guide the orientation of edges in the graph.
      cpDag - A flag indicating whether a CPDAG (partially directed acyclic graph) is desired. If false, a DAG (directed acyclic graph) is constructed.
      replicating - A flag indicating whether graph replication is enabled, allowing mirrored changes in replicated graphs.
      Returns:
      The constructed graph, which may be a DAG or CPDAG depending on the value of the cpDag flag.
    • search

      public Graph search() throws InterruptedException
      Performs a search for a graph using the default options. Returns the resulting graph.
      Returns:
      The constructed CPDAG.
      Throws:
      InterruptedException - if any
    • search

      public Graph search(boolean cpdag) throws InterruptedException
      Performe the search and return a CPDAG.
      Parameters:
      cpdag - True a CPDAG is wanted, if false, a DAG.
      Returns:
      The CPDAG.
      Throws:
      InterruptedException - if any
    • getOrder

      public List<Node> getOrder()
      Retrieves the order list.
      Returns:
      The order list.
    • setOrder

      public void setOrder(List<Node> order)
      Sets the order list for the search.
      Parameters:
      order - The order list to set. Must contain all variables.
      Throws:
      AssertionError - If the order list does not contain all variables.
    • getGST

      public GrowShrinkTree getGST(Node node)
      Retrieves the GrowShrinkTree (GST) associated with the given Node.
      Parameters:
      node - The Node whose GST is to be retrieved.
      Returns:
      The GrowShrinkTree associated with the given Node.
    • getVariables

      public List<Node> getVariables()
      Retrieves the list of variables.
      Returns:
      The list of variables.
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      Sets the knowledge to be used for the search.
      Parameters:
      knowledge - The knowledge to be set.
    • getCpdag

      public boolean getCpdag()
      Retrieves the value of cpdag.
      Returns:
      The value of the cpdag flag.
    • setCpdag

      public void setCpdag(boolean cpdag)
      Sets the flag indicating whether a CPDAG (partially directed acyclic graph) is wanted or not.
      Parameters:
      cpdag - The value indicating whether a CPDAG is wanted or not.
    • setSeed

      public void setSeed(long seed)
      Sets the seed value used for generating random numbers.
      Parameters:
      seed - The seed value to set.
    • setReplicatingGraph

      public void setReplicatingGraph(boolean replicatingGraph)
      Sets the flag indicating whether graph replication is enabled or not.
      Parameters:
      replicatingGraph - The value indicating whether graph replication is enabled.