Search in sources :

Example 1 with IonJoeModifications

use of edu.cmu.tetrad.search.IonJoeModifications in project tetrad by cmu-phil.

the class IonRunner method execute.

// =================PUBLIC METHODS OVERRIDING ABSTRACT=================//
/**
 * Executes the algorithm, producing (at least) a result workbench. Must be
 * implemented in the extending class.
 */
public void execute() {
    System.out.println("Executing.");
    IonJoeModifications ion = new IonJoeModifications(getGraphs());
    ion.setAdjacencySearch(getParams().getBoolean("pruneByAdjacencies", true));
    ion.setPathLengthSearch(getParams().getBoolean("pruneByPathLength", true));
    ion.setKnowledge((IKnowledge) getParams().get("knowledge", new Knowledge2()));
    List<Graph> graphs = ion.search();
    Collections.sort(graphs, new Comparator<Graph>() {

        public int compare(Graph graph, Graph graph1) {
            return graph.getNumEdges() - graph1.getNumEdges();
        }
    });
    if (graphs == null) {
        throw new NullPointerException();
    }
    if (!graphs.isEmpty()) {
        setResultGraph(graphs.get(0));
    }
    System.out.println("graphs = " + graphs);
    getParams().set("graphIndex", 0);
    this.graphs = graphs;
}
Also used : EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) Graph(edu.cmu.tetrad.graph.Graph) IonJoeModifications(edu.cmu.tetrad.search.IonJoeModifications) Knowledge2(edu.cmu.tetrad.data.Knowledge2)

Aggregations

Knowledge2 (edu.cmu.tetrad.data.Knowledge2)1 EdgeListGraph (edu.cmu.tetrad.graph.EdgeListGraph)1 Graph (edu.cmu.tetrad.graph.Graph)1 IonJoeModifications (edu.cmu.tetrad.search.IonJoeModifications)1