Package statechum

Examples of statechum.Label


          {
            Set<Label> labels = (Set<Label>) e.getUserDatum(JUConstants.LABEL);
              Iterator<Label> labelIt = labels.iterator();
              while (labelIt.hasNext())
              {
                Label currentLabel = labelIt.next();
                  Color newCol = getEdgeColour(e, currentLabel);
                  if (col == null) {
                      col = newCol;
                  } else if (!col.equals(newCol)) {
                      col = inconsistent;
View Full Code Here


                chosenState = possibleStates[0];
              else
                chosenState = possibleStates[connectTransitions.nextInt(possibleStates.length)];
             
              Set<Label> inputsPossible = new TreeSet<Label>();inputsPossible.addAll(alphabetObtained);inputsPossible.removeAll(machine.transitionMatrix.get(v).keySet());
              Label possibleElementsOfAlphabet[] = inputsPossible.toArray(new Label[]{});
              Label possibleLabel = null;
              if (possibleElementsOfAlphabet.length == 1)
                possibleLabel = possibleElementsOfAlphabet[0];
              else
                if (possibleElementsOfAlphabet.length > 1)
                  possibleLabel = possibleElementsOfAlphabet[connectTransitions.nextInt(possibleElementsOfAlphabet.length)];
View Full Code Here

          {
            Set<Label> labels = (Set<Label>) e.getUserDatum(JUConstants.LABEL);
              Iterator<Label> labelIt = labels.iterator();
              while (labelIt.hasNext())
              {
                Label currentLabel = labelIt.next();
                  Color newCol = getEdgeColour(e, currentLabel);
                  if (col == null) {
                      col = newCol;
                  } else if (!col.equals(newCol)) {
                      col = inconsistent;
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

   */
  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

    {
      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

    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

              if (positive)
              {// The last element should be the same as the starting element in the positive trace, if there is one.
                int traceLen = trace.size();
                if (traceLen < 2)
                  throw new IllegalArgumentException("traces are expected to loop in the initial state, hence they should contain at least two elements");
                Label lastElement = trace.get(traceLen-1);
                if (!lastElement.equals(trace.get(0)))
                  throw new IllegalArgumentException("the last element of each positive trace is not the same as the starting element of a the same trace for trace "+trace);
                if (!lastPositiveTrace.isEmpty() && !lastPositiveTrace.get(0).equals(lastElement))
                  throw new IllegalArgumentException("the first element of the last positive trace ("+lastPositiveTrace.get(0)+") is not the same as the starting element of the current trace "+trace);
               
                if (lastPositiveTrace.isEmpty())
View Full Code Here

     }
    
     for(Entry<CmpVertex,Map<Label,CmpVertex>> state:pta.transitionMatrix.entrySet())
       for(Entry<Label,CmpVertex> next:state.getValue().entrySet())
       {
         Label lbl = next.getKey();
         supportForEvent.get(lbl).incrementAndGet();++total;
        
         if (next.getValue().isAccept())
         {
           Map<Label,AtomicInteger> supportStartingFromlbl = supportForPair.get(lbl);
           for(Entry<Label,CmpVertex> subsequent:pta.transitionMatrix.get(next.getValue()).entrySet())
           {
             Label nextLbl = subsequent.getKey();boolean nextAccept = subsequent.getValue().isAccept();
             AtomicInteger counter = supportStartingFromlbl.get(nextLbl);
             if (counter == null)
               supportStartingFromlbl.put(nextLbl, new AtomicInteger(nextAccept?1:-1));
             else
               if (counter.get() > 0)
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.