Package statechum.analysis.learning

Examples of statechum.analysis.learning.computeStateScores$NonExistingPaths


    writeElement(writeLearnerEvaluationConfiguration(cnf));   
  }
 
  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


   * @param pair the pair to be merged. Loaded from XML file (without scores).
   * @return graph loaded from XML file.
   */
  public synchronized computeStateScores MergeAndDeterminize(computeStateScores original, StatePair pair)
  {
    computeStateScores result = null;
    FSMStructure copyOfResult = null;
    // First, we call the expected method
    if (Thread.currentThread() == secondThread)
    {
      result = whatToCompareWith.MergeAndDeterminize(original, pair);
      copyOfResult = new FSMStructure(result.getGraph(),null);// since a tread which produced result may exit and modify the graph, we have to take a copy of it.
      mPair = pair;mGraph = copyOfResult;
    }
    else
    {
      result = decoratedLearner.MergeAndDeterminize(original, pair);
      copyOfResult = new FSMStructure(result.getGraph(),null);
    }
    checkCall(KIND_OF_METHOD.M_MERGEANDDETERMINIZE);

    if (Thread.currentThread() != secondThread)
    {// checking, considering that acceptance conditions are not stored in XML.
View Full Code Here

 
  @Override
  public DirectedSparseGraph learnMachine()
  {
    currentElement = expectNextElement(ELEM_KINDS.ELEM_INIT.name());
    computeStateScores graph = null, temp = null;
    DirectedSparseGraph result = null;
   
    while(currentElement != null)
    {
      final String elemName = currentElement.getNodeName();
      if (result != null) // we already know the final graph but there are more elements to come
        throw new IllegalArgumentException("unexpected element "+elemName+" after the learner result is known");
      ELEM_KINDS kind = stringToEnumMap.get(elemName);
     
       if (elemName.equals(Transform322.graphmlNodeName))
      {
        String graphKind = currentElement.getAttribute(ELEM_KINDS.ATTR_GRAPHKIND.name());
        if (graphKind.equals(ELEM_KINDS.ATTR_LEARNINGOUTCOME.name()))
            result = Transform322.loadGraph(currentElement);
        else
          throw new IllegalArgumentException("unexpected kind of graph: "+graphKind);

        kind = ELEM_KINDS.ATTR_GRAPHKIND;// means that this case was handled successfully.
      }
       else
      if (kind != null)
        switch(kind)
        {
        case ELEM_ANSWER:
          List<String> question = readInputSequence(new java.io.StringReader(currentElement.getAttribute(ELEM_KINDS.ATTR_QUESTION.name())),-1);
          topLevelListener.CheckWithEndUser(graph, question, null);
          break;
        case ELEM_PAIRS:
          topLevelListener.ChooseStatePairs(graph);
          break;
        case ELEM_QUESTIONS:
          checkSingles(currentElement, childrenQuestions);
          topLevelListener.ComputeQuestions(readPair(graph.getGraph(), getElement(ELEM_KINDS.ELEM_PAIR.name())),graph,temp);
          break;
        case ELEM_MERGEANDDETERMINIZE:
          if (currentElement.getElementsByTagName(ELEM_KINDS.ELEM_PAIR.name()).getLength() != 1)
            throw new IllegalArgumentException("missing or duplicate pair");
         
          temp = topLevelListener.MergeAndDeterminize(graph, readPair(graph.getGraph(), getElement(ELEM_KINDS.ELEM_PAIR.name())));
          break;
        case ELEM_RESTART:
          if (!currentElement.hasAttribute(ELEM_KINDS.ATTR_KIND.name())) throw new IllegalArgumentException("absent KIND attribute on RESTART");
          String restartKind = currentElement.getAttribute(ELEM_KINDS.ATTR_KIND.name());
          RestartLearningEnum mode = Enum.valueOf(RestartLearningEnum.class, restartKind);
          topLevelListener.Restart(mode);
          if (mode == RestartLearningEnum.restartNONE)
            graph = temp;
          // if we are restarting, graph is unchanged.
          break;
        case ELEM_INIT:
          InitialData initial = readInitialData(currentElement);
          graph = new computeStateScores(topLevelListener.init(initial.plus,initial.minus),"JUNK");
          break;
        case ELEM_AUGMENTPTA:
          AugmentPTAData augmentData = readAugmentPTA(currentElement);
          topLevelListener.AugmentPTA(null, augmentData.kind, augmentData.sequence, augmentData.accept, augmentData.colour);
          break;
View Full Code Here

   */
  public computeStateScores MergeAndDeterminize(computeStateScores original, @SuppressWarnings("unused") StatePair pair)
  {
    Element graphNode = getElement(Transform322.graphmlNodeName);
    if (graphNode == null) throw new IllegalArgumentException("failed to find a node with a graph");
    return new computeStateScores(Transform322.loadGraph(graphNode),"JUNK");
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.computeStateScores$NonExistingPaths

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.