Package statechum.analysis.learning.rpnicore

Examples of statechum.analysis.learning.rpnicore.LearnerGraph.findVertex()


  @Test(expected = IllegalArgumentException.class)
  public final void testMerge_fail2()
  {
    LearnerGraph l=buildLearnerGraph(largeGraph1_invalid5,"testMerge_fail1",testConfig,getLabelConverter());
    CmpVertex
      a = l.findVertex(VertexID.parseID("A")),
      b = l.findVertex(VertexID.parseID("B"));
    StatePair pair = new StatePair(b,a);// A is red
    MergeStates.mergeAndDeterminize(l, pair);
  }
View Full Code Here


  public final void testMerge_fail2()
  {
    LearnerGraph l=buildLearnerGraph(largeGraph1_invalid5,"testMerge_fail1",testConfig,getLabelConverter());
    CmpVertex
      a = l.findVertex(VertexID.parseID("A")),
      b = l.findVertex(VertexID.parseID("B"));
    StatePair pair = new StatePair(b,a);// A is red
    MergeStates.mergeAndDeterminize(l, pair);
  }

  @Test(expected = IllegalArgumentException.class)
View Full Code Here

  @Test(expected = IllegalArgumentException.class)
  public final void testMerge_fail3()
  {
    LearnerGraph l=buildLearnerGraph(largeGraph1_invalid5,"testMerge_fail1",testConfig,getLabelConverter());
    CmpVertex
      a = l.findVertex(VertexID.parseID("A")),
      b = l.findVertex(VertexID.parseID("B"));
    StatePair pair = new StatePair(b,a);// A is red
    MergeStates.mergeAndDeterminize_general(l, pair);
  }
View Full Code Here

  public final void testMerge_fail3()
  {
    LearnerGraph l=buildLearnerGraph(largeGraph1_invalid5,"testMerge_fail1",testConfig,getLabelConverter());
    CmpVertex
      a = l.findVertex(VertexID.parseID("A")),
      b = l.findVertex(VertexID.parseID("B"));
    StatePair pair = new StatePair(b,a);// A is red
    MergeStates.mergeAndDeterminize_general(l, pair);
  }

  protected interface InterfaceChooserToTest {
View Full Code Here

  public LearnerGraph learn(LearnerGraph initPTAArg)
  {
    setInitPta(initPTAArg);
    LearnerGraph outcome = learner.learnMachine(new LinkedList<List<Label>>(), new LinkedList<List<Label>>());
    if (phantomVertex != null)
      outcome.transitionMatrix.remove(outcome.findVertex(phantomVertex));
    return outcome;
  }
 
  public LearnerGraph learn(PTASequenceEngine engineArg, boolean useNegatives)
  {
View Full Code Here

    else
      engine = engineArg;
   
    LearnerGraph outcome = learner.learnMachine(engine,0,0);
    if (phantomVertex != null)
      outcome.transitionMatrix.remove(outcome.findVertex(phantomVertex));
    return outcome;
  }
 
}
View Full Code Here

  {
    final LearnerGraph fsmAsLearnerGraph = FsmParser.buildLearnerGraph(fsm, graphName,config,getLabelConverter());
    final DirectedSparseGraph gB = fsmAsLearnerGraph.pathroutines.getGraph();
    for(PairScore pair:expectedPairs)
    {
      Assert.assertNotNull("vertex "+pair.getQ()+" is missing in the graph",fsmAsLearnerGraph.findVertex(pair.getQ()));
      Assert.assertNotNull("vertex "+pair.getR()+" is missing in the graph",fsmAsLearnerGraph.findVertex(pair.getR()));
    }
    //Visualiser.updateFrame(new LearnerGraph(gB,Configuration.getDefaultConfiguration()), null);Visualiser.waitForKey();
    // check how the reference pair selection function performs
    Configuration conf = testConfig.copy();conf.setLearnerUseStrings(false);conf.setLearnerCloneGraph(false);
View Full Code Here

    final LearnerGraph fsmAsLearnerGraph = FsmParser.buildLearnerGraph(fsm, graphName,config,getLabelConverter());
    final DirectedSparseGraph gB = fsmAsLearnerGraph.pathroutines.getGraph();
    for(PairScore pair:expectedPairs)
    {
      Assert.assertNotNull("vertex "+pair.getQ()+" is missing in the graph",fsmAsLearnerGraph.findVertex(pair.getQ()));
      Assert.assertNotNull("vertex "+pair.getR()+" is missing in the graph",fsmAsLearnerGraph.findVertex(pair.getR()));
    }
    //Visualiser.updateFrame(new LearnerGraph(gB,Configuration.getDefaultConfiguration()), null);Visualiser.waitForKey();
    // check how the reference pair selection function performs
    Configuration conf = testConfig.copy();conf.setLearnerUseStrings(false);conf.setLearnerCloneGraph(false);
    testChooseStatePairsInternal(gB,new LearnerGraph(gB, conf), initialReds, expectedReds, expectedPairs, new InterfaceChooserToTest() {
View Full Code Here

        DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("B"), g),
        DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("A"), g));
   
    LearnerGraph s = new LearnerGraph(g, testConfig);
    StatePair pairNew = new StatePair(
        s.findVertex(VertexID.parseID("B")),
        s.findVertex(VertexID.parseID("A")));
    doneEdges = new HashSet<DirectedSparseEdge>();
    s.config.setLearnerScoreMode(Configuration.ScoreMode.CONVENTIONAL);s.setMaxScore(maxScoreConstant-1);
    long origScore = computeScore(g, pairOrig),
      newScoreA = s.pairscores.computeStateScore(pairNew),
View Full Code Here

        DeterministicDirectedSparseGraph.findVertex(JUConstants.LABEL, VertexID.parseID("A"), g));
   
    LearnerGraph s = new LearnerGraph(g, testConfig);
    StatePair pairNew = new StatePair(
        s.findVertex(VertexID.parseID("B")),
        s.findVertex(VertexID.parseID("A")));
    doneEdges = new HashSet<DirectedSparseEdge>();
    s.config.setLearnerScoreMode(Configuration.ScoreMode.CONVENTIONAL);s.setMaxScore(maxScoreConstant-1);
    long origScore = computeScore(g, pairOrig),
      newScoreA = s.pairscores.computeStateScore(pairNew),
      newScoreB = s.pairscores.computePairCompatibilityScore(pairNew);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.