Package statechum.model.testset.PTASequenceEngine

Examples of statechum.model.testset.PTASequenceEngine.SequenceSet


 
  /** Test for equality of different sequenceSets. */
  @Test
  public final void test_sequenceSet_equality3()
  {
    SequenceSet seqStart = en.new SequenceSet();seqStart.setIdentity();
    SequenceSet seqStartOne = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}
    },mainConfiguration,converter));
   
    SequenceSet seqStartTwo = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a"},
        new String[] {"c","a","a"}
       
    },mainConfiguration,converter)).cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a"},
        new String[] {"c","a","a"}
    },mainConfiguration,converter));
   
    SequenceSet seqDifferent1 = en.new SequenceSet();
    SequenceSet seqDifferent2 = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a"}
    },mainConfiguration,converter));
    equalityTestingHelper(seqStartOne,seqStartTwo,seqDifferent1,seqDifferent2, true);
  }
View Full Code Here


 
  /** Tests containsSequence. */
  @Test
  public final void test_containsSequence2()
  {
    SequenceSet seqStart = en.new SequenceSet();seqStart.setIdentity();
    seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}
    },mainConfiguration,converter));
    assertTrue(en.containsSequence(labelList(new String[]{"c"})));
    assertTrue(en.containsAsLeaf(labelList(new String[]{"c"})));
View Full Code Here

 
  /** Tests extendsLeaf. */
  @Test
  public final void test_extendsLeaf1()
  {
    SequenceSet seqStart = engine_testLimitToGraph.new SequenceSet();seqStart.setIdentity();
    assertFalse(engine_testLimitToGraph.extendsLeaf(labelList(new String[]{})));
    assertFalse(engine_testLimitToGraph.extendsLeaf(labelList(new String[]{"a"})));
  }
View Full Code Here

          if (loopEntry.getValue() == stateLearnt)
          {// Note an input corresponding to any loop in temp can be followed in the original machine, since
           // a loop in temp is either due to the merge or because it was there in the first place.
            inputsToMultWith.add(loopEntry.getKey());
          }
        SequenceSet pathsToMergedRed = data.getPathsToLearnt();
        pathsToMergedRed.unite(pathsToMergedRed.crossWithSet(inputsToMultWith));// the resulting path does a "transition cover" on all transitions leaving the red state.
       
        // Now we limit the number of elements in pathsToMerged to the value specified in the configuration.
        // This will not affect the underlying graph, but it does not really matter since all
        // elements in that graph are accept-states by construction of pathsToMergedRed and hence
        // not be returned.
        pathsToMergedRed.limitTo(original.config.getQuestionPathUnionLimit());
       
        fanout = learnt.paths.computePathsSBetween_All(stateLearnt, engine, pathsToMergedRed);
      }
           
      SequenceSet pathsToCurrentState = fanout.get(state.mergedVertex);
      if (pathsToCurrentState != null)
      {
        assert state.mergedVertex.getColour() != JUConstants.AMBER;
        //System.out.println(pairOrig+" : "+state.mergedVertex+" inputs are "+learnt.transitionMatrix.get(state.mergedVertex).keySet());
        // if a path from the merged red state to the current one can be found, update the set of questions.
        pathsToCurrentState.crossWithSet(learnt.transitionMatrix.get(state.mergedVertex).keySet());
        // Note that we do not care what the result of crossWithSet is - for those states which
        // do not exist in the underlying graph, reject vertices will be added by the engine and
        // hence will be returned when we do a .getData() on the engine.
      }
    }
View Full Code Here

 
  /** Tests extendsLeaf. */
  @Test
  public final void test_extendsLeaf2()
  {
    SequenceSet seqStart = engine_testLimitToGraph.new SequenceSet();seqStart.setIdentity();
    seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","c","b"},
        new String[] {"c","c","c","c"}
    },mainConfiguration,converter));
   
    assertFalse(engine_testLimitToGraph.extendsLeaf(labelList(new String[]{})));
View Full Code Here

 
  /** Test for Union: adding something to an empty set. */
  @Test
  public final void test_sequenceSet_union0()
  {
    SequenceSet seqStart = en.new SequenceSet();seqStart.setIdentity();
    SequenceSet seqOne = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}
    },mainConfiguration,converter));
    SequenceSet seqTwo = en.new SequenceSet();seqTwo.unite(seqOne);
    SequenceSet seqDifferent1 = seqTwo.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","b"}}
        ,mainConfiguration,converter
    ));
    SequenceSet seqDifferent2 = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","b"}}
        ,mainConfiguration,converter
    ));

    equalityTestingHelper(seqOne,seqTwo,seqDifferent1,seqDifferent2, true);
