Package statechum

Examples of statechum.Configuration


  }
 
  @Test
  public final void testGD_nondetA()
  {
    Configuration config = Configuration.getDefaultConfiguration();
    final LearnerGraphND
      grA=buildLearnerGraphND("A-x->A-a->C-u->C-v->C-c->F\nC-c->G\nC-c->A\nC-b->A\n"+
        "G-b->A\nG-a->C\nG-b->F\n"+
        "F-a->A\nF-a->C\nF-a->G\n"
        , "TestGD_MultipleCasesOfRenamingA",config,converter),
View Full Code Here


  /** Clashes between disconnected vertices and the original ones. */
  @Test
  public final void testGD_nondetB()
  {
    Configuration config = Configuration.getDefaultConfiguration();
    final LearnerGraphND
      grA=buildLearnerGraphND("A-x->A-a->C-u->C-v->C-c->F\nC-c->G\nC-c->A\nC-b->A\n"+
        "G-b->A\nG-a->C\nG-b->F\n"+
        "F-a->A\nF-a->C\nF-a->G\n"
        , "TestGD_MultipleCasesOfRenamingA",config,converter),
View Full Code Here

 
  /** Graph B is slightly different now, hence duplicates are different too. */
  @Test
  public final void testGD_nondetC()
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();
    final LearnerGraphND
      grA=buildLearnerGraphND("A-x->A-a->C-u->C-c->F\nC-c->G\nC-c->A\nC-b->A\n"+
        "G-b->A\nG-a->C\nG-b->F\n"+
        "F-a->A\nF-a->C\nF-a->G\n"
        , "TestGD_MultipleCasesOfRenamingA",config,converter),
View Full Code Here

    runTest(grA,grB, stateC,expectedDuplicates);
  }
 
  private LearnerGraphND runTest(LearnerGraphND grA, LearnerGraphND grB, String secondStateInKeyPair, String [] duplicatesExpectedString)
  {
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);config.setGdKeyPairThreshold(.1);
    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd = new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
    gd.init(grA, grB, threadNumber,config);gd.identifyKeyPairs();
    ChangesRecorder recorder = new ChangesRecorder(null);
    gd.makeSteps();gd.computeDifference(recorder);
    //Visualiser.updateFrame(grA,grB);Visualiser.updateFrame(gd.showGD(grA, grB, 1), null);
    Assert.assertEquals(2,gd.aTOb.size());
    Set<CmpVertex> keyPairsLeft = new TreeSet<CmpVertex>(),keyPairsRight = new TreeSet<CmpVertex>();
    keyPairsLeft.addAll(Arrays.asList(new CmpVertex[]{grA.findVertex(VertexID.parseID("A")),grA.findVertex(VertexID.parseID("C"))}));
    keyPairsRight.addAll(Arrays.asList(new CmpVertex[]{gd.origToNewB.get(grB.findVertex(VertexID.parseID("B"))),gd.origToNewB.get(grB.findVertex(VertexID.parseID(secondStateInKeyPair)))}));
    Assert.assertEquals(keyPairsLeft, gd.aTOb.keySet());
    Set<CmpVertex> actual = new TreeSet<CmpVertex>();actual.addAll(gd.aTOb.values());Assert.assertEquals(keyPairsRight, actual);
    Set<CmpVertex> duplicatesExpected = new TreeSet<CmpVertex>();
    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);
    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);
View Full Code Here

  }
 
  @Test
  public final void testGD_nondet_incompatibles()
  {
    Configuration config = Configuration.getDefaultConfiguration();
    final LearnerGraphND
      grA=buildLearnerGraphND("A-x->A-a->C-u->C-c->F\nC-v->C\nC-c->G\nC-c->A\nC-b->A\n"+
        "G-b->A\nG-b->C\nG-b->F\n"+
        "F-a->A\nF-a->C\nF-a->G\n"
        , "TestGD_MultipleCasesOfRenamingA",config,converter),
View Full Code Here

   * @param graph what to invert.
   * @return inverted graph
   */
  public static LearnerGraphND computeInverseGraph(LearnerGraph graph)
  {
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND inverseGraph = new LearnerGraphND(shallowCopy);inverseGraph.initEmpty();
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,inverseGraph)// do the inverse to the tentative graph
    return inverseGraph;
  }
View Full Code Here

    /** Maps states to a function associating labels to a sum of probabilities from a Markov matrix. Such a sum is supposed to predict the likelyhood of a transition with this label from every state. */
    Map<CmpVertex,Map<Label,UpdatablePairInteger>> state_outgoing_occurence=new HashMap<CmpVertex,Map<Label,UpdatablePairInteger>>();
    /** Maps states to a function associating labels to a probability of a transition with the label of interest from a state of interest. Computed from {@link MarkovUniversalLearner#state_outgoing_occurence}. */
    Map<CmpVertex,Map<Label,UpdatablePairDouble>> state_outgoing=new HashMap<CmpVertex,Map<Label,UpdatablePairDouble>>();

    final Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraph outcome = new LearnerGraph(shallowCopy);
    LearnerGraph.copyGraphs(graph, outcome);
    final Set<Label> allElementsOfAlphabet = graph.learnerCache.getAlphabet();
    // mapping map to store all paths leave each state in different length
      for(CmpVertex vert:graph.transitionMatrix.keySet())
View Full Code Here

      throw new IllegalArgumentException("predictions are only supported in the forward direction, not inverse");

    /** Maps states to a function associating labels to a probability of a transition with the label of interest from a state of interest. Computed from {@link MarkovUniversalLearner#state_outgoing_occurence}. */
    Map<CmpVertex,Map<Label,MarkovOutcome>> state_outgoing=predictTransitions();

    final Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraph graphWithPredictedTransitions = new LearnerGraph(shallowCopy);
    LearnerGraph.copyGraphs(graph, graphWithPredictedTransitions);

    // in this part the tree is extended depend on their outgoing transition probabilities
     for(Entry<CmpVertex, Map<Label, MarkovOutcome>> outgoing:state_outgoing.entrySet())
View Full Code Here

{
  public static DirectedSparseGraph obtainDifferenceGraph(String graphA, String graphB,int counter,boolean display)
  {
    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd =
      new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
    Configuration config = Configuration.getDefaultConfiguration();
    LearnerGraphND grA=new LearnerGraphND(buildGraph(graphA, "labellingDemo_A_"+counter),config),grB=
    new LearnerGraphND(buildGraph(graphB, "labellingDemo_B_"+counter),config);
    DirectedSparseGraph gr = gd.showGD(
        grA,grB,
        ExperimentRunner.getCpuNumber());
View Full Code Here

   * @param graph what to invert.
   * @return inverted graph
   */
  public static LearnerGraphND computeInverseGraph(LearnerGraph graph)
  {
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND inverseGraph = new LearnerGraphND(shallowCopy);inverseGraph.initEmpty();
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,inverseGraph)// do the inverse to the tentative graph
    return inverseGraph;
  }
View Full Code Here

TOP

Related Classes of statechum.Configuration

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.