Examples of RedNodeSelectionProcedure


Examples of statechum.analysis.learning.rpnicore.PairScoreComputation.RedNodeSelectionProcedure

    {
      graph.clearColours();
      for(CmpVertex vertRed:redsAlways) vertRed.setColour(JUConstants.RED);
      for(CmpVertex vertToColourBlue:redToBeExpectedvertToColourBlue.setColour(JUConstants.BLUE);for(CmpVertex vertToColourBlue:blueStatesvertToColourBlue.setColour(JUConstants.BLUE);
     
      Collection<PairScore> pairsReturned = graph.pairscores.chooseStatePairs(new RedNodeSelectionProcedure() {
       
        CmpVertex redChosen = null;
       
        @Override
        public CmpVertex selectRedNode(LearnerGraph coregraph, Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
        {
          Assert.assertNull(redChosen);// we choose graphs in such a way that red states chosen subsequently are decided without calls to selectRedNode before chooseStatePairs returns.
          Assert.assertSame(graph,coregraph);
          Assert.assertTrue(reds.contains(graph.findVertex("A")));Assert.assertTrue(reds.contains(graph.findVertex("B")));
          Assert.assertTrue(redToBeExpected.equals(tentativeRedNodes));
         
          Set<CmpVertex> available = new TreeSet<CmpVertex>();available.addAll(tentativeRedNodes);available.removeAll(tentativeRedsChosen);
          redChosen = bestVertex;
          return redChosen;
        }
       
        @SuppressWarnings("unused")
        @Override
        public CmpVertex resolvePotentialDeadEnd(LearnerGraph coregraph, Collection<CmpVertex> reds, List<PairScore> pairs)
        {
          Assert.assertNotNull(redChosen);// ensure that selectRedNode was called.
          Set<PairScore> copyOfPairs = new TreeSet<PairScore>(pairs);
          redToPairsObtained.put(redChosen,copyOfPairs);// record the pairs we got, these should be the same pairs as those to be returned from chooseStatePairs so long as resolvePotentialDeadEnd returns null.
          return null;// no resolution
        }
       
        @Override
        public void initComputation(@SuppressWarnings("unused") LearnerGraph gr) {
          // dummy
        }

        @Override
        public long overrideScoreComputation(PairScore p) {
          return p.getScore();// dummy
        }
      });
     
      Set<PairScore> pairsReturnedAsSet = new TreeSet<PairScore>(pairsReturned);
      Assert.assertEquals(redToPairsObtained.get(bestVertex),pairsReturnedAsSet);
    }
   
   
    // Now I verify that if my quality selection routine returns the expected value for a collection of pairs corre
    for(CmpVertex bestVertex:redToBeExpected)
    {
      graph.clearColours();
      for(CmpVertex vertRed:redsAlways) vertRed.setColour(JUConstants.RED);
      for(CmpVertex vertToColourBlue:redToBeExpectedvertToColourBlue.setColour(JUConstants.BLUE);for(CmpVertex vertToColourBlue:blueStatesvertToColourBlue.setColour(JUConstants.BLUE);

      final CmpVertex bestVertexFinal = bestVertex;
      Collection<PairScore> pairsReturned = graph.pairscores.chooseStatePairs(new RedNodeSelectionProcedure() {
       
        @Override
        public CmpVertex selectRedNode(LearnerGraph coregraph, final Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
        {
          final Set<Collection<PairScore>> collectionOfPairsSeen = new HashSet<Collection<PairScore>>();
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.PairScoreComputation.RedNodeSelectionProcedure

    {
      graph.clearColours();
      for(CmpVertex vertRed:redsAlways) vertRed.setColour(JUConstants.RED);
      for(CmpVertex vertToColourBlue:redToBeExpectedvertToColourBlue.setColour(JUConstants.BLUE);for(CmpVertex vertToColourBlue:blueStatesvertToColourBlue.setColour(JUConstants.BLUE);
     
      Collection<PairScore> pairsReturned = graph.pairscores.chooseStatePairs(new RedNodeSelectionProcedure() {
       
        CmpVertex redChosen = null;
       
        @Override
        public CmpVertex selectRedNode(LearnerGraph coregraph, Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
        {
          Assert.assertNull(redChosen);// we choose graphs in such a way that red states chosen subsequently are decided without calls to selectRedNode before chooseStatePairs returns.
          Assert.assertSame(graph,coregraph);
          Assert.assertTrue(reds.contains(graph.findVertex("A")));Assert.assertTrue(reds.contains(graph.findVertex("B")));
          Assert.assertTrue(redToBeExpected.equals(tentativeRedNodes));
         
          Set<CmpVertex> available = new TreeSet<CmpVertex>();available.addAll(tentativeRedNodes);available.removeAll(tentativeRedsChosen);
          redChosen = bestVertex;
          return redChosen;
        }
       
        @SuppressWarnings("unused")
        @Override
        public CmpVertex resolvePotentialDeadEnd(LearnerGraph coregraph, Collection<CmpVertex> reds, List<PairScore> pairs)
        {
          Assert.assertNotNull(redChosen);// ensure that selectRedNode was called.
          Set<PairScore> copyOfPairs = new TreeSet<PairScore>(pairs);
          redToPairsObtained.put(redChosen,copyOfPairs);// record the pairs we got, these should be the same pairs as those to be returned from chooseStatePairs so long as resolvePotentialDeadEnd returns null.
          return null;// no resolution
        }
      });
     
      Set<PairScore> pairsReturnedAsSet = new TreeSet<PairScore>(pairsReturned);
      Assert.assertEquals(redToPairsObtained.get(bestVertex),pairsReturnedAsSet);
    }
   
   
    // Now I verify that if my quality selection routine returns the expected value for a collection of pairs corre
    for(CmpVertex bestVertex:redToBeExpected)
    {
      graph.clearColours();
      for(CmpVertex vertRed:redsAlways) vertRed.setColour(JUConstants.RED);
      for(CmpVertex vertToColourBlue:redToBeExpectedvertToColourBlue.setColour(JUConstants.BLUE);for(CmpVertex vertToColourBlue:blueStatesvertToColourBlue.setColour(JUConstants.BLUE);

      final CmpVertex bestVertexFinal = bestVertex;
      Collection<PairScore> pairsReturned = graph.pairscores.chooseStatePairs(new RedNodeSelectionProcedure() {
       
        @Override
        public CmpVertex selectRedNode(LearnerGraph coregraph, final Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
        {
          final Set<Collection<PairScore>> collectionOfPairsSeen = new HashSet<Collection<PairScore>>();
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.PairScoreComputation.RedNodeSelectionProcedure

    {
      graph.clearColours();
      for(CmpVertex vertRed:redsAlways) vertRed.setColour(JUConstants.RED);
      for(CmpVertex vertToColourBlue:redToBeExpectedvertToColourBlue.setColour(JUConstants.BLUE);for(CmpVertex vertToColourBlue:blueStatesvertToColourBlue.setColour(JUConstants.BLUE);
     
      Collection<PairScore> pairsReturned = graph.pairscores.chooseStatePairs(new RedNodeSelectionProcedure() {
       
        CmpVertex redChosen = null;
       
        @Override
        public CmpVertex selectRedNode(LearnerGraph coregraph, Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
        {
          Assert.assertNull(redChosen);// we choose graphs in such a way that red states chosen subsequently are decided without calls to selectRedNode before chooseStatePairs returns.
          Assert.assertSame(graph,coregraph);
          Assert.assertTrue(reds.contains(graph.findVertex("A")));Assert.assertTrue(reds.contains(graph.findVertex("B")));
          Assert.assertTrue(redToBeExpected.equals(tentativeRedNodes));
         
          Set<CmpVertex> available = new TreeSet<CmpVertex>();available.addAll(tentativeRedNodes);available.removeAll(tentativeRedsChosen);
          redChosen = bestVertex;
          return redChosen;
        }
       
        @SuppressWarnings("unused")
        @Override
        public CmpVertex resolvePotentialDeadEnd(LearnerGraph coregraph, Collection<CmpVertex> reds, List<PairScore> pairs)
        {
          Assert.assertNotNull(redChosen);// ensure that selectRedNode was called.
          Set<PairScore> copyOfPairs = new TreeSet<PairScore>(pairs);
          redToPairsObtained.put(redChosen,copyOfPairs);// record the pairs we got, these should be the same pairs as those to be returned from chooseStatePairs so long as resolvePotentialDeadEnd returns null.
          return null;// no resolution
        }
       
        @Override
        public void initComputation(@SuppressWarnings("unused") LearnerGraph gr) {
          // dummy
        }

        @Override
        public long overrideScoreComputation(PairScore p) {
          return p.getScore();// dummy
        }

        @Override
        public Collection<Entry<Label, CmpVertex>> getSurroundingTransitions(@SuppressWarnings("unused") CmpVertex currentRed)
        {
          return null;// dummy, ignored if null.
        }
      });
     
      Set<PairScore> pairsReturnedAsSet = new TreeSet<PairScore>(pairsReturned);
      Assert.assertEquals(redToPairsObtained.get(bestVertex),pairsReturnedAsSet);
    }
   
   
    // Now I verify that if my quality selection routine returns the expected value for a collection of pairs corre
    for(CmpVertex bestVertex:redToBeExpected)
    {
      graph.clearColours();
      for(CmpVertex vertRed:redsAlways) vertRed.setColour(JUConstants.RED);
      for(CmpVertex vertToColourBlue:redToBeExpectedvertToColourBlue.setColour(JUConstants.BLUE);for(CmpVertex vertToColourBlue:blueStatesvertToColourBlue.setColour(JUConstants.BLUE);

      final CmpVertex bestVertexFinal = bestVertex;
      Collection<PairScore> pairsReturned = graph.pairscores.chooseStatePairs(new RedNodeSelectionProcedure() {
       
        @Override
        public CmpVertex selectRedNode(LearnerGraph coregraph, final Collection<CmpVertex> reds, Collection<CmpVertex> tentativeRedNodes)
        {
          final Set<Collection<PairScore>> collectionOfPairsSeen = new HashSet<Collection<PairScore>>();
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.