Examples of StatePair


Examples of statechum.analysis.learning.StatePair

      Queue<StatePair> currentExplorationBoundary = new LinkedList<StatePair>();// FIFO queue
      currentExplorationBoundary.add(pair);currentExplorationBoundary.offer(null);
     
      while(!foundKTail)
      {
        StatePair currentPair = currentExplorationBoundary.remove();
        if (currentPair == null)
        {// we got to the end of a wave
          if (currentExplorationBoundary.isEmpty())
            break;// we are at the end of the last wave, stop looping.

          // mark the end of a wave.
          currentExplorationBoundary.offer(null);
        }
        else
        {
          Map<Label,CmpVertex> targetRed = coregraph.transitionMatrix.get(currentPair.getR()),
            targetBlue = coregraph.transitionMatrix.get(currentPair.getQ());
   
          for(Entry<Label,CmpVertex> redEntry:targetRed.entrySet())
          {
            CmpVertex nextBlueState = targetBlue.get(redEntry.getKey());
            if (nextBlueState != null)
            {// both states can make a transition
              if (!AbstractLearnerGraph.checkCompatible(redEntry.getValue(),nextBlueState,coregraph.pairCompatibility))
                return -1;// incompatible states
             
//              if(RPNIUniversalLearner.state_outgoing.get(currentPair.getQ())==null || RPNIUniversalLearner.state_outgoing.get(currentPair.getQ()).get(redEntry.getKey())==null)
                 matchscore++;
             
//              else if(RPNIUniversalLearner.state_outgoing.get(currentPair.getQ()).get(redEntry.getKey()) > 0.0)
//                           matchscore++;
             
             
              StatePair nextStatePair = new StatePair(nextBlueState,redEntry.getValue());
              currentExplorationBoundary.offer(nextStatePair);
              }               
            // if the red can make a move, but the blue one cannot, ignore this case.
          }
        }
View Full Code Here

Examples of statechum.analysis.learning.StatePair

    Queue<StatePair> currentExplorationBoundary = new LinkedList<StatePair>();// FIFO queue
    currentExplorationBoundary.add(pair);currentExplorationBoundary.offer(null);
     
    while(!currentExplorationBoundary.isEmpty())
    {
      StatePair currentPair = currentExplorationBoundary.remove();
      if (currentPair == null)
      {// we got to the end of a wave
        if (currentExplorationBoundary.isEmpty())
          break;// we are at the end of the last wave, stop looping.

        // mark the end of a wave.
        currentExplorationBoundary.offer(null);
      }
      else
      {
        Map<Label,CmpVertex> targetRed = graph.transitionMatrix.get(currentPair.getR()),
            targetBlue = graph.transitionMatrix.get(currentPair.getQ());
   
          for(Entry<Label,CmpVertex> redEntry:targetRed.entrySet())
          {
            CmpVertex nextBlueState = targetBlue.get(redEntry.getKey());
            if (nextBlueState != null)
            {// both states can make a transition
              if (!AbstractLearnerGraph.checkCompatible(redEntry.getValue(),nextBlueState,graph.pairCompatibility))
                return -1;// incompatible states
                                   
              List<Label> outgoing_form_blue_node = new ArrayList<Label>(graph.transitionMatrix.get(currentPair.getQ()).keySet());
              List<Label> outgoing_form_red_node = new ArrayList<Label>(graph.transitionMatrix.get(currentPair.getR()).keySet())
              List<Label> exoutgoing_form_blue_node = new ArrayList<Label>(extension_model.transitionMatrix.get(currentPair.getQ()).keySet());
              List<Label> exoutgoing_form_red_node = new ArrayList<Label>(extension_model.transitionMatrix.get(currentPair.getR()).keySet())
              Set<Label> all_outgoing = new HashSet<Label>() ;
              all_outgoing.addAll(exoutgoing_form_blue_node);
              all_outgoing.addAll(exoutgoing_form_red_node);

              for(Label out_red:outgoing_form_red_node)
              { 
                Boolean target_from_red_acceptance  = graph.getTransitionMatrix().get(currentPair.getR()).get(out_red).isAccept();   
                if(outgoing_form_blue_node.contains(out_red)) 
                {       
                    Boolean target_form_blue_acceptance = graph.getTransitionMatrix().get(currentPair.getQ()).get(out_red).isAccept()
                    assert target_from_red_acceptance!=null; assert target_form_blue_acceptance!=null;     

                    if(target_form_blue_acceptance ==  target_from_red_acceptance )   
                    matchscore++; 
                    else
                      return -1
                }
                else if(exoutgoing_form_blue_node.contains(out_red) && target_from_red_acceptance.booleanValue())
                {
                    Boolean extensiontarget_form_blue_acceptance = extension_model.getTransitionMatrix().get(currentPair.getQ()).get(out_red).isAccept()
                  if(extensiontarget_form_blue_acceptance == true && target_from_red_acceptance==true )   
                    matchscore++; 
                }
                else
                {
                  return -1;
                }
              }
             
              for(Label out_blue:outgoing_form_blue_node)
              {
                Boolean target_form_blue_acceptance = graph.getTransitionMatrix().get(currentPair.getQ()).get(out_blue).isAccept()

                if(exoutgoing_form_red_node.contains(out_blue) && target_form_blue_acceptance.booleanValue())
                {
                    Boolean extensiontarget_form_red_acceptance = extension_model.getTransitionMatrix().get(currentPair.getR()).get(out_blue).isAccept()
                  if(extensiontarget_form_red_acceptance == true && target_form_blue_acceptance ==true )   
                    matchscore++;
                }
                else
                {
                  return -1;
                }
               
              }
              StatePair nextStatePair = new StatePair(nextBlueState,redEntry.getValue());
              currentExplorationBoundary.offer(nextStatePair);
             
           
            // if the red can make a move, but the blue one cannot, ignore this case.
          }
View Full Code Here

Examples of statechum.analysis.learning.StatePair

  {
    List<StatePair> pairs = new LinkedList<StatePair>();
    LearnerGraph sourcePta = new LearnerGraph(pta,pta.config);
    List<CmpVertex> whatToMerge = constructPairsToMergeWithOutgoing(sourcePta,unique);
    for(CmpVertex vert:whatToMerge)
      pairs.add(new StatePair(sourcePta.getInit(),vert));
    List<AMEquivalenceClass<CmpVertex,LearnerGraphCachedData>> verticesToMerge = new ArrayList<AMEquivalenceClass<CmpVertex,LearnerGraphCachedData>>();
   
    if (sourcePta.pairscores.computePairCompatibilityScore_general(null, pairs, verticesToMerge) < 0)
      throw new IllegalArgumentException("failed to merge states corresponding to a unique outgoing transition "+unique);
    LearnerGraph outcome = MergeStates.mergeCollectionOfVertices(sourcePta, null, verticesToMerge);
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.