Examples of writeGD()


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

    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()), converter);
    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

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

    // 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()), converter);
    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

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

    LearnerGraphND graph = buildLearnerGraphND("A-a->B-a-#C\nA-d-#D\nA-c->A","testAddTransitions4",Configuration.getDefaultConfiguration());
    LearnerGraphND removed = buildLearnerGraphND("A-d-#D\nB-a-#C","testRemoveTransitions1",Configuration.getDefaultConfiguration());
    LearnerGraphND added = buildLearnerGraphND("A-d-#E\nB-a-#C","testRemoveTransitions1",Configuration.getDefaultConfiguration());
    ChangesRecorder patcher = new ChangesRecorder(removed,added,null);

    ChangesRecorder.applyGD(graph, patcher.writeGD(createDoc()));
    LearnerGraph expected = buildLearnerGraph("A-a->B-a-#C\nA-d-#E\nA-c->A","testWriteAndLoad1",Configuration.getDefaultConfiguration());
    Assert.assertNull(WMethod.checkM_and_colours(expected, graph, VERTEX_COMPARISON_KIND.DEEP));
  }

  @Test
View Full Code Here

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

    LearnerGraphND graph = buildLearnerGraphND("A-a->B-a-#C\nA-d-#D\nA-c->A","testAddTransitions4",Configuration.getDefaultConfiguration());
    LearnerGraphND removed = buildLearnerGraphND("A-d-#D\nA-a->B\nB-a-#C","testRemoveTransitions1",Configuration.getDefaultConfiguration());
    LearnerGraphND added = buildLearnerGraphND("A-d-#E\nB-a-#C\nB-c->B\nA-q->B","testRemoveTransitions1",Configuration.getDefaultConfiguration());
    ChangesRecorder patcher = new ChangesRecorder(removed,added,null);

    ChangesRecorder.applyGD(graph, patcher.writeGD(createDoc()));
    LearnerGraph expected = buildLearnerGraph("A-q->B-a-#C\nA-d-#E\nA-c->A\nB-c->B","testWriteAndLoad1",Configuration.getDefaultConfiguration());
    Assert.assertNull(WMethod.checkM_and_colours(expected, graph, VERTEX_COMPARISON_KIND.DEEP));
  }
 
  @Test
View Full Code Here

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

    ChangesRecorder patcher = new ChangesRecorder(null);
    patcher.addTransition(graph.findVertex("B"), AbstractLearnerGraph.generateNewLabel("c", cloneConfig), graph.findVertex("B"));
    patcher.removeTransition(graph.findVertex("A"), label_a, graph.findVertex("B"));
    patcher.addTransition(graph.findVertex("A"), label_q, graph.findVertex("B"));
    patcher.setInitial(graph.findVertex("A"));
    ChangesRecorder.applyGD(graph, patcher.writeGD(createDoc()));
    LearnerGraph expected = buildLearnerGraph("A-q->B-a-#C\nA-d-#D\nA-c->A\nB-c->B","testWriteAndLoad1",Configuration.getDefaultConfiguration());
    WMethod.checkM_and_colours(expected, graph, VERTEX_COMPARISON_KIND.DEEP);
  }
 
  /** Tests that initial state has to be assigned. */
 
View Full Code Here

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

    final ChangesRecorder patcher = new ChangesRecorder(null);
    patcher.addTransition(graph.findVertex("B"), AbstractLearnerGraph.generateNewLabel("c", cloneConfig), graph.findVertex("B"));
    patcher.removeTransition(graph.findVertex("A"), label_a, graph.findVertex("B"));
    patcher.addTransition(graph.findVertex("A"), label_q, graph.findVertex("B"));
    checkForCorrectException(new whatToRun() { public @Override void run() {
      patcher.writeGD(createDoc());}},
    IllegalArgumentException.class,"init state is was not defined");
  }
 
  /** Test that a graph with incompatible states, relabelling and dangling states is handled correctly. */
  @Test
View Full Code Here

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

    CmpVertex danglingVertex = AbstractLearnerGraph.generateNewCmpVertex(VertexID.parseID("TEST"), cloneConfig);
    danglingVertex.setColour(JUConstants.BLUE);
    patcher.addVertex(danglingVertex);
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setLearnerCloneGraph(false);
    LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData> graphPatcher = new LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData>(graph,config,null);
    ChangesRecorder.loadDiff(graphPatcher, patcher.writeGD(createDoc()));
    graphPatcher.removeDanglingStates();
    LearnerGraphND result = new LearnerGraphND(Configuration.getDefaultConfiguration());
    graphPatcher.relabel(result);
   
    LearnerGraphND expected = buildLearnerGraphND("U-q->B-a-#R\nU-d-#D\nU-c->U\nB-c->B\nU-a->S-a->S","testWriteAndLoad1",Configuration.getDefaultConfiguration());
View Full Code Here

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

    gd.statesInKeyPairs.add(C);gd.statesInKeyPairs.add(newF);

    gd.makeSteps();
    gd.computeDifference(patcher);
   
    ChangesRecorder.applyGD_WithRelabelling(graph, patcher.writeGD(TestGD.createDoc()),outcome);
    Assert.assertNull(WMethod.checkM(grB,graph));
    Assert.assertEquals(grB.getStateNumber(),graph.getStateNumber());
    Assert.assertEquals(JUConstants.AMBER,grA.findVertex(VertexID.parseID("C")).getColour());
  }
 
View Full Code Here

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

      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

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

      if (!gd.fallbackToInitialPair) 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
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.