Package statechum.model.testset

Examples of statechum.model.testset.PTASequenceEngine


  {
    Configuration config = mainConfiguration.copy();config.setLearnerCloneGraph(false);
    LearnerGraph graph = buildLearnerGraph(fsm,name,config,converter);
    StatePair pair = new StatePair(graph.findVertex("A"),graph.findVertex("B"));
    LearnerGraph merged = MergeStates.mergeAndDeterminize_general(graph, pair);
    PTASequenceEngine questions = ComputeQuestions.computeQS_general(pair, graph, merged, new ComputeQuestions.QSMQuestionGenerator());
    LearnerGraph updatedGraphExpected = new LearnerGraph(graph,config),updatedGraphActual = new LearnerGraph(graph,config);
    updatedGraphActual.transitionMatrix.putAll(((NonExistingPaths)questions.getFSM()).getNonExistingTransitionMatrix());
    updatedGraphActual.learnerCache.invalidate();
   
    for(List<Label> path:questions.getData())
      updatedGraphExpected.paths.augmentPTA(path,merged.paths.getVertex(path).isAccept(),false,null);

    compareGraphs(updatedGraphExpected,updatedGraphActual);                                              
  }
View Full Code Here


        "A5-c->A51-c->A52"
        , "testBuildPTAofQuestions1",mainConfiguration,converter);
    StatePair pair = new StatePair(graph.findVertex("A1"),graph.findVertex("A2"));
    LearnerGraph merged = MergeStates.mergeAndDeterminize_general(graph, pair);
    compareGraphs(buildLearnerGraph("A1-a->B1-b->A1-c->C-d-#R4/C-c->CC/CC-f-#R3/CC-e->D", "testQuestionAnswering2b",mainConfiguration,converter),merged);
    PTASequenceEngine questions = ComputeQuestions.computeQS_general(pair, graph, merged, new ComputeQuestions.QSMQuestionGenerator());
    // the IF part we're augmenting with is a dummy one
    LearnerGraph[] ifthenCollection = new LearnerGraph[]{buildLearnerGraph("A-s->B / P-c->Q-d-#R / S-c->S1-c->S2-e->S3 / S==THEN==A==THEN==P", "testQuestionAnswering1", mainConfiguration,converter)};
    Transform.augmentFromIfThenAutomaton(graph, (NonExistingPaths)questions.getFSM(), ifthenCollection, 0);
    List<List<Label>> questionList = questions.getData();
    Assert.assertEquals(1,questionList.size());
    Assert.assertEquals(labelList(new String[]{"c","c","f"}), questionList.iterator().next());
  }
View Full Code Here

   * @param vertTarget the target state
   * @return sequences of inputs to follow all paths found.
   */ 
  Collection<List<Label>> computePathsBetween(CmpVertex vertSource, CmpVertex vertTarget)
  {
    PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
    PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
    PTASequenceEngine.SequenceSet paths = engine.new SequenceSet();paths.setIdentity();
    computePathsSBetween(vertSource, vertTarget,initSet,paths);
    return engine.getData();
  }
View Full Code Here

    Set<String> alphabet =  computeAlphabet();
    List<List<String>> stateCover = computeStateCover();
    characterisationSet = computeWSet_reducedmemory(coregraph);if (characterisationSet.isEmpty()) characterisationSet.add(Arrays.asList(new String[]{}));
    transitionCover = crossWithSet(stateCover,alphabet);transitionCover.addAll(stateCover);

    PTASequenceEngine engine = new PTA_FSMStructure(coregraph);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(stateCover);
   
    partialPTA.cross(characterisationSet);
    for(int i=0;i<=numberOfExtraStates;i++)
    {
      partialPTA = partialPTA.crossWithSet(alphabet);
      partialPTA.cross(characterisationSet);
    }
   
    return engine.getData();
  }
View Full Code Here

    DirectedSparseVertex init = new DirectedSparseVertex();
    init.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
    init.addUserDatum(JUConstants.ACCEPTED, false, UserData.SHARED);
    init.addUserDatum(JUConstants.LABEL, "A", UserData.SHARED);
    g.addVertex(init);
    PTASequenceEngine enVerySmall = new PTA_FSMStructure(new LearnerGraph(g,mainConfiguration),null);
    vertifyPTA(enVerySmall, 1, new String[][] {
        new String[] {}
      });
  }
View Full Code Here

    DirectedSparseVertex init = new DirectedSparseVertex();
    init.addUserDatum(JUConstants.INITIAL, true,UserData.SHARED);
    init.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);
    init.addUserDatum(JUConstants.LABEL, "A", UserData.SHARED);
    g.addVertex(init);
    PTASequenceEngine enVerySmall = new PTA_FSMStructure(new LearnerGraph(g,mainConfiguration),null);
    vertifyPTA(enVerySmall, 1, new String[][] {
        new String[] {}
    });
  }
View Full Code Here

  }

  @Test
  public final void testNodeEquality()
  {
    PTASequenceEngine engine = new PTASequenceEngine();
    Node a = engine.new Node("A"), b = engine.new Node("A"), c = engine.new Node("B");
    assertTrue(a.equals(a));
    assertTrue(b.equals(b));
    assertTrue(engine.rejectNode.equals(engine.rejectNode));
    assertFalse(a.equals(b));
View Full Code Here

  @SuppressWarnings("unused")
  @Test(expected = IllegalArgumentException.class)
  public final void testNode0_fail()
  {
    PTASequenceEngine engine = new PTASequenceEngine();
    engine.new Node(null);
  }
View Full Code Here

  }
 
  @Test
  public final void testNode1()
  {
    PTASequenceEngine engine = new PTASequenceEngine();
    Node a = engine.new Node("A");
   
    assertTrue(a.isAccept());
    assertTrue(engine.new Node("test").isAccept());
    assertFalse(engine.rejectNode.isAccept());
View Full Code Here

  }

  @Test
  public final void testNode2()
  {
    PTASequenceEngine engine = new PTASequenceEngine();
    Node a = engine.new Node("A"), b = engine.new Node("A"), c = engine.new Node("B");
    assertEquals("A", a.getState());
    assertEquals("A", b.getState());
    assertEquals("B", c.getState());
   
View Full Code Here

TOP

Related Classes of statechum.model.testset.PTASequenceEngine

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.