Package statechum.analysis.learning.rpnicore.WMethod

Examples of statechum.analysis.learning.rpnicore.WMethod.DifferentFSMException


    {
      StatePair statePair = currentExplorationBoundary.remove();
      assert big.transitionMatrix.containsKey(statePair.firstElem) : "state "+statePair.firstElem+" is not known to the first graph";
      assert small.transitionMatrix.containsKey(statePair.secondElem) : "state "+statePair.secondElem+" is not known to the second graph";
      if (statePair.firstElem.isAccept() != statePair.secondElem.isAccept())
        throw new DifferentFSMException("states "+statePair.firstElem+" and " + statePair.secondElem+" have a different acceptance labelling between the machines");

      Map<Label,CmpVertex> targetsBig = big.transitionMatrix.get(statePair.firstElem);
      Map<Label,CmpVertex> targetsSmall = small.transitionMatrix.get(statePair.secondElem);
         
      for(Entry<Label,CmpVertex> labelstate:targetsSmall.entrySet())
View Full Code Here


      if (GlobalConfiguration.getConfiguration().isAssertEnabled())
      {
        // Cannot compare colours here because patches are structural,
        // hence where there are no new transitions, colours are retained rather
        // than changed to new ones.
        DifferentFSMException ex = WMethod.checkM(newGraph, graph);
        if (ex != null) throw ex;
        ex = WMethod.checkM(newGraph, whatShouldBeIdenticalToNewGraph);
        if (ex != null) throw ex;
        ex = WMethod.checkM_and_colours(newGraph, whatShouldBeIdenticalToNewGraph,VERTEX_COMPARISON_KIND.DEEP);
        if (ex != null) throw ex;
View Full Code Here

        }
    }
   
    // the learning of the pairs experiment should always produce the correct outcome since decisions to merge pairs are guaranteed to be correct.
         LearnerGraph learntWithoutNegatives = new LearnerGraph(learnerInitConfiguration.config);AbstractPathRoutines.removeRejectStates(actualAutomaton,learntWithoutNegatives);
    DifferentFSMException diff = WMethod.checkM(referenceGraph, learntWithoutNegatives);if (diff != null) throw diff;
    System.out.println(new Date().toString()+" arff written");
    return actualAutomaton;
  }
View Full Code Here

    graph.config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
    graph.paths.augmentPTA(minusStrings, false,true);

    final LearnerGraph expected = new LearnerGraph(Configuration.getDefaultConfiguration().copy());
    expected.getVertex(new LinkedList<String>()).setAccept(false);
    DifferentFSMException result = WMethod.checkM(expected,graph);
    Assert.assertNull(result);
    checkDepthLabelling(graph);
  }
View Full Code Here

      }
    }
   
    if (checkWasModified)
    {// if graphModified is true the graph should not have been modified and vice-versa
      DifferentFSMException ex = WMethod.checkM(graph, result);
      assert graphModified == (ex != null);
    }
    return graphModified?result:null;
  }
View Full Code Here

      }
    }
   
    if (GlobalConfiguration.getConfiguration().isAssertEnabled() && checkWasModified)
    {// if graphModified is true the graph should not have been modified and vice-versa
      DifferentFSMException ex = WMethod.checkM(graph, result);
      assert graphModified == (ex != null);
    }
    return graphModified?result:null;
  }
View Full Code Here

    {
      StatePair statePair = currentExplorationBoundary.remove();
      assert big.transitionMatrix.containsKey(statePair.firstElem) : "state "+statePair.firstElem+" is not known to the first graph";
      assert small.transitionMatrix.containsKey(statePair.secondElem) : "state "+statePair.secondElem+" is not known to the second graph";
      if (statePair.firstElem.isAccept() != statePair.secondElem.isAccept())
        throw new DifferentFSMException("states "+statePair.firstElem+" and " + statePair.secondElem+" have a different acceptance labelling between the machines");

      Map<Label,CmpVertex> targetsBig = big.transitionMatrix.get(statePair.firstElem);
      Map<Label,CmpVertex> targetsSmall = small.transitionMatrix.get(statePair.secondElem);
         
      for(Entry<Label,CmpVertex> labelstate:targetsSmall.entrySet())
View Full Code Here

    {
      // Checks that all states recorded as equivalent are indeed equivalent
      for(CmpVertex eA:eqStatesGroup.getStates())
        for(CmpVertex eB:eqStatesGroup.getStates())
        {
          DifferentFSMException exception = WMethod.checkM(fsm,eA,fsm,eB,WMethod.VERTEX_COMPARISON_KIND.NONE);
          Assert.assertNull("states "+eA+" and "+eB+" should belong to the same equivalence class, got "+(exception == null?"":exception.getMessage()),exception);
        }
      // Checks that all states in different equivalence classes are not equivalent.
      for(AMEquivalenceClass<CmpVertex,LearnerGraphCachedData> eqStatesGroupAnother:e.getEquivalentStates())
        if (eqStatesGroup != eqStatesGroupAnother)
        {
          for(CmpVertex eA:eqStatesGroup.getStates()) // our states
            for(CmpVertex eB:eqStatesGroupAnother.getStates()) // other states
            {
              DifferentFSMException exception = WMethod.checkM(fsm,eA,fsm,eB,WMethod.VERTEX_COMPARISON_KIND.NONE);
              if (exception == null)
              {// failure tracing
                fsm.config.setPrefixClosed(true);
                DifferentFSMException ex = WMethod.checkM(fsm,eA,fsm,eB,WMethod.VERTEX_COMPARISON_KIND.NONE);
                System.out.println("B: "+fsm.transitionMatrix.get(fsm.findVertex("B"))+" ; D:  "+fsm.transitionMatrix.get(fsm.findVertex("D")));
                System.out.println(ex);
                fsm.config.setPrefixClosed(false);
                DifferentFSMException ex2 = WMethod.checkM(fsm,eA,fsm,eB,WMethod.VERTEX_COMPARISON_KIND.NONE);
                System.out.println(ex2==null?"NULL":ex);
              }
              Assert.assertNotNull("states "+eA+" and "+eB+" should belong to different equivalence classes",exception);
            }
        }
View Full Code Here

    Configuration config = Configuration.getDefaultConfiguration();
    final LearnerGraph graph = new LearnerGraph(FsmParser.buildGraph("A-a->B-a->A\nB-c->C-(1 && (a || b))->C","testInterpretLabelsOnGraph3a"),config);
    final LearnerGraph expected = new LearnerGraph(FsmParser.buildGraph("A-a->B-a->A\nB-c->C-a->C-b->C","testInterpretLabelsOnGraph3b"),config);
    Set<String> alphabet = graph.pathroutines.computeAlphabet();alphabet.remove("1");alphabet.add("b");
    final LearnerGraph outcome = graph.transform.interpretLabelsOnGraph(alphabet);
    DifferentFSMException ex= WMethod.checkM_and_colours(expected, outcome, VERTEX_COMPARISON_KIND.DEEP);
    Assert.assertNull(ex==null?"":ex.toString(),ex);
  }
View Full Code Here

    Set<String> alphabet = new TreeSet<String>();alphabet.addAll(Arrays.asList(new String[]{"load","save","edit","close","exit"}));
    final LearnerGraph outcome = graph.transform.interpretLabelsOnGraph(alphabet);
    expected.addTransition(expected.transitionMatrix.get(expected.findVertex(VertexID.parseID("A"))), "to_R",expected.findVertex(VertexID.parseID("R")));
    outcome.addTransition(outcome.transitionMatrix.get(outcome.findVertex(VertexID.parseID("A"))), "to_R",outcome.findVertex(VertexID.parseID("R")));
    //Visualiser.updateFrame(PathRoutines.convertPairAssociationsToTransitions(expected,config), PathRoutines.convertPairAssociationsToTransitions(outcome,config));
    DifferentFSMException ex= WMethod.checkM_and_colours(expected, outcome, VERTEX_COMPARISON_KIND.NONE);
    Assert.assertNull(ex==null?"":ex.toString(),ex);
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.rpnicore.WMethod.DifferentFSMException

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.