Package statechum.model.testset.PTASequenceEngine

Examples of statechum.model.testset.PTASequenceEngine.FilterPredicate


  static Map<Integer,Set<List<Label>>> constructCollectionOfTraces(final Map<Integer,PTASequenceEngine> frameToEngine,final boolean positive)
  {
    Map<Integer,Set<List<Label>>> frameToTraces = new TreeMap<Integer,Set<List<Label>>>();
    for(Entry<Integer,PTASequenceEngine> entry:frameToEngine.entrySet())
    {
      final FilterPredicate existingPredicate = entry.getValue().getFSM_filterPredicate();
     
      Set<List<Label>> tracesForFrame = new HashSet<List<Label>>();
      tracesForFrame.addAll(entry.getValue().getData(new FilterPredicate()
      {
 
        @Override
        public boolean shouldBeReturned(Object name) {
          return existingPredicate.shouldBeReturned(name) == positive;
        }
       
      }));
      frameToTraces.put(entry.getKey(),tracesForFrame);
    }
View Full Code Here


      final PTASequenceEngine currentPTA = generator.getAllSequences(i);
      Collection<List<Label>> currentSequences = currentPTA.getData(PTASequenceEngine.truePred);
      Assert.assertEquals("chunk "+i+" (neg) should be of length "+(2*posOrNegPerChunk*(i+1))+" but it was "+currentSequences.size(),(2*posOrNegPerChunk*(i+1)), currentSequences.size());
      int positive = 0,negative=0;
      PTASequenceEngine positivePTA = currentPTA.filter(currentPTA.getFSM_filterPredicate());
      PTASequenceEngine negativePTA = currentPTA.filter(new FilterPredicate() {
        FilterPredicate origFilter = currentPTA.getFSM_filterPredicate();
       
        @Override
        public boolean shouldBeReturned(Object name) {
          return !origFilter.shouldBeReturned(name);
View Full Code Here

      generator.getExtraSequences(1);
    }},IllegalArgumentException.class,"is out of range");
    Assert.assertTrue("PTA is not empty",generator.getExtraSequences(0).containsAsLeaf(labelList(new String[]{})));
    final PTASequenceEngine currentPTA = generator.getAllSequences(0);
    PTASequenceEngine positivePTA = currentPTA.filter(currentPTA.getFSM_filterPredicate());
    PTASequenceEngine negativePTA = currentPTA.filter(new FilterPredicate() {
      FilterPredicate origFilter = currentPTA.getFSM_filterPredicate();
     
      @Override
      public boolean shouldBeReturned(Object name) {
        return !origFilter.shouldBeReturned(name);
View Full Code Here

      final PTASequenceEngine currentPTA = generator.getAllSequences(i);
      Collection<List<Label>> currentSequences = currentPTA.getData(PTASequenceEngine.truePred);
      Assert.assertTrue(2*posOrNegPerChunk*(i+1)> currentSequences.size());
      int positive = 0,negative=0;
      PTASequenceEngine positivePTA = currentPTA.filter(currentPTA.getFSM_filterPredicate());
      PTASequenceEngine negativePTA = currentPTA.filter(new FilterPredicate() {
        FilterPredicate origFilter = currentPTA.getFSM_filterPredicate();
       
        @Override
        public boolean shouldBeReturned(Object name) {
          return !origFilter.shouldBeReturned(name);
View Full Code Here

      final PTASequenceEngine currentPTA = generator.getAllSequences(i);
      Collection<List<String>> currentSequences = currentPTA.getData(PTASequenceEngine.truePred);
      Assert.assertEquals("chunk "+i+" (neg) should be of length "+(2*posOrNegPerChunk*(i+1))+" but it was "+currentSequences.size(),(2*posOrNegPerChunk*(i+1)), currentSequences.size());
      int positive = 0,negative=0;
      PTASequenceEngine positivePTA = currentPTA.filter(currentPTA.getFSM_filterPredicate());
      PTASequenceEngine negativePTA = currentPTA.filter(new FilterPredicate() {
        FilterPredicate origFilter = currentPTA.getFSM_filterPredicate();
        public boolean shouldBeReturned(Object name) {
          return !origFilter.shouldBeReturned(name);
        }
      });
View Full Code Here

          pta.paths.augmentPTA(seq, referenceGraph.getVertex(seq) != null, false, null);
        }*/
        //pta.paths.augmentPTA(referenceGraph.wmethod.computeNewTestSet(referenceGraph.getInit(),1));// this one will not set any states as rejects because it uses shouldbereturned
        //referenceGraph.pathroutines.completeGraph(referenceGraph.nextID(false));
        if (onlyUsePositives)
          pta.paths.augmentPTA(generator.getAllSequences(0).filter(new FilterPredicate() {
            @Override
            public boolean shouldBeReturned(Object name) {
              return ((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
            }
          }));
View Full Code Here

              return len;
            }
          });

        if (onlyUsePositives)
          pta.paths.augmentPTA(generator.getAllSequences(0).filter(new FilterPredicate() {
            @Override
            public boolean shouldBeReturned(Object name) {
              return ((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
            }
          }));
        else
          pta.paths.augmentPTA(generator.getAllSequences(0));// the PTA will have very few reject-states because we are generating few sequences and hence there will be few negative sequences.
          // In order to approximate the behaviour of our case study, we need to compute which pairs are not allowed from a reference graph and use those as if-then automata to start the inference.
        //pta.paths.augmentPTA(referenceGraph.wmethod.computeNewTestSet(referenceGraph.getInit(),1));
   
        List<List<Label>> sPlus = generator.getAllSequences(0).getData(new FilterPredicate() {
          @Override
          public boolean shouldBeReturned(Object name) {
            return ((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
        List<List<Label>> sMinus= generator.getAllSequences(0).getData(new FilterPredicate() {
          @Override
          public boolean shouldBeReturned(Object name) {
            return !((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
View Full Code Here

          });


        if (onlyUsePositives)
        {
          pta.paths.augmentPTA(generator.getAllSequences(0).filter(new FilterPredicate() {
            @Override
            public boolean shouldBeReturned(Object name) {
              return ((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
            }
          }));
View Full Code Here

              return len;
            }
          });

        if (onlyUsePositives)
          pta.paths.augmentPTA(generator.getAllSequences(0).filter(new FilterPredicate() {
            @Override
            public boolean shouldBeReturned(Object name) {
              return ((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
            }
          }));
        else
          pta.paths.augmentPTA(generator.getAllSequences(0));// the PTA will have very few reject-states because we are generating few sequences and hence there will be few negative sequences.
          // In order to approximate the behaviour of our case study, we need to compute which pairs are not allowed from a reference graph and use those as if-then automata to start the inference.
        //pta.paths.augmentPTA(referenceGraph.wmethod.computeNewTestSet(referenceGraph.getInit(),1));
   
        List<List<Label>> sPlus = generator.getAllSequences(0).getData(new FilterPredicate() {
          @Override
          public boolean shouldBeReturned(Object name) {
            return ((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
        List<List<Label>> sMinus= generator.getAllSequences(0).getData(new FilterPredicate() {
          @Override
          public boolean shouldBeReturned(Object name) {
            return !((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
View Full Code Here

    rpg.generatePosNeg(2*nrPerChunk , 100/percentPerChunk);
    for(int i=0;i<10;i++){
      final PTASequenceEngine samples = rpg.getAllSequences(i);
     
      PTASequenceEngine.FilterPredicate posPredicate = samples.getFSM_filterPredicate();
      PTASequenceEngine.FilterPredicate negPredicate = new FilterPredicate() {
        FilterPredicate origFilter = samples.getFSM_filterPredicate();
        public @Override boolean shouldBeReturned(Object name) {
          return !origFilter.shouldBeReturned(name);
        }
      };
View Full Code Here

TOP

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

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.