View Full Code Here

 
  /** Test for Union: adding an empty set to something. */
  @Test
  public final void test_sequenceSet_union1()
  {
    SequenceSet seqStart = en.new SequenceSet();seqStart.setIdentity();
    SequenceSet seqOne = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}
    },mainConfiguration,converter));
    SequenceSet seqA = en.new SequenceSet();seqOne.unite(seqA);
    SequenceSet seqTwo = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}
    },mainConfiguration,converter));
    SequenceSet seqDifferent1 = seqTwo.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","b"}}
        ,mainConfiguration,converter
    ));
    SequenceSet seqDifferent2 = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","b"}}
        ,mainConfiguration,converter
    ));

    equalityTestingHelper(seqOne,seqTwo,seqDifferent1,seqDifferent2, true);
View Full Code Here

        @SuppressWarnings("unused") StatePair pairOrig, CmpVertex stateLearnt,
        MergeData data)
    {
      if (fanout == null)
      {// Initialisation
        SequenceSet pathsToRed = data.getPathsToLearnt();
        SequenceSet pathsToMergedRed=engine.new SequenceSet();pathsToMergedRed.unite(pathsToRed);
        original.paths.computePathsSBetweenBoolean(pairOrig.getR(), pairOrig.getQ(), pathsToRed, pathsToMergedRed);
       
        // Now we limit the number of elements in pathsToMerged to the value specified in the configuration.
        // This will not affect the underlying graph, but it does not really matter since all
        // elements in that graph are accept-states by construction of pathsToMergedRed and hence
        // not be returned.
        pathsToMergedRed.limitTo(original.config.getQuestionPathUnionLimit());
       
        fanout = learnt.paths.computePathsSBetween_All(stateLearnt, engine, pathsToMergedRed);
      }
           
      SequenceSet pathsToCurrentState = fanout.get(state.mergedVertex);
      if (pathsToCurrentState != null)
        // if a path from the merged red state to the current one can be found, update the set of questions.
        pathsToCurrentState.crossWithSet(learnt.transitionMatrix.get(state.mergedVertex).keySet());
        // Note that we do not care what the result of crossWithSet is - for those states which
        // do not exist in the underlying graph, reject vertices will be added by the engine and
        // hence will be returned when we do a .getData() on the engine.
    }
View Full Code Here

 
  /** Test for Union: adding a set to itself. */
  @Test
  public final void test_sequenceSet_union2()
  {
    SequenceSet seqStart = en.new SequenceSet();seqStart.setIdentity();
    SequenceSet seqA = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}
    },mainConfiguration,converter));
    SequenceSet seqTwo = en.new SequenceSet();seqTwo.unite(seqA);seqTwo.unite(seqTwo);
    List<List<Label>> arg = new LinkedList<List<Label>>();
    Set<List<Label>> setOfStrings = TestFSMAlgo.buildSet(new String[][] {
        new String[] {"a","a"},
        new String[] {"c"}},mainConfiguration,converter);
    arg.addAll(setOfStrings);arg.addAll(setOfStrings);
    SequenceSet seqOne = seqStart.cross(arg);

    SequenceSet seqDifferent1 = seqTwo.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","b"}}
        ,mainConfiguration,converter
    ));
    SequenceSet seqDifferent2 = seqStart.cross(TestFSMAlgo.buildList(new String[][] {
        new String[] {"a","b"}}
        ,mainConfiguration,converter
    ));

    equalityTestingHelper(seqOne,seqTwo,seqDifferent1,seqDifferent2, true);
View Full Code Here

        @SuppressWarnings("unused") StatePair pairOrig, @SuppressWarnings("unused") CmpVertex stateLearnt,
        @SuppressWarnings("unused") MergeData data)
    {
      if (fanout == null)
      {
        SequenceSet pathsToInitState = engine.new SequenceSet();pathsToInitState.setIdentity();
        fanout = original.paths.computePathsSBetween_All(original.init, engine, pathsToInitState);
      }
     
      for(CmpVertex vert:state.vertices)
      {
        SequenceSet pathsToCurrentState = fanout.get(vert);
        if (pathsToCurrentState != null)
        {
          pathsToCurrentState.limitTo(original.config.getQuestionPathUnionLimit());
          pathsToCurrentState.crossWithSet(learnt.transitionMatrix.get(state.mergedVertex).keySet());// attempt all possible continuation vertices
        }
      }
    }
View Full Code Here

TOP

Related Classes of statechum.model.testset.PTASequenceEngine.SequenceSet

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.