Examples of PTASequenceEngine


Examples of statechum.model.testset.PTASequenceEngine

    private PTASequenceEngine engine = null;
    private Map<CmpVertex,PTASequenceEngine.SequenceSet> fanout = null;

    public PTASequenceEngine constructEngine(LearnerGraph original, @SuppressWarnings("unused") LearnerGraph learnt)
    {
      engine = new PTASequenceEngine();
      engine.init(original.new NonExistingPaths());
      return engine;
    }
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

    private PTASequenceEngine engine = null;
    private Map<CmpVertex,PTASequenceEngine.SequenceSet> fanout = null;

    public PTASequenceEngine constructEngine(LearnerGraph original, @SuppressWarnings("unused") LearnerGraph learnt)
    {
      engine = new PTASequenceEngine();
      engine.init(original.new NonExistingPaths());
      return engine;
    }
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

      {
        theOnlyStateReject = true;break;
      }
    final Boolean rejectAllStates = new Boolean(theOnlyStateReject);
    final AtomicBoolean statesAccept = new AtomicBoolean(true);
    PTASequenceEngine allSequences = new PTASequenceEngine();
   
    // Here we are building a PTA which consists of accept states for plusStrings and reject-states
    // for minusStrings. This way if a plus string is a prefix of a plusString, the prefix will
    // be labelled with Boolean(true) states and the suffix - with Boolean(false) states.
    // Note that the suffix may contain many states.
    allSequences.init(new PTASequenceSetAutomaton()
    {
      @Override
      public Object getTheOnlyState() {
        return statesAccept.get()?accept:reject;
      }
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

    try
    {
      Configuration config = mainConfiguration.copy();
      RPNIUniversalLearner l = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,config,null,null));
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.getTentativeAutomaton().pathroutines.getGraph();
    }
    catch(IllegalArgumentException e)
    {
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

    try
    {
      Configuration config = mainConfiguration.copy();
      RPNIUniversalLearner l = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,config,null,null));
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.getTentativeAutomaton();
    }
    catch(IllegalArgumentException e)
    {
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

         
        default:
          throw new IllegalArgumentException("invalid type "+config.getGdScoreComputationAlgorithm()+" of score computation algorithm used");
        }
 
        PTASequenceEngine
          testSequencesA = stateToCorrespondingGraph.get(stateA).testSequences,
          testSequencesB = stateToCorrespondingGraph.get(stateB).testSequences;

        /*
        System.out.println("States: "+stateA+" and "+stateB+", total outgoing: "+totalOutgoing+", graphs: "+
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

   
    IllegalArgumentException exORIG = null;
   
    {// testing the orig part
      LearnerGraph s = buildLearnerGraph(machine, testName, testConfig,getLabelConverter());
      PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
      PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
      PTASequenceEngine.SequenceSet paths = engine.new SequenceSet();
      if (initSeq != null) initSet=initSet.cross(TestFSMAlgo.buildSet(initSeq, testConfig,getLabelConverter()));
      try
      {
        s.paths.ORIGcomputePathsSBetween(s.findVertex(FirstState), s.findVertex(SecondState),initSet,paths);
        Map<String,String> actual = engine.getDebugDataMapDepth(paths);
        Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.equals(actual));
      }
      catch(IllegalArgumentException ex)
      { exORIG = ex; }
     
    }

    IllegalArgumentException exNew = null;
   
    {// testing the new part
      LearnerGraph s = buildLearnerGraph(machine, testName, testConfig,getLabelConverter());
      PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
      PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
      PTASequenceEngine.SequenceSet paths = engine.new SequenceSet();
      if (initSeq != null) initSet=initSet.cross(TestFSMAlgo.buildSet(initSeq, testConfig,getLabelConverter()));
      try
      {
        s.pathroutines.computePathsSBetween(s.findVertex(FirstState), s.findVertex(SecondState),initSet,paths);
        Map<String,String> actual = engine.getDebugDataMapDepth(paths);
        Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.equals(actual));
      }
      catch(IllegalArgumentException ex)
      { exNew = ex; }
    }

    IllegalArgumentException exCaching = null;
   
    {// testing the latest part with caching.
      LearnerGraph s = buildLearnerGraph(machine, testName, testConfig,getLabelConverter());
      PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
      PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
      if (initSeq != null) initSet=initSet.cross(TestFSMAlgo.buildSet(initSeq, testConfig,getLabelConverter()));
      try
      {
        Map<CmpVertex,PTASequenceEngine.SequenceSet> map = s.pathroutines.computePathsSBetween_All(s.findVertex(FirstState), engine,initSet);
        PTASequenceEngine.SequenceSet pathsToSecondState = map.get(s.findVertex(SecondState));
        if (pathsToSecondState == null)
          throw new IllegalArgumentException("path from state "+FirstState+" to state "+SecondState+" was not found");

        Map<String,String> actual = engine.getDebugDataMapDepth(pathsToSecondState);
       
        // The one below only compares keysets because computePathsSBetween_All builds an entire tree and
        // consequently most vertices will not be leaf ones.
        Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.keySet().equals(actual.keySet()));
      }
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

  /** Checks that concatenation works for real paths, using the new routine. */
  @Test
  public final void testComputePathsSBetween16()
  {
    LearnerGraph s = buildLearnerGraph(complexGraphA, "ComputePathsSBetween_complexGraphA", testConfig,getLabelConverter());
    PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
    PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
    PTASequenceEngine.SequenceSet pathsA = engine.new SequenceSet();
    s.paths.ORIGcomputePathsSBetween(s.findVertex("F"), s.findVertex("D"),initSet,pathsA);
    PTASequenceEngine.SequenceSet pathsB = engine.new SequenceSet();
    s.paths.ORIGcomputePathsSBetween(s.findVertex("B"), s.findVertex("C"),pathsA,pathsB);
    PTASequenceEngine.SequenceSet pathsC = engine.new SequenceSet();
    s.paths.ORIGcomputePathsSBetween(s.findVertex("C"), s.findVertex("A"),pathsB,pathsC);
    Map<String,String> actual = engine.getDebugDataMapDepth(pathsC),expected = TestFSMAlgo.buildStringMap(
      new Object[][] {
        new Object[]{new String[] {"a","d","b"}, PTASequenceEngine.DebugDataValues.booleanToString(true, true)},
        new Object[]{new String[] {"a","b","b"}, PTASequenceEngine.DebugDataValues.booleanToString(true, true)},
        new Object[]{new String[] {"b","d","b"}, PTASequenceEngine.DebugDataValues.booleanToString(true, true)},
        new Object[]{new String[] {"b","b","b"}, PTASequenceEngine.DebugDataValues.booleanToString(true, true)}
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

    System.out.println(pr.getPosprecision()+", "+pr.getPosrecall()+", "+pr.getNegprecision()+", "+pr.getNegrecall());
  }
 
  public static PosNegPrecisionRecall compare(LearnerGraph specfsm, LearnerGraph imp){
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(imp);
    PTASequenceEngine engine = new PTA_FSMStructure(specfsm,null);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(specfsm.wmethod.getFullTestSet(1));
    precRec.crossWith(engine);return precRec.getPosNegPrecisionRecallNum();
  }
View Full Code Here

Examples of statechum.model.testset.PTASequenceEngine

    precRec.crossWith(engine);return precRec.getPosNegPrecisionRecallNum();
  }
 
  public static PosNegPrecisionRecall compare(Collection<List<String>> tests, LearnerGraph specfsm, LearnerGraph imp){
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(imp);
    PTASequenceEngine engine = new PTA_FSMStructure(specfsm,null);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(tests);
    precRec.crossWith(engine);return precRec.getPosNegPrecisionRecallNum();
  }
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.