Package statechum

Examples of statechum.Label


  @Test
  public void testConstructPairsToMergeWithOutgoing1()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("M1-c->C1 / M1-a->A1-b->M2-c->C2-a->A3-b->M4-c->C4-a->A4 / M2-a->A2-b->M3-c->C3-d-#D / M2-b->B","testCconstructPairsToMergeWithOutgoing1",mainConfiguration, converter);
    Set<CmpVertex> actual = new TreeSet<CmpVertex>(), expectedTargets = new TreeSet<CmpVertex>(), actualTargets = new TreeSet<CmpVertex>();
    Label unique = AbstractLearnerGraph.generateNewLabel("c", mainConfiguration,converter);
    actual.addAll(PairQualityLearner.constructPairsToMergeWithOutgoing(graph, unique));
    Assert.assertEquals(4,actual.size());
    expectedTargets.addAll(Arrays.asList(new CmpVertex[]{graph.findVertex("C1"),graph.findVertex("C2"),graph.findVertex("C3"),graph.findVertex("C4")}));
    for(CmpVertex v:actual)
    {
View Full Code Here


  @Test
  public void testConstructPairsToMergeWithOutgoing2()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("M1-c-#C1 / M1-a->A1-b->M2-c->C2-a->A3-b->M4-c->C4-a->A4 / M2-a->A2-b->M3-c->C3-d-#D / M2-b->B","testCconstructPairsToMergeWithOutgoing2",mainConfiguration, converter);
    Set<CmpVertex> actual = new TreeSet<CmpVertex>(), expectedTargets = new TreeSet<CmpVertex>(), actualTargets = new TreeSet<CmpVertex>();
    Label unique = AbstractLearnerGraph.generateNewLabel("c", mainConfiguration,converter);
    actual.addAll(PairQualityLearner.constructPairsToMergeWithOutgoing(graph, unique));
    Assert.assertEquals(3,actual.size());
    expectedTargets.addAll(Arrays.asList(new CmpVertex[]{graph.findVertex("C2"),graph.findVertex("C3"),graph.findVertex("C4")}));
    for(CmpVertex v:actual)
    {
View Full Code Here

  @Test
  public void testConstructPairsToMergeWithOutgoing3()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("M1-c->C1 / M1-a->A1-b->M2-c->C2-a->A3-b->M4-c->C4-a->A4 / M2-a->A2-b->M3-c-#D / M2-b->B","testConstructPairsToMergeWithOutgoing3",mainConfiguration, converter);
    Set<CmpVertex> actual = new TreeSet<CmpVertex>(), expectedTargets = new TreeSet<CmpVertex>(), actualTargets = new TreeSet<CmpVertex>();
    Label unique = AbstractLearnerGraph.generateNewLabel("c", mainConfiguration,converter);
    actual.addAll(PairQualityLearner.constructPairsToMergeWithOutgoing(graph, unique));
    Assert.assertEquals(3,actual.size());
    expectedTargets.addAll(Arrays.asList(new CmpVertex[]{graph.findVertex("C1"),graph.findVertex("C2"),graph.findVertex("C4")}));
    for(CmpVertex v:actual)
    {
View Full Code Here

    public ThreadResult call() throws Exception
    {
      final int alphabet = 2*states;
      LearnerGraph referenceGraph = null;
      ThreadResult outcome = new ThreadResult();
      Label uniqueFromInitial = null;
      MachineGenerator mg = new MachineGenerator(states, 400 , (int)Math.round((double)states/5));mg.setGenerateConnected(true);
      do
      {
        referenceGraph = mg.nextMachine(alphabet,seed, config, converter).pathroutines.buildDeterministicGraph();// reference graph has no reject-states, because we assume that undefined transitions lead to reject states.
        if (pickUniqueFromInitial)
View Full Code Here

    List<List<Label>> uniqueSequences = new LinkedList<List<Label>>();
    for(Label l1:ptaClassifier.graph.getCache().getAlphabet())
    {
      boolean nonUnique = false;
      Label unique = null;
      for(Label lbl:ptaClassifier.graph.getCache().getAlphabet())
      {
        if (ptaClassifier.model.predictionsMatrix.containsKey(new Trace(Arrays.asList(new Label[]{l1,lbl}),true)))
        {
          if (unique == null)
View Full Code Here

    if (startPos >= path.size())
      return startState.isAccept();
    if (!startState.isAccept())
      return false;// we are only considering prefix-closed paths here, hence if we hit a reject state on the way, reject a path.
   
    Label label=path.get(startPos);
    Map<Label, TARGET_TYPE> existingTrans = graph.transitionMatrix.get(current);
    TARGET_TYPE collectionOfTargets = existingTrans != null?existingTrans.get(label):null;
    if (collectionOfTargets == null)
      // cannot make a move
      return false;
View Full Code Here

   */
  public LearnerGraph augmentPTA(List<Label> sequence, boolean accepted, boolean maximalAutomaton, JUConstants newColour)
  {
    CmpVertex currentState = coregraph.getInit(), prevState = null;
    Iterator<Label> inputIt = sequence.iterator();
    Label lastInput = null;
    int position = 0;
    while(inputIt.hasNext() && currentState != null)
    {
      if (!currentState.isAccept())
      {// not the last state and the already-reached state is not accept, while all prefixes of reject sequences should be accept ones.
View Full Code Here

        // which is used by the merging algorithm and dumping the results.
        CmpVertex v = pair.getR();
        Iterator<Label> seqIt = seq.iterator();
        while(seqIt.hasNext() && v != null)
        {
          Label input = seqIt.next();
          System.out.print(v.toString()+" "+original.transitionMatrix.get(v).keySet()+" input "+input+" ");
          List<CmpVertex> extra = mergedVertices.get(v);
          if (extra != null)
            for(CmpVertex ev:extra)
              System.out.print(" "+ev.toString()+" : "+original.transitionMatrix.get(ev).keySet());
          System.out.println();
          CmpVertex newV = original.transitionMatrix.get(v).get(input);
          if (newV != null) v=newV;
          else v=original.pairscores.findNextRed(mergedVertices,v,input);
        }
        System.out.println("final state is "+v);

        v=pair.getR();
        seqIt = seq.iterator();
        while(seqIt.hasNext() && v != null)
        {
          Label input = seqIt.next();
          System.out.println(v.toString()+" "+mergeResult.transitionMatrix.get(v).keySet()+" input "+input+" ");
          v = mergeResult.transitionMatrix.get(v).get(input);
        }
        System.out.println("final state is "+v);
       
View Full Code Here

    {
      final int alphabet = states;
      LearnerGraph referenceGraph = null;
      ThreadResult outcome = new ThreadResult();
      WekaDataCollector dataCollector = createDataCollector(ifDepth);
      Label uniqueFromInitial = null;
      Timer timerToDetectLongRunningAutomata = new Timer("timer_to_detect_lengthy_tasks");
      MachineGenerator mg = new MachineGenerator(states, 400 , (int)Math.round((double)states/5));mg.setGenerateConnected(true);
      do
      {
        referenceGraph = mg.nextMachine(alphabet,seed, config, converter).pathroutines.buildDeterministicGraph();// reference graph has no reject-states, because we assume that undefined transitions lead to reject states.
View Full Code Here

    {
      rowsProcessed.add(entry.getKey());
      for(Entry<CmpVertex,PAIRCOMPATIBILITY> associations:entry.getValue().entrySet())
        if (!rowsProcessed.contains(associations.getKey()))
        {
          Label label = AbstractLearnerGraph.generateNewLabel(associationPrefix+associations.getValue().name(),config,converter);
          if (alphabet.contains(label))
            throw new IllegalArgumentException("cannot use label "+label);

          result.addTransition(result.transitionMatrix.get(entry.getKey()), label, associations.getKey());
          result.addTransition(result.transitionMatrix.get(associations.getKey()), label, entry.getKey());
View Full Code Here

TOP

Related Classes of statechum.Label

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.