Package primitives.cluster

Examples of primitives.cluster.ClusterHead


    g.addNode(c);
    g.addNode(d);
    g.addNode(e);
    g.addNode(f);
   
    tree = new ClusterHead(g);
    VecInstruction[] p = {
        new VecInstruction(MOVE,1,2),
        new VecInstruction(NOP),
        new VecInstruction(NOP)
    };
View Full Code Here


    assertTrue(interpreter.isHalted());
  }

  @Test
  public void testStep() {
    ClusterHead original = new ClusterHead(g);
    interpreter.step();
    assertTrue(original.getChildren().size() != tree.getChildren().size());
    //ClusterUtils.prettyPrintTree(tree);
   
    VecInstruction [] p = {
        new VecInstruction(MERGE,2,1),
        new VecInstruction(MERGE,2,3),
        new VecInstruction(MERGE,2,4),
        new VecInstruction(MERGE,2,5),
        new VecInstruction(MERGE,2,6),
        new VecInstruction(MERGE,2,1),
        new VecInstruction(MERGE,2,2)
    };
    tree = new ClusterHead(g);
    program = Arrays.asList(p);
    interpreter = new VecInterpreter(program,tree);
    while(!interpreter.isHalted())
      interpreter.step();
    ClusterUtils.prettyPrintTree(tree);
View Full Code Here

    ClusterUtils.prettyPrintTree(tree);
  }
       
        @Test
        public void testOnFig3() throws Exception{
            ClusterHead toCluster = null;
            try{
                toCluster = TreeLoader.loadTreeFromDot("/Users/mat/Dropbox/graphs/dot/fig3.dot");
           
            //ArrayList<Instruction> program = new ArrayList<Instruction>();
            List<VecInstruction> p = null;
View Full Code Here

    g.connect(nodes[1], nodes[2]);
    g.connect(nodes[2], nodes[3]);
    g.connect(nodes[0], nodes[3]);


    ch = new ClusterHead(g);
  }
View Full Code Here

                Logger.getLogger(ExperimentRunner.class.getName()).log(Level.SEVERE, "Failed to instantiate fitness function " + td.getFitnessFunction(), ex);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(ExperimentRunner.class.getName()).log(Level.SEVERE, "IllegalAccessException when instantiating " + td.getFitnessFunction(), ex);
            }

            ClusterHead toCluster = TreeLoader2.loadTreeFromDot(td.getInputname());



            Logger.getLogger(ExperimentRunner.class.getName()).log(Level.FINE, String.format("Starting clustering of file: %s [%d nodes, %d edges]"
                    , td.getInputname().getName()
                    ,toCluster.getSize()
                    ,new Graph(toCluster.getNodes()).countTransitions()
                    ));
           
            Search gs = null;         
            if(td.getSearchType().equals("GA")){
                gs = new GeneticAlgorithmSearch();
View Full Code Here

    cfp.setInput(silFile.getAbsolutePath());
    cfp.setObject(bunchG);
    cfp.parse();

    clusteredG = bunchG;
    ch = new ClusterHead(g);
  }
View Full Code Here

        this.model = model;
    }

    public void loadGraph() {
        //dosomething
        ClusterHead ch = null;
        if(model.isClusterHead()){
           
        }
       
        try {
            if(!model.isClusterHead()){
                ch = TreeLoader.loadTreeFromDot(model.getDotName());
            }else{
                ch = TreeLoader2.loadTreeFromSerial(model.getDotName());
            }
           
            primitives.graph.Graph g = new primitives.graph.Graph(ch.getNodes());


            DirectedSparseMultigraph go = new DirectedSparseMultigraph();
            //HashMap<Node,String> nodes = new HashMap<Node,String>();
            for (Node n : g.getNodes()) {
                go.addVertex(n);

            }

            for (Node n : g.getNodes()) {
                for (Transition t : n.getTransitionsAsT()) {
                    go.addEdge(t.getLabel() + "<!--" +  Math.random() + "-->", n, t.getDestinationNode());
                    //JUNG's E set must be distinct, so chuck some random crap on the end of each label
                    //to make each one unique.  HTML is used when rendering so we hide the random crap with a comment
                }
            }
            try {
                if(!model.isClusterHead())
                    ch = SILReader.clusterTreeBySIL(g, new File(model.getSilName()));
               
                HashMap<String, HashSet<Node>> clusters = new HashMap<String, HashSet<Node>>();

                for (IClusterLevel l : ch.getChildren()) {
                    String c = "C" + Math.random();
                    clusters.put(c, new HashSet<Node>());
                    for (Node n : l.getNodes()) {
                        clusters.get(c).add(n);
                    }
View Full Code Here

  }

  @Override
  public String getRepresentation(Graph g) {
    // TODO Auto-generated method stub
    return getSIL(new ClusterHead(g));
  }
View Full Code Here

            bestFitness = iteration();
            i++;
        }
        String reason = "Iteration limit";

        ClusterHead tr;
        int totalEvals = 0;
        double fitness = 0;

        if (ff.budgetHit()) {
            reason = "Budget reached";
View Full Code Here

                                        }
        }
      }
    }

    return new ClusterHead(g);
        }
View Full Code Here

TOP

Related Classes of primitives.cluster.ClusterHead

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.