Package statechum.analysis.learning.rpnicore.Linear

Examples of statechum.analysis.learning.rpnicore.Linear.DetermineDiagonalAndRightHandSide


 
  protected DoubleMatrix1D getExpectedMatrix1DSlowly(LearnerGraph gr)
  {
    int size=gr.getStateNumber()*(gr.getStateNumber()+1)/2;
    DoubleMatrix1D result = DoubleFactory1D.dense.make(size);
    DetermineDiagonalAndRightHandSide ddrhInstance = new Linear.DDRH_default();
    for(Entry<CmpVertex,Map<String,CmpVertex>> entryA:gr.transitionMatrix.entrySet())
    {
      // Now iterate through states
      Iterator<Entry<CmpVertex,Map<String,CmpVertex>>> stateB_It = gr.transitionMatrix.entrySet().iterator();
      while(stateB_It.hasNext())
      {
        Entry<CmpVertex,Map<String,CmpVertex>> stateB = stateB_It.next();

        int currentStatePair = gr.wmethod.vertexToIntNR(stateB.getKey(),entryA.getKey());
        ddrhInstance.compute(entryA.getValue(),stateB.getValue());
        result.setQuick(currentStatePair, ddrhInstance.getRightHandSide());
        if (stateB.getKey().equals(entryA.getKey())) break; // we only process a triangular subset.
      }
    }
   
    return result;
View Full Code Here


 
  @Test
  public final void testCountMatchingOutgoing1()
  {
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a->B\nA-b->B\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), Configuration.getDefaultConfiguration());
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_default();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("Q")));
    Assert.assertEquals(2,matcher.getRightHandSide());
  }
View Full Code Here

  @Test
  public final void testCountMatchingOutgoing2()
  {
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a->B\nA-b->B\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), Configuration.getDefaultConfiguration());
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_default();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("A")));
    Assert.assertEquals(3,matcher.getRightHandSide());
  }
View Full Code Here

  @Test
  public final void testCountMatchingOutgoing3a()
  {
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b->B1\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), Configuration.getDefaultConfiguration());
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_default();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("Q")));
    Assert.assertEquals(1,matcher.getRightHandSide());
  }
View Full Code Here

  public final void testCountMatchingOutgoing3b()
  {
    Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b->B1\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), config);
    gr.linear.moveRejectToHightlight();
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_highlight();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("Q")));
    Assert.assertEquals(1,matcher.getRightHandSide());
  }
View Full Code Here

  @Test
  public final void testCountMatchingOutgoing4a()
  {
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b-#B1\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), Configuration.getDefaultConfiguration());
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_default();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("Q")));
    Assert.assertEquals(0,matcher.getRightHandSide());
  }
View Full Code Here

  public final void testCountMatchingOutgoing4b()
  {
    Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b-#B1\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), config);
    gr.linear.moveRejectToHightlight();
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_highlight();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("Q")));
    Assert.assertEquals(0,matcher.getRightHandSide());
  }
View Full Code Here

  @Test
  public final void testCountMatchingOutgoing5a()
  {
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b-#B1\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), Configuration.getDefaultConfiguration());
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_default();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("C")));
    Assert.assertEquals(0,matcher.getRightHandSide());
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("S")),gr.transitionMatrix.get(gr.findVertex("C")));
    Assert.assertEquals(0,matcher.getRightHandSide());
  }
View Full Code Here

  public final void testCountMatchingOutgoing5b()
  {
    Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b-#B1\nA-c->C\nQ-a->R\nQ-b->S", "testCountMatchingOutgoing1"), config);
    gr.linear.moveRejectToHightlight();
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_highlight();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("C")));
    Assert.assertEquals(0,matcher.getRightHandSide());
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("S")),gr.transitionMatrix.get(gr.findVertex("C")));
    Assert.assertEquals(0,matcher.getRightHandSide());
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("C")),gr.transitionMatrix.get(gr.findVertex("A")));
    Assert.assertEquals(0,matcher.getRightHandSide());
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("C")),gr.transitionMatrix.get(gr.findVertex("S")));
    Assert.assertEquals(0,matcher.getRightHandSide());
  }
View Full Code Here

  @Test
  public final void testCountMatchingOutgoing6a()
  {
    LearnerGraph gr=new LearnerGraph(TestFSMAlgo.buildGraph("A-a-#B\nA-b-#B1\nQ-a->R", "testCountMatchingOutgoing1"), Configuration.getDefaultConfiguration());
    DetermineDiagonalAndRightHandSide matcher = new Linear.DDRH_default();
    matcher.compute(gr.transitionMatrix.get(gr.findVertex("A")),gr.transitionMatrix.get(gr.findVertex("R")));
    Assert.assertEquals(0,matcher.getRightHandSide());
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.rpnicore.Linear.DetermineDiagonalAndRightHandSide

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.