Package edu.uci.ics.jung.graph.impl

Examples of edu.uci.ics.jung.graph.impl.DirectedSparseGraph


      }
     
      possibleMerges = topLearner.ChooseStatePairs(scoreComputer);
      //System.out.println(possibleMerges);
    }
    DirectedSparseGraph result = scoreComputer.paths.getGraph();result.addUserDatum(JUConstants.STATS, report.toString(), UserData.SHARED);
    if(config.getDebugMode())
      updateGraph(scoreComputer);
    return result;
  }
View Full Code Here


   * @param config the configuration to pass to LearnerGraph
   */
  public void checkPath(String fsmString, String []path, int ExpectedResult, String enteredName, Configuration conf)
  {
    assert (enteredName == null)? (ExpectedResult >= 0):true;
    final DirectedSparseGraph g = buildGraph(fsmString, "sample FSM");
    final LearnerGraph fsm = new LearnerGraph(g,config);
    assertEquals(ExpectedResult, fsm.paths.tracePath(Arrays.asList(path)));
    CmpVertex expected = (enteredName == null)? null:new LearnerGraph(g, conf).findVertex(enteredName);
    Vertex receivedA = RPNIBlueFringeLearnerOrig.getVertex(g, Arrays.asList(path));
    CmpVertex receivedB = new LearnerGraph(g,conf).paths.getVertex(Arrays.asList(path));
View Full Code Here

   * @param config the configuration to pass to LearnerGraph
   */
  public void checkPathFrom(String fsmString, String startingState, String []path, int ExpectedResult, String enteredName, Configuration conf)
  {
    assert (enteredName == null) == (ExpectedResult >= 0);
    final DirectedSparseGraph g = buildGraph(fsmString, "sample FSM");
    final LearnerGraph fsm = new LearnerGraph(g,config);
    assertEquals(ExpectedResult, fsm.paths.tracePath(Arrays.asList(path),fsm.findVertex(startingState)));
    Vertex starting = DeterministicDirectedSparseGraph.findVertexNamed(new VertexID(startingState),g);
    CmpVertex expected = (enteredName == null)? null:new LearnerGraph(g, conf).findVertex(new VertexID(enteredName));
    Vertex received = RPNIBlueFringeLearnerOrig.getVertex(g, starting, Arrays.asList(path));
View Full Code Here

      }
     
      possibleMerges = topLearner.ChooseStatePairs(scoreComputer);
    }
    assert currentNonAmber == initialPTA.getStateNumber()-initialPTA.getAmberStateNumber();
    DirectedSparseGraph result = scoreComputer.paths.getGraph();
    if(config.getDebugMode())
      updateGraph(scoreComputer);
    return result;
  }
View Full Code Here

          gr.config.setLearnerCloneGraph(false);
          graphsOrig.add( gr );
            graphs.add(((AbstractLearnerGraph) arg).pathroutines.getGraph());
            layoutOptions.put(graphNumber,gr.getLayoutOptions());
        } else if (arg instanceof DirectedSparseGraph) {
          DirectedSparseGraph gr = (DirectedSparseGraph) arg;
          graphsOrig.add(null);graphs.add(gr);
          LayoutOptions options = (LayoutOptions)gr.getUserDatum(JUConstants.LAYOUTOPTIONS);
          if (options == null)
            options = new LayoutOptions();
            layoutOptions.put(graphNumber,options);
        } else {
            System.err.println("Visualiser notified with unknown object " + arg);
View Full Code Here

                   
                  @Override
                  public void actionPerformed(@SuppressWarnings("unused") ActionEvent ev) {
                    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd =
                      new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
                    DirectedSparseGraph gr = gd.showGD(
                        ourGraph,otherGr,
                        ExperimentRunner.getCpuNumber());
                    Visualiser.updateFrame(gr, null);
                  }
           
View Full Code Here

  @SuppressWarnings("unused")
  private void displayDiff(LearnerGraphND from, LearnerGraphND to)
  {
    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd =
      new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
    DirectedSparseGraph gr = gd.showGD(
        from,to,
        ExperimentRunner.getCpuNumber());gr.setUserDatum(JUConstants.TITLE, "diff_"+from.getName(),UserData.SHARED);
    Visualiser.updateFrameWithPos(from, 1);
    Visualiser.updateFrameWithPos(to, 2);
    Visualiser.updateFrameWithPos(gr, 0);
  }
View Full Code Here

  /** Each test starts with this configuration. */
  private Configuration mainConfiguration = null;
 
  protected void checkLearner(String fsmString, String [][] plus, String [][] minus)
  {
    final DirectedSparseGraph g = TestFSMAlgo.buildGraph(fsmString, "sample FSM");
    final LearnerGraph expected = new LearnerGraph(g,testConfig);
   
    // now sanity checking on the plus and minus sets
    for(String [] path:plus)
      assert RPNIBlueFringeLearner.USER_ACCEPTED == expected.paths.tracePath(Arrays.asList(path));
    for(String [] path:minus)
      assert RPNIBlueFringeLearner.USER_ACCEPTED != expected.paths.tracePath(Arrays.asList(path));
    // Visualiser.getVisualiser()
    RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,testConfig)
    {
      @Override
      protected Pair<Integer,String> checkWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          List<String> question,
          @SuppressWarnings("unused"final Object [] moreOptions)
      {
        return new Pair<Integer,String>(expected.paths.tracePath(question),null);
      }
    };
    config.setDebugMode(false);
    //l.setPairsMergedPerHypothesis(0);
    //l.setGeneralisationThreshold(1);
    //l.setCertaintyThreshold(5);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
    l.init(buildSet(plus), buildSet(minus));
    DirectedSparseGraph learningOutcomeA = l.learnMachine();
    LearnerGraph learntStructureA = new LearnerGraph(learningOutcomeA,testConfig);

    // Now do the same with ptasets instead of real sets
    PTASequenceSet plusPTA = new PTASequenceSet();plusPTA.addAll(buildSet(plus));PTASequenceSet minusPTA = new PTASequenceSet();minusPTA.addAll(buildSet(minus));
    l.init(plusPTA, minusPTA);
    DirectedSparseGraph learningOutcomeB = l.learnMachine();
    LearnerGraph learntStructureB = new LearnerGraph(learningOutcomeB,testConfig);
    WMethod.checkM(learntStructureA, learntStructureB);
    //TestFSMAlgo.checkM(learntStructure,completedGraph,learntStructure.init,expected.init);
  }
View Full Code Here

     
  DeterministicVertex p = new DeterministicVertex("P"), q= new DeterministicVertex("Q");
  /** Checks that both the old and the new algorithm reports a pair of states as incompatible. */
  public final void testNewLearnerIncompatible(String fsm, String name)
  {
    DirectedSparseGraph g = TestFSMAlgo.buildGraph(fsm, name);
    //Visualiser.updateFrame(g, null);Visualiser.waitForKey();
    LearnerGraph s = new LearnerGraph(g, testConfig);
    OrigStatePair pairOrig = new OrigStatePair(DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("B"), g),
        DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("A"), g));
    StatePair pairNew = new StatePair(s.findVertex(new VertexID("B")),s.findVertex(new VertexID("A")));
View Full Code Here

  /** Checks that both the old and the two new algorithms report the same score for a pair of states and ask the same questions.
   * @param states being merged are called "A" and "B".
   */
  public final void testNewLearnerQuestions(String fsm, int expectedScore, String learnerName)
  {
    DirectedSparseGraph g = TestFSMAlgo.buildGraph(fsm, learnerName);
    //Visualiser.updateFrame(g, null);Visualiser.waitForKey();
    LearnerGraph s = new LearnerGraph(g, testConfig);
    OrigStatePair pairOrig =
      new OrigStatePair(
          DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("B"), g),
          DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, new VertexID("A"), g));
    StatePair pairNew1 = new StatePair(s.findVertex(new VertexID("B")),s.findVertex(new VertexID("A")));
    DirectedSparseGraph
      temp = mergeAndDeterminize((Graph)g.copy(), pairOrig),
      tempB = MergeStates.mergeAndDeterminize(g, pairNew1,testConfig);
   
    // Now check that ComputeStateScores properly does  mergeAndDeterminize
    // (on the test data we are dealing with in these tests, there are separate tests for mergeAndDeterminize)
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.graph.impl.DirectedSparseGraph

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.