Examples of StatesToConsider


Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

   *
   * @return an instance of filter.
   */
  public static StatesToConsider createInstanceOfFilter(Class<? extends StatesToConsider> filterClass,LearnerGraph gr)
  {
    StatesToConsider filter = null;
    try {
      java.lang.reflect.Constructor<? extends StatesToConsider> constructor = filterClass.getConstructor(new Class []{});
      filter = constructor.newInstance(new Object[]{});
    } catch (Exception e) {
      // if we failed, filter stays at null, we'll try again.
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

   */
  private final void checkConsideringIgnoredStates(String graph, String graphName, Class<? extends StatesToConsider> filterClass, String [] expectedToRemain)
  {
    Configuration conf = Configuration.getDefaultConfiguration().copy();conf.setTransitionMatrixImplType(STATETREE.STATETREE_SLOWTREE);
    LearnerGraph gr=buildLearnerGraph(graph,graphName,conf,null);
    StatesToConsider filter = createInstanceOfFilter(filterClass, gr);
    for(boolean direction:new boolean[]{false,true})
    {
      GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, direction);
      Map<CmpVertex,Integer> state_to_int_map = new TreeMap<CmpVertex,Integer>();
      CmpVertex [] numberToStateNoReject = gr.buildStateToIntegerMap(filter,state_to_int_map);
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

  }
 
  public static void printTraceLeadingTo(LearnerGraph graph, String vert)
  {
    LearnerGraphND ptaInverse = new LearnerGraphND(graph.config);
    AbstractPathRoutines.buildInverse(graph, new StatesToConsider() {
      @Override public boolean stateToConsider(@SuppressWarnings("unused") CmpVertex v) { return true; }}
      , ptaInverse);
    CmpVertex v=ptaInverse.findVertex(vert);
    for(int i=0;i<10;++i)
    {
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

  /** Tests the workload distribution. */
  @Test
  public final void testPerformRowTasks_A_1()
  {
    LearnerGraph gr=new LearnerGraph(Configuration.getDefaultConfiguration());gr.getInit().setAccept(false);
    StatesToConsider filter = LearnerGraphND.ignoreRejectStates;
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, false);
    int ThreadNumber=4;
    Assert.assertArrayEquals(new int[]{0,0,0,0,0},GDLearnerGraph.partitionWorkLoadTriangular(ThreadNumber,ndGraph.getStateNumber()));
    Assert.assertArrayEquals(new int[]{0,0,0,0,0},GDLearnerGraph.partitionWorkLoadLinear(ThreadNumber,ndGraph.getStateNumber()));

View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

  /** Tests the workload distribution. */
  @Test
  public final void testPerformRowTasks_A_2()
  {
    LearnerGraph gr=new LearnerGraph(Configuration.getDefaultConfiguration());
    StatesToConsider filter = LearnerGraphND.ignoreRejectStates;
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, false);
    int ThreadNumber=4;
    Assert.assertArrayEquals(new int[]{0,0,0,0,1},GDLearnerGraph.partitionWorkLoadTriangular(ThreadNumber,ndGraph.getStateNumber()));

    final Map<Integer,Integer> threadToRowNumber = Collections.synchronizedMap(new TreeMap<Integer,Integer>());
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

  /** Tests the workload distribution. */
  @Test
  public final void testPerformRowTasks_A_3()
  {
    LearnerGraph gr=new LearnerGraph(buildGraph("A-a->B-a-#C\nA-b-#D\nA-c-#E\nB-b-#F\nB-c-#G","testPerformRowTasks_A_3"),Configuration.getDefaultConfiguration());
    StatesToConsider filter = LearnerGraphND.ignoreRejectStates;
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, false);
    int ThreadNumber=4;

    final Map<Integer,Integer> threadToRowNumber = Collections.synchronizedMap(new TreeMap<Integer,Integer>());
   
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

  /** Tests that conversion between numerical state pairs and back works. */
  @Test
  public final void testNumberToState_and_Back()
  {
    LearnerGraph gr=new LearnerGraph(buildGraph("A-a->Q\nA-b->C\nA-d->C\nD-a->C\nD-b->C\nD-d->C-a->C\nD-c->A-c-#R\nC-f-#T\nC-e->G-a-#K\nG-b->S-a-#U","TestFindIncompatibleStatesB"),Configuration.getDefaultConfiguration());
    StatesToConsider filter = LearnerGraphND.ignoreRejectStates;
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, false);
    for(CmpVertex A:gr.transitionMatrix.keySet())
      if (filter.stateToConsider(A))
        for(CmpVertex B:gr.transitionMatrix.keySet())
          if (filter.stateToConsider(B))
          {
            PairScore received1 = ndGraph.getPairScore(ndGraph.vertexToIntNR(A,B), 1, 2);
            Assert.assertTrue(
                received1.equals(new PairScore(A,B,1,2)) ||
                received1.equals(new PairScore(B,A,1,2))
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

           
            // Perhaps I should be numbering states directly here instead of using numberNonNegativeElements afterwards,
            // but this is not simple to do: I have to give numbers in the order in which triangular traversal visits states.
          }
        });
      GDLearnerGraph.performRowTasks(handlerList, ThreadNumber, grCombined.transitionMatrix,new StatesToConsider() {
        @Override public boolean stateToConsider(CmpVertex vert) {
          return statesOfA.contains(vert);
        }
      }, GDLearnerGraph.partitionWorkLoadLinear(ThreadNumber,statesOfA.size()));
      final int numberOfPairs = GDLearnerGraph.numberNonNegativeElements(pairScores);
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

            assert highState != null;
            wave.add(new PairScore(entryA.getKey(),highState,(int)(multiplier*scoreHigh),(int)(multiplier*scoreLow)));
          }
        });
      }
      GDLearnerGraph.performRowTasks(handlerList, ThreadNumber, grCombined.transitionMatrix,new StatesToConsider() {
        @Override public boolean stateToConsider(CmpVertex vert) {
          return statesOfA.contains(vert);
        }
      }, GDLearnerGraph.partitionWorkLoadLinear(ThreadNumber,statesOfA.size()));
     
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph.StatesToConsider

 
  protected DoubleMatrix1D getExpectedMatrix1DSlowly(LearnerGraph gr)
  {
    int size=gr.getStateNumber()*(gr.getStateNumber()+1)/2;
    DoubleMatrix1D result = DoubleFactory1D.dense.make(size);
    StatesToConsider filter = LearnerGraphND.ignoreRejectStates;
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, false);
    DetermineDiagonalAndRightHandSide ddrhInstance = ndGraph.new DDRH_default();
    for(Entry<CmpVertex,Map<String,List<CmpVertex>>> entryA:ndGraph.matrixForward.transitionMatrix.entrySet())
    {
      // Now iterate through states
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.