Package statechum.analysis.learning.computeStateScores

Examples of statechum.analysis.learning.computeStateScores.PairScore


  public computeStateScores MergeAndDeterminize(computeStateScores original, StatePair pair)
  {
    computeStateScores result = decoratedLearner.MergeAndDeterminize(original, pair);
    Element mergedGraph = new FSMStructure(result.getGraph(),null).transform322.createGraphMLNode(doc);
    Element mergeNode = doc.createElement(ELEM_KINDS.ELEM_MERGEANDDETERMINIZE.name());
    mergeNode.appendChild(mergedGraph);mergeNode.appendChild(writePair(new PairScore(pair.getQ(),pair.getR(),0,0)));
    writeElement(mergeNode);
    return result;
  }
View Full Code Here


    int lastScore = -1;
    for(StatePair elem:pairs)
    {
      doneEdges = new HashSet();
      int currentScore = computeScore(g, elem);
      PairScore elA = new PairScore(elem.getQ(),elem.getR(),currentScore, currentScore);
      PairScore elB = new PairScore(elem.getR(),elem.getQ(),currentScore, currentScore);
      Assert.assertTrue(elem.getR().getUserDatum("colour").equals("red"));
      Assert.assertTrue(elem.getQ().getUserDatum("colour").equals("blue"));
      Assert.assertTrue(currentScore >= 0);
      Assert.assertTrue("unexpected pair returned: "+elem+", score "+currentScore,distribution.containsKey(currentScore));
      Set<PairScore> ps = distribution.get(currentScore);
View Full Code Here

    String q = elem.getAttribute(ELEM_KINDS.ATTR_Q.name()), r = elem.getAttribute(ELEM_KINDS.ATTR_R.name()),
      score=elem.getAttribute(ELEM_KINDS.ATTR_SCORE.name()), otherscore = elem.getAttribute(ELEM_KINDS.ATTR_OTHERSCORE.name());
    int scoreInt = -1, otherScoreInt = -1;
    try { scoreInt = Integer.valueOf(score); } catch(NumberFormatException ex) { statechum.Helper.throwUnchecked("failed to read a score in a pair", ex); }
    try { otherScoreInt = Integer.valueOf(otherscore); } catch(NumberFormatException ex) { statechum.Helper.throwUnchecked("failed to read a anotherscore in a pair", ex); }
    PairScore result = null;
    synchronized(computeStateScores.syncObj)
    {
      result = new PairScore(
        new DeterministicDirectedSparseGraph.DeterministicVertex(q),
        new DeterministicDirectedSparseGraph.DeterministicVertex(r),
        //RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,q,graph),
        //RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,r,graph),
        scoreInt,otherScoreInt);
View Full Code Here

      if (pairs.size() != pairsAndScores.size())
        new IllegalArgumentException("different sizes of ChooseStatePairs collections of pairs, \n"+pairs+" v.s. \n"+pairsAndScores);
      Iterator<PairScore> ps1 = pairs.iterator(), ps2=pairsAndScores.iterator();
      while(ps1.hasNext())
      {
        PairScore p1 = ps1.next(),p2=ps2.next();
        if (!p1.getQ().getUserDatum(JUConstants.LABEL).equals(p2.getQ().getUserDatum(JUConstants.LABEL)) ||
            !p1.getR().getUserDatum(JUConstants.LABEL).equals(p2.getR().getUserDatum(JUConstants.LABEL)) ||
            p1.getScore() != p2.getScore() || p1.getAnotherScore() != p2.getAnotherScore())
          new IllegalArgumentException("different ChooseStatePairs pairs, "+p1+" v.s. "+p2);
      }
     
      pairs =null;// reset stored data
    }
View Full Code Here

 
  @Before
  public final void beforeTest()
  {
    graph = TestFSMAlgo.buildGraph("A-a->B-a->C", "testWritePairs1");
    PairScore pair = new PairScore(RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,"A",graph),
        RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,"B",graph),6,7);
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    RecordProgressDecorator dumper = new RecordProgressDecorator(null,output,1,Configuration.getDefaultConfiguration(),false);
    dumper.topElement.appendChild(dumper.writePair(pair));dumper.close();
   
View Full Code Here

  /** Tests writing a pair. */
  @Test
  public final void testWritePair1()
  {
    LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(xmlData.getBytes()),false);
    Assert.assertEquals(new PairScore(RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,"A",graph),
        RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,"B",graph),6,7),
        loader.readPair(graph, loader.expectNextElement(ELEM_KINDS.ELEM_PAIR.name())));
  }
View Full Code Here

  /** Tests writing a pair: extra attribute ignored. */
  @Test
  public final void testWritePair2()
  {
    LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(addExtraAttribute(xmlData,ELEM_KINDS.ELEM_PAIR).getBytes()),false);
    Assert.assertEquals(new PairScore(RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,"A",graph),
        RPNIBlueFringeLearner.findVertex(JUConstants.LABEL,"B",graph),6,7),
        loader.readPair(graph, loader.expectNextElement(ELEM_KINDS.ELEM_PAIR.name())));
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.computeStateScores.PairScore

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.