Package statechum.DeterministicDirectedSparseGraph

Examples of statechum.DeterministicDirectedSparseGraph.DeterministicVertex


    }
    long lastScore = -1;
    for(StatePair elem:pairs)
    {
      doneEdges = new HashSet<DirectedSparseEdge>();
      DeterministicVertex origBlue = DeterministicDirectedSparseGraph.findVertexNamed(elem.getQ(), g);
      DeterministicVertex origRed = DeterministicDirectedSparseGraph.findVertexNamed(elem.getR(), g);
      long currentScore = computeScore(g, new OrigStatePair(origBlue,origRed));// This one returns vertices from g, but elem may easily contain StringVertices and such, hence convert elem to Vertex-pair.
      PairScore elA = constructPairScore(elem.getQ().getStringId(),elem.getR().getStringId(),currentScore, testConfig);
      PairScore elB = constructPairScore(elem.getR().getStringId(),elem.getQ().getStringId(),currentScore, testConfig);
      Assert.assertTrue(elem.getR().getColour() == JUConstants.RED);
      Assert.assertTrue(elem.getQ().getColour() == JUConstants.BLUE);
View Full Code Here


  public static final String PTA1 = "\nA-p->I-q->B"+"\nB-a->B1-a-#B2\nB1-b->B3-b->B4\n";
 
  @Test(expected = IllegalArgumentException.class)
  public final void testLearnerFailsWhenRedNotFound()
  {
    ComputeQuestions.computeQS_orig(new StatePair(null,new DeterministicVertex("non-existing")), new LearnerGraph(testConfig), new LearnerGraph(testConfig));
  }
View Full Code Here

    }
    int lastScore = -1;
    for(StatePair elem:pairs)
    {
      doneEdges = new HashSet<DirectedSparseEdge>();
      DeterministicVertex origBlue = DeterministicDirectedSparseGraph.findVertexNamed(elem.getQ().getID(), g);
      DeterministicVertex origRed = DeterministicDirectedSparseGraph.findVertexNamed(elem.getR().getID(), g);
      int currentScore = computeScore(g, new OrigStatePair(origBlue,origRed));// This one returns vertices from g, but elem may easily contain StringVertices and such, hence convert elem to Vertex-pair.
      PairScore elA = constructPairScore(elem.getQ().getID().toString(),elem.getR().getID().toString(),currentScore, testConfig);
      PairScore elB = constructPairScore(elem.getR().getID().toString(),elem.getQ().getID().toString(),currentScore, testConfig);
      Assert.assertTrue(elem.getR().getColour() == JUConstants.RED);
      Assert.assertTrue(elem.getQ().getColour() == JUConstants.BLUE);
View Full Code Here

  public static final String PTA1 = "\nA-p->I-q->B"+"\nB-a->B1-a-#B2\nB1-b->B3-b->B4\n";
 
  @Test(expected = IllegalArgumentException.class)
  public final void testLearnerFailsWhenRedNotFound()
  {
    ComputeQuestions.computeQS_orig(new StatePair(null,new DeterministicVertex("non-existing")), new LearnerGraph(testConfig), new LearnerGraph(testConfig));
  }
View Full Code Here

    }
    int lastScore = -1;
    for(StatePair elem:pairs)
    {
      doneEdges = new HashSet<DirectedSparseEdge>();
      DeterministicVertex origBlue = DeterministicDirectedSparseGraph.findVertexNamed(elem.getQ().getID(), g);
      DeterministicVertex origRed = DeterministicDirectedSparseGraph.findVertexNamed(elem.getR().getID(), g);
      int currentScore = computeScore(g, new OrigStatePair(origBlue,origRed));// This one returns vertices from g, but elem may easily contain StringVertices and such, hence convert elem to Vertex-pair.
      PairScore elA = constructPairScore(elem.getQ().getID().toString(),elem.getR().getID().toString(),currentScore, testConfig);
      PairScore elB = constructPairScore(elem.getR().getID().toString(),elem.getQ().getID().toString(),currentScore, testConfig);
      Assert.assertTrue(elem.getR().getColour() == JUConstants.RED);
      Assert.assertTrue(elem.getQ().getColour() == JUConstants.BLUE);
View Full Code Here

      Map<CmpVertex,DeterministicVertex> oldToNew = new HashMapWithSearch<CmpVertex,DeterministicVertex>(coregraph.getStateNumber());
      // add states
      for(Entry<CmpVertex,Map<CmpVertex,Set<Label>>> entry:flowgraph.entrySet())
      {
        CmpVertex source = entry.getKey();
        DeterministicVertex vert = new DeterministicVertex(source);
        if (coregraph.getInit() == source)
          vert.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
        vert.setAccept(source.isAccept());
        vert.setColour(source.getColour());
        vert.setHighlight(source.isHighlight());
        result.addVertex(vert);
        oldToNew.put(source,vert);
      }
     
      // now add transitions
      for(Entry<CmpVertex,Map<CmpVertex,Set<Label>>> entry:flowgraph.entrySet())
      {
        DeterministicVertex source = oldToNew.get(entry.getKey());
        for(Entry<CmpVertex,Set<Label>> tgtEntry:entry.getValue().entrySet())
        {
          DeterministicVertex target = oldToNew.get(tgtEntry.getKey());
          DeterministicEdge e = new DeterministicEdge(source,target);
          e.addUserDatum(JUConstants.LABEL, tgtEntry.getValue(), UserData.CLONE);
          result.addEdge(e);
        }
      }
View Full Code Here

      Map<CmpVertex,DeterministicVertex> oldToNew = new HashMap<CmpVertex,DeterministicVertex>();
      // add states
      for(Entry<CmpVertex,Map<CmpVertex,Set<String>>> entry:coregraph.learnerCache.getFlowgraph().entrySet())
      {
        CmpVertex source = entry.getKey();
        DeterministicVertex vert = (DeterministicVertex)LearnerGraph.cloneCmpVertex(source,cloneConfig);
        if (coregraph.init == source)
          vert.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
        result.addVertex(vert);
        oldToNew.put(source,vert);
      }
     
      // now add transitions
      for(Entry<CmpVertex,Map<CmpVertex,Set<String>>> entry:coregraph.learnerCache.getFlowgraph().entrySet())
      {
        DeterministicVertex source = oldToNew.get(entry.getKey());
        for(Entry<CmpVertex,Set<String>> tgtEntry:entry.getValue().entrySet())
        {
          CmpVertex targetOld = tgtEntry.getKey();
          assert coregraph.findVertex(targetOld.getID()) == targetOld : "was looking for vertex with name "+targetOld.getID()+", got "+coregraph.findVertex(targetOld.getID());
          DeterministicVertex target = oldToNew.get(targetOld);
          DeterministicEdge e = new DeterministicEdge(source,target);
          e.addUserDatum(JUConstants.LABEL, tgtEntry.getValue(), UserData.CLONE);
          result.addEdge(e);
        }
      }
View Full Code Here

      Map<CmpVertex,DeterministicVertex> oldToNew = new HashMap<CmpVertex,DeterministicVertex>();
      // add states
      for(Entry<CmpVertex,Map<CmpVertex,Set<String>>> entry:flowgraph.entrySet())
      {
        CmpVertex source = entry.getKey();
        DeterministicVertex vert = new DeterministicVertex(source.getID());
        if (coregraph.init == source)
          vert.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
        vert.setAccept(source.isAccept());
        vert.setColour(source.getColour());
        vert.setHighlight(source.isHighlight());
        result.addVertex(vert);
        oldToNew.put(source,vert);
      }
     
      // now add transitions
      for(Entry<CmpVertex,Map<CmpVertex,Set<String>>> entry:flowgraph.entrySet())
      {
        DeterministicVertex source = oldToNew.get(entry.getKey());
        for(Entry<CmpVertex,Set<String>> tgtEntry:entry.getValue().entrySet())
        {
          DeterministicVertex target = oldToNew.get(tgtEntry.getKey());
          DeterministicEdge e = new DeterministicEdge(source,target);
          e.addUserDatum(JUConstants.LABEL, tgtEntry.getValue(), UserData.CLONE);
          result.addEdge(e);
        }
      }
View Full Code Here

  {
    synchronized(syncObj)
    {
      return conf.isLearnerUseStrings()?
          new StringVertex(name):
          new DeterministicVertex(name);     
    }   
  }
View Full Code Here

  public static final String PTA1 = "\nA-p->I-q->B"+"\nB-a->B1-a-#B2\nB1-b->B3-b->B4\n";
 
  @Test(expected = IllegalArgumentException.class)
  public final void testLearnerFailsWhenRedNotFound()
  {
    ComputeQuestions.computeQS_orig(new StatePair(null,new DeterministicVertex("non-existing")), new LearnerGraph(testConfig), new LearnerGraph(testConfig));
  }
View Full Code Here

TOP

Related Classes of statechum.DeterministicDirectedSparseGraph.DeterministicVertex

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.