Examples of CmpVertex


Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

  }

  @Test
  public final void testAM_colour2e()
  {
    CmpVertex vertA = new StringVertex("A");vertA.setColour(JUConstants.AMBER);
    CmpVertex vertB = new StringVertex("B");
    CmpVertex vertC = new StringVertex("C");
    AMEquivalenceClass eq =new AMEquivalenceClass(Arrays.asList(new CmpVertex[]{
        vertA,vertB,vertC}));
    eq.computeMergedColour();
    Assert.assertNull(eq.getMergedVertex().getColour());
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

  }

  @Test
  public final void testAM_colour2f()
  {
    CmpVertex vertA = new StringVertex("A");vertA.setColour(JUConstants.AMBER);
    CmpVertex vertB = new StringVertex("B");
    CmpVertex vertC = new StringVertex("C");vertC.setColour(JUConstants.AMBER);
    AMEquivalenceClass eq =new AMEquivalenceClass(Arrays.asList(new CmpVertex[]{
        vertA,vertB,vertC}));
    eq.computeMergedColour();
    Assert.assertNull(eq.getMergedVertex().getColour());
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

  }

  @Test
  public final void testAM_colour2g()
  {
    CmpVertex vertA = new StringVertex("A");
    CmpVertex vertB = new StringVertex("B");vertB.setColour(JUConstants.AMBER);
    CmpVertex vertC = new StringVertex("C");vertC.setColour(JUConstants.AMBER);
    AMEquivalenceClass eq =new AMEquivalenceClass(Arrays.asList(new CmpVertex[]{
        vertA,vertB,vertC}));
    eq.computeMergedColour();
    Assert.assertNull(eq.getMergedVertex().getColour());
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

  }

  @Test
  public final void testAM_colour2h()
  {
    CmpVertex vertA = new StringVertex("A");vertA.setColour(JUConstants.AMBER);
    AMEquivalenceClass eq =new AMEquivalenceClass(Arrays.asList(new CmpVertex[]{
        vertA}));
    eq.computeMergedColour();
    Assert.assertTrue(eq.getMergedVertex().getColour() == JUConstants.AMBER);
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

  }

  @Test
  public final void testAM_colour3()
  {
    CmpVertex vertB = new StringVertex("B");vertB.setColour(JUConstants.RED);
    CmpVertex vertC = new StringVertex("C");vertC.setColour(JUConstants.BLUE);
    AMEquivalenceClass eq =new AMEquivalenceClass(Arrays.asList(new CmpVertex[]{
        new StringVertex("A"),vertB,vertC}));
    eq.computeMergedColour();
    Assert.assertTrue(eq.getMergedVertex().getColour() == JUConstants.RED);
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

   * @param conf configuration to use when cloning.
   * @return the result of cloning.
   */
  public static CmpVertex cloneCmpVertex(Object vertToClone,Configuration conf)
  {
    CmpVertex result = null;
    if (vertToClone instanceof CmpVertex)
    {// normal processing
      CmpVertex vert = (CmpVertex)vertToClone;
      if (!conf.isLearnerCloneGraph())
        result = vert;
      else
      {
        result = generateNewCmpVertex(vert,conf);
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

   * @return the new vertex.
   */
  public CmpVertex addVertex(CmpVertex prevState, boolean accepted, Label input)
  {
    assert Thread.holdsLock(syncObj);
    CmpVertex newVertex = generateNewCmpVertex(nextID(accepted),config);
    assert !transitionMatrix.containsKey(newVertex);
    newVertex.setAccept(accepted);
    transitionMatrix.put(newVertex, createNewRow());
    addTransition(transitionMatrix.get(prevState),input,newVertex);
    return newVertex;
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

   * @param what what to add to the current graph
   * @return the newly-added vertex.
   */
  public CmpVertex copyVertexUnderDifferentName(CmpVertex what)
  {
    CmpVertex newVert = AbstractLearnerGraph.generateNewCmpVertex(nextID(what.isAccept()), config);
    if (GlobalConfiguration.getConfiguration().isAssertEnabled() && findVertex(newVert) != null) throw new IllegalArgumentException("duplicate vertex with ID "+newVert.getStringId()+" in graph "+toString());
    DeterministicDirectedSparseGraph.copyVertexData(what, newVert);
    transitionMatrix.put(newVert,createNewRow());
    return newVert;
  }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

           // We are checking which of these two has happened in the code below.
           // The computation below is expensive on large graphs but only needs to be done once.
            LinkedHashSet<CmpVertex> removedStates = new LinkedHashSet<CmpVertex>();removedStates.addAll(original.transitionMatrix.keySet());
            removedStates.removeAll(outcome.transitionMatrix.keySet());removedStates.remove(pair.getQ());removedStates.remove(pair.getR());
            Assert.assertEquals(1,removedStates.size());// if it were a phantom vertex, there would only be one of them.
            CmpVertex tentativePhantom = removedStates.iterator().next();
            Set<Label> alphabetUsedOnPhantom = new TreeSet<Label>();alphabetUsedOnPhantom.addAll(original.pathroutines.computeAlphabet());
            for(Entry<Label,CmpVertex> transition:original.transitionMatrix.get(tentativePhantom).entrySet())
            {
              Assert.assertSame(tentativePhantom,transition.getValue());alphabetUsedOnPhantom.remove(transition.getKey());
            }
            Assert.assertEquals(0, alphabetUsedOnPhantom.size());
            extraPhantomVertices = 1;// now certain it was indeed a phantom vertex added when the PTA was initially built.
          }
         
          Assert.assertEquals(score+extraPhantomVertices,original.getStateNumber()-outcome.getStateNumber());
        }
        ScoreMode origScore = original.config.getLearnerScoreMode();original.config.setLearnerScoreMode(ScoreMode.COMPATIBILITY);
        long compatibilityScore = original.pairscores.computePairCompatibilityScore(pair);
        original.config.setLearnerScoreMode(origScore);
       
        Assert.assertEquals(compatibilityScore+1+extraPhantomVertices,original.getStateNumber()-outcome.getStateNumber());
        return outcome;
      }

      @Override
      public Stack<PairScore> ChooseStatePairs(LearnerGraph graph)
      {
        Stack<PairScore> outcome = graph.pairscores.chooseStatePairs(new PairScoreComputation.RedNodeSelectionProcedure(){

          @Override
          public CmpVertex selectRedNode(LearnerGraph coregraph,  @SuppressWarnings("unused") Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
          {
            CmpVertex redVertex = null;
            if (listOfPairsToWrite != null)
            {
              redVertex = tentativeRedNodes.iterator().next();
              listOfPairsToWrite.add(new PairOfPaths(coregraph, new PairScore(null, redVertex, 0, 0)));
            }
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

        if (target.getValue().isAccept())
        {
          if (visitedInTree.contains(target.getValue()))
            throw new IllegalArgumentException("PTA is not a tree");
          visitedInTree.add(target.getValue());
          CmpVertex nextGraphState = reference.transitionMatrix.get(reference_pta.firstElem).get(target.getKey());
          if (nextGraphState == null)
            throw new IllegalArgumentException("coverage has more transitions than the original graph");
          pairsToExplore.add(new StatePair(nextGraphState, target.getValue()));
        }
    }
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.