Package statechum.analysis.learning.rpnicore.GD

Examples of statechum.analysis.learning.rpnicore.GD.ChangesRecorder.writeGD()


      if (!gd.fallbackToInitialPair) TestGD_ExistingGraphs.addPairsRandomly(gd,pairsToAdd);
      else Assert.assertEquals(-1.,low_to_high_ratio,Configuration.fpAccuracy);
      gd.makeSteps();
      gd.computeDifference(patcher);

      ChangesRecorder.applyGD_WithRelabelling(graph, patcher.writeGD(TestGD.createDoc()),outcome);
      Assert.assertNull(testDetails(),WMethod.checkM(grB,graph));
      Assert.assertEquals(testDetails(),grB.getStateNumber(),graph.getStateNumber());
      DifferentFSMException ex= WMethod.checkM_and_colours(grB,outcome,VERTEX_COMPARISON_KIND.DEEP);
      Assert.assertNull(testDetails()+ex,WMethod.checkM_and_colours(grB,outcome,VERTEX_COMPARISON_KIND.DEEP));Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
      Assert.assertEquals(grB,outcome);
View Full Code Here


    for(String dup:duplicatesExpectedString) duplicatesExpected.add(gd.origToNewB.get(grB.findVertex(VertexID.parseID(dup))));
   
    Assert.assertEquals(duplicatesExpected,gd.duplicates);
    Configuration cloneConfig = config.copy();cloneConfig.setLearnerCloneGraph(true);
    LearnerGraphND graph = new LearnerGraphND(cloneConfig);AbstractLearnerGraph.copyGraphs(grA, graph);
    ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()));
    LearnerGraphND outcome = new LearnerGraphND(config);AbstractLearnerGraph.copyGraphs(graph, outcome);
    Assert.assertNull(WMethod.checkM(grB, graph));

    // Now do the same as above, but renumber states to match grB
    AbstractLearnerGraph.copyGraphs(grA, graph);
View Full Code Here

    // Now do the same as above, but renumber states to match grB
    AbstractLearnerGraph.copyGraphs(grA, graph);
    Configuration configMut = Configuration.getDefaultConfiguration().copy();config.setLearnerCloneGraph(false);
    LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData> graphPatcher = new LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData>(graph,configMut,null);
    ChangesRecorder.loadDiff(graphPatcher, recorder.writeGD(TestGD.createDoc()));
    graphPatcher.removeDanglingStates();
    LearnerGraphND result = new LearnerGraphND(configMut);
    graphPatcher.relabel(result);
    Assert.assertNull(WMethod.checkM_and_colours(grB, result,VERTEX_COMPARISON_KIND.DEEP));
    return outcome;
View Full Code Here

      else Assert.assertEquals(-1.,low_to_high_ratio,Configuration.fpAccuracy);
      gd.makeSteps();
      gd.computeDifference(patcher);

      LearnerGraphND outcome = new LearnerGraphND(config);
      ChangesRecorder.applyGD_WithRelabelling(graph, patcher.writeGD(TestGD.createDoc()),outcome);
      Assert.assertNull(testDetails(),WMethod.checkM(grB,graph));
      Assert.assertEquals(testDetails(),grB.getStateNumber(),graph.getStateNumber());
      Assert.assertEquals(grB,outcome);
     
      // Cannot do checkM_and_colours here because merged vertices may change their colours and other attributes.
View Full Code Here

    ChangesRecorder recorder = new ChangesRecorder(null);
    gd.makeSteps();gd.computeDifference(recorder);
    //printListOfPairs(gd, allKeyPairs);
    Assert.assertEquals(expectedMatchedPairs,gd.aTOb.size());
    LearnerGraph graph = new LearnerGraph(buildGraph(graphA,name+"A"),config);
    ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()));
    Assert.assertNull(WMethod.checkM(graph, grB));Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
  }
 
  private final void testNesting(String graphA,String graphB,String name, Configuration argConfig)
  {
View Full Code Here

      ChangesRecorder.applyGD(graph1, gd.computeGDToXML(grA, grB, threadNumber, TestGD.createDoc(), rec9,Configuration.getDefaultConfiguration()));
      Assert.assertNull(WMethod.checkM(graph1, grB));Assert.assertEquals(grB.getStateNumber(),graph1.getStateNumber());
    }
    {// check that changes propagated to rec7 are correct.
      LearnerGraph graph2 = new LearnerGraph(buildGraph(graphA,name+"A"),config);
      ChangesRecorder.applyGD(graph2, rec7.writeGD(TestGD.createDoc()));
      Assert.assertNull(WMethod.checkM(graph2, grB));Assert.assertEquals(grB.getStateNumber(),graph2.getStateNumber());
    }
    {// check that changes propagated to rec4 are correct.
      LearnerGraph graph3 = new LearnerGraph(buildGraph(graphA,name+"A"),config);
      ChangesRecorder.applyGD(graph3, rec4.writeGD(TestGD.createDoc()));
View Full Code Here

    LearnerGraph grB = convertToNumerical(new LearnerGraph(config));
    ChangesRecorder recorder = new ChangesRecorder(null);
    GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData> gd = new GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData>();
    gd.computeGD(grA, grB, threadNumber, recorder,config);
    LearnerGraph graph = new LearnerGraph(config);graph.setInit(null);graph.transitionMatrix.clear();
    ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()));
    Assert.assertNull(WMethod.checkM(graph, grB));Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
  }
 
  /** empty graph, with a single reject state (accept,reject). */
  @Test
 
View Full Code Here

    LearnerGraph grB = convertToNumerical(new LearnerGraph(config));grB.getInit().setAccept(false);
    ChangesRecorder recorder = new ChangesRecorder(null);
    GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData> gd = new GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData>();
    gd.computeGD(grA, grB, threadNumber, recorder,config);
    LearnerGraph graph = new LearnerGraph(config);graph.setInit(null);graph.transitionMatrix.clear();
    ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()));
    Assert.assertNull(WMethod.checkM(graph, grB));Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
  }
 
  /** empty graph, with a single reject state (accept,reject). */
  @Test
 
View Full Code Here

    LearnerGraph grB = convertToNumerical(new LearnerGraph(config));grB.getInit().setAccept(false);
    ChangesRecorder recorder = new ChangesRecorder(null);
    GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData> gd = new GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData>();
    gd.computeGD(grA, grB, threadNumber, recorder,config);
    LearnerGraph graph = new LearnerGraph(config);graph.setInit(null);graph.transitionMatrix.clear();
    ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()));
    Assert.assertNull(WMethod.checkM(graph, grB));Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
  }
 
  /** empty graph, with a single accept state. */
  @Test
 
View Full Code Here

    LearnerGraph grB = convertToNumerical(new LearnerGraph(buildGraph(A6,"testComputeGD5b"),config));
    ChangesRecorder recorder = new ChangesRecorder(null);
    GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData> gd = new GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData>();
    gd.computeGD(grA, grB, threadNumber, recorder,config);
    LearnerGraph graph = new LearnerGraph(config);graph.setInit(null);graph.transitionMatrix.clear();
    ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()));
    Assert.assertNull(WMethod.checkM(graph, grB));Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
  }
 
  /** empty graph, with a single accept state. */
  @Test
 
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.