Package statechum.analysis.learning.rpnicore

Examples of statechum.analysis.learning.rpnicore.LearnerGraphND$ignoreZeroClass


 
  @Test
  public void testSetRed4()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    final LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000',a,'P1000'},"+
              " {'P1000',b,'P1002'},"+
              " {'P1000',c,'N1000'},"+
              " {'P1002',c,'P1002'},"+
              " {'P1002',d,'P1002'}],"+
              "'P1000',"+
              "[d,b,c,a]}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);
    Assert.assertEquals(0, grA.getRedStateNumber());
    checkForCorrectException(new whatToRun() { public @Override void run() {
      Synapse.StatechumProcess.setReds(new OtpErlangList(new OtpErlangObject[]{new OtpErlangAtom("P1009")}), grA);
    }},IllegalArgumentException.class,"not found");
  }
View Full Code Here


  /** Special case of fsmdiff */
  @Test
  public void testFsmDiff1a()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000',a,'P1000'},"+
              " {'P1000',b,'P1002'},"+
              " {'P1000',c,'N1000'},"+
              " {'P1002',c,'P1002'},"+
              " {'P1002',d,'P1002'}],"+
              "'P1000',"+
              "[d,b,c,a]}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);
    Assert.assertTrue(grA.getInit().isAccept());
    Assert.assertFalse(grA.findVertex("N1000").isAccept());
    grA.findVertex("N1000").setAccept(true);
   
    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1000'],"+
              "[{'P1000',a,'P1001'},"+
              "{'P1000',c,'P1001'},"+
              "{'P1001',a,'N1000'},"+
              "{'P1001',b,'P1000'},"+
              "{'P1001',d,'P1001'}],"+
              "'P1000',"+
              "[d,b,c,a]}"),grB,null,true);
    Assert.assertTrue(grB.getInit().isAccept());
    Assert.assertFalse(grB.findVertex("N1000").isAccept());
    grB.findVertex("N1000").setAccept(true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[{'P1003','a','P1001'},"+
                                                 "{'P1003','c','P1001'},"+
                                                 "{'P1001','a','P1000'},"+
                                                 "{'P1001','b','P1003'},"+
                                                 "{'P1001','d','P1001'}],"+
                                                "[{'P1000','a','P1000'},"+
                                                "{'P1000','b','P1002'},"+
                                                 "{'P1000','c','N1000'},"+
                                                 "{'P1002','c','P1002'},"+
                                                 "{'P1002','d','P1002'}],"+
                                                "['P1003','P1001'],"+
                                               "['N1000','P1002'],"+
                                                "[{'P1000','N1000'},{'P1003','P1000'}],"+
                                                "'P1003'}" , ErlangLabel.dumpErlangObject(difference));
    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(shouldBeLikePrevious.getStateNumber(),grB.getStateNumber());
   
    DirectedSparseGraph gr = DifferenceVisualiser.ChangesToGraph.computeVisualisationParameters(grAerlang, difference);
    Map<String,String> edgeToColours = new TreeMap<String,String>();
    for(Object edgeObj:gr.getEdges())
    {
View Full Code Here

  /** Special case of fsmdiff */
  @Test
  public void testFsmDiff1b()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000',a,'P1000'},"+
              " {'P1000',b,'P1002'},"+
              " {'P1000',c,'N1000'},"+
              " {'P1002',c,'P1002'},"+
              " {'P1002',d,'P1002'}],"+
              "'P1000',"+
              "[d,b,c,a]}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);
    Assert.assertTrue(grA.getInit().isAccept());
    Assert.assertFalse(grA.findVertex("N1000").isAccept());
   
    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1000'],"+
              "[{'P1000',a,'P1001'},"+
              "{'P1000',c,'P1001'},"+
              "{'P1001',a,'N1000'},"+
              "{'P1001',b,'P1000'},"+
              "{'P1001',d,'P1001'}],"+
              "'P1000',"+
              "[d,b,c,a]}"),grB,null,true);
    Assert.assertTrue(grB.getInit().isAccept());
    Assert.assertFalse(grB.findVertex("N1000").isAccept());
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1002'},{'P1000','c','P1002'},{'P1002','a','N1000'},{'P1002','b','P1000'}],[{'P1000','a','P1000'},{'P1000','b','P1002'},{'P1000','c','N1000'},{'P1002','c','P1002'}],[],[],[{'P1002','P1001'}],'P1000'}" , ErlangLabel.dumpErlangObject(difference));
  }
View Full Code Here

  /** Special case of fsmdiff - disconnected states */
  @Test
  public void testFsmDiff2()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000','a','P1000'}],"+
              "'P1000',"+
              "['a']}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1000'],"+
              "[{'P1000','a','P1001'}],"+
              "'P1000',"+
              "['a']}"),grB,null,true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['P1001','N1000'],['P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
  }
View Full Code Here

  /** Special case of fsmdiff - disconnected states with different names */
  @Test
  public void testFsmDiff3a()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000','a','P1000'}],"+
              "'P1000',"+
              "['a']}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1001'],"+
              "[{'P1000','a','P1001'}],"+
              "'P1000',"+
              "['a']}"),grB,null,true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['N1001','P1001'],['N1000','P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
  }
View Full Code Here

  /** Special case of fsmdiff - disconnected states with different names */
  @Test
  public void testFsmDiff3b()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000','a','P1000'}],"+
              "'P1000',"+
              "['a']}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1001'],"+
              "[{'P1001','a','P1001'}],"+
              "'P1001',"+
              "['a']}"),grB,null,true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[],[],['N1001','P1003'],['N1000','P1002'],[{'P1000','P1001'},{'P1003','P1000'}],'P1000'}",ErlangLabel.dumpErlangObject(difference));

    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
  }
View Full Code Here

  /** Special case of fsmdiff - disconnected states with different names */
  @Test
  public void testFsmDiff3c()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000','a','P1000'}],"+
              "'P1000',"+
              "['a']}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1001'],"+
              "[{'P1001','a','P1001'}],"+
              "'P1000',"+ // a disconnected initial state
              "['a']}"),grB,null,true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[],[],['N1001','P1003'],['N1000','P1002'],[{'P1000','P1001'},{'P1003','P1000'}],'P1003'}",ErlangLabel.dumpErlangObject(difference));

    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
  }
View Full Code Here

  /** Special case of fsmdiff - disconnected states */
  @Test
  public void testFsmDiff4()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002'],"+
              "[{'P1000','a','P1000'}],"+
              "'P1000',"+
              "['a']}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1000'],"+
              "[{'P1000','a','P1001'}],"+
              "'P1000',"+
              "['a']}"),grB,null,true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['P1001','N1000'],['P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
  }
View Full Code Here

  /** Special case of fsmdiff - disconnected states */
  @Test
  public void testFsmDiff5()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
    LearnerGraphND grA = new LearnerGraphND(config);
    OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
              "[{'P1000','a','P1000'}],"+
              "'P1000',"+
              "['a']}");
    Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

    LearnerGraphND grB = new LearnerGraphND(config);
    Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001'],"+
              "[{'P1000','a','P1001'}],"+
              "'P1000',"+
              "['a']}"),grB,null,true);
   
    OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
    Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['P1001'],['N1000','P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

    LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
    DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
    DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
    Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
  }
View Full Code Here

  {
    AbstractLearnerGraph Inverse_Graph = null;
    if (predictForward)
    {
      Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
      LearnerGraphND Inverse = new LearnerGraphND(shallowCopy);Inverse.initEmpty();
      AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse)// do the inverse to the tentative graph
      Inverse_Graph = Inverse;
    }
    else
      Inverse_Graph = graph;
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.rpnicore.LearnerGraphND$ignoreZeroClass

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.