Package statechum

Examples of statechum.Label


    InitialConfigurationAndData initialConfigurationData = PairQualityLearner.loadInitialAndPopulateInitialConfiguration(PairQualityLearner.veryLargePTAFileName, configToLoadWith, labelConverter);
    LearnerGraph hugeGraph = new LearnerGraph(initialConfigurationData.initial.graph,mainConfiguration);LearnerGraph smallGraph = new LearnerGraph(initialConfigurationData.learnerInitConfiguration.graph,mainConfiguration);
   
    System.out.println("Huge: "+hugeGraph.getStateNumber()+" states, "+(hugeGraph.getStateNumber()-hugeGraph.getAcceptStateNumber())+" reject states");
    System.out.println("Small: "+smallGraph.getStateNumber()+" states, "+(smallGraph.getStateNumber()-smallGraph.getAcceptStateNumber())+" reject states");
    Label labelToMerge = AbstractLearnerGraph.generateNewLabel("Waypoint_Selected",mainConfiguration,converter);
    LearnerGraph mergedHuge = PairQualityLearner.mergeStatesForUnique(hugeGraph, labelToMerge);
    DifferentFSMException diffFSM = WMethod.checkM(smallGraph, mergedHuge);
    if (diffFSM != null)
      throw diffFSM;
View Full Code Here


 
  @Test
  public final void testCreateLabelIntern1()
  {
    final Configuration conf = config.copy();conf.setLabelKind(LABELKIND.LABEL_STRING);
    final Label lbl = AbstractLearnerGraph.generateNewLabel("A", conf);
    Helper.checkForCorrectException(new whatToRun() { public @Override void run() {
      lbl.toInt();
    }},UnsupportedOperationException.class,"string labels");
  }
View Full Code Here

  @Test
  public final void testCreateLabelIntern3()
  {
    final Configuration conf = config.copy();conf.setLabelKind(LABELKIND.LABEL_STRING);
    final statechum.analysis.learning.rpnicore.Transform.InternStringLabel intern = new statechum.analysis.learning.rpnicore.Transform.InternStringLabel();
    final Label lbl1 = intern.convertLabelToLabel(AbstractLearnerGraph.generateNewLabel("A", conf));
    final Label lbl2 = intern.convertLabelToLabel(AbstractLearnerGraph.generateNewLabel("A", conf));
    assertEquals(0,lbl1.toInt());
    assertEquals(0,lbl2.toInt());
    final Label lbl3 = intern.convertLabelToLabel(AbstractLearnerGraph.generateNewLabel("B", conf));
    assertEquals(1,lbl3.toInt());   
  }
View Full Code Here

      Iterator<List<Label>> suffixIt = suffixes.iterator();
      while(suffixIt.hasNext()){
        List<Label> suffix = suffixIt.next();
        Iterator<Label> loopLabelIt = loopLabels.iterator();
        while(loopLabelIt.hasNext()){
          Label loopLabel = loopLabelIt.next();
          List<Label> newQuestion = new LinkedList<Label>();
          if(prefix != null)
            newQuestion.addAll(prefix);
          newQuestion.add(loopLabel);
          newQuestion.addAll(suffix);
View Full Code Here

    return returnSet;
  }
 
  private boolean containsSubString(Collection<List<Label>> sPlusArg, List<Label> question){
    Iterator<List<Label>> stringIt = sPlusArg.iterator();
    Label first = question.get(0);
    int length = question.size();
    while(stringIt.hasNext()){
      List<Label> list = stringIt.next();
      for(int i=0;i<list.size();i++){
        if(list.get(i).equals(first)){
View Full Code Here

        Minus = ErlangQSMOracle.convertTracesToErl(sMinus, learnerInitConfiguration.config);
         
        RPNIUniversalLearner learner = new ErlangOracleLearner(null, learnerInitConfiguration);
        LearnerGraph outcome = learner.learnMachine(Plus, Minus);
        LearnerGraph expectedGraph = new LearnerGraph(learnerInitConfiguration.config);
        Label lblInit = AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",init,AnyWibble}", learnerInitConfiguration.config,learnerInitConfiguration.getLabelConverter()),
        lblLock = AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",call,lock}", learnerInitConfiguration.config,learnerInitConfiguration.getLabelConverter()),
        lblUnlock = AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",call,unlock}", learnerInitConfiguration.config,learnerInitConfiguration.getLabelConverter()),
        lblCast = AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",cast,AnyWibble}", learnerInitConfiguration.config,learnerInitConfiguration.getLabelConverter()),
        lblRead = AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",call, read}", learnerInitConfiguration.config,learnerInitConfiguration.getLabelConverter()),
        lblWrite = AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",call,{write,AnyWibble}}", learnerInitConfiguration.config,learnerInitConfiguration.getLabelConverter());
View Full Code Here

   */
  @Test
  public final void testVertexOrdering()
  {
    LearnerGraph gr = new LearnerGraph(config);
    Label a=AbstractLearnerGraph.generateNewLabel("a", config,getLabelConverter()),b=AbstractLearnerGraph.generateNewLabel("b", config,getLabelConverter());
    gr.paths.augmentPTA(Arrays.asList(new Label[]{a,a}),true,false,null);
    gr.paths.augmentPTA(Arrays.asList(new Label[]{a,b}),true,false,null);
    gr.paths.augmentPTA(Arrays.asList(new Label[]{b}),true,false,null);
   
    CmpVertex A=gr.paths.getVertex(Arrays.asList(new Label[]{})),
View Full Code Here

      vertexAlphabet.addAll(labels);
    }
    Set<Label> possibles = new TreeSet<Label>();
    possibles.addAll(alphabet);
    possibles.removeAll(vertexAlphabet);
    Label label = null;
    if(possibles.isEmpty())
      return false;// failure to add an edge since all possible letters of an alphabet have already been used
    Label possiblesArray [] = new Label[possibles.size()];possibles.toArray(possiblesArray);
    label = possiblesArray[randomInt(possiblesArray.length)];
    if (existingEdge != null)
    {// a parallel edge
      ((Set<Label>)existingEdge.getUserDatum(JUConstants.LABEL)).add(label);
    }
View Full Code Here

    if (!tokenizer.hasMoreTokens()) return;// ignore empty input
    String labelNameToken = tokenizer.nextToken();
    String labelNameString = appendToString(labelNameToken, null);
    if (labelNameString == null)
      throw new IllegalArgumentException("invalid label name "+labelNameToken);
    Label labelName = AbstractLearnerGraph.generateNewLabel(labelNameString, config);
   
    if (!tokenizer.hasMoreTokens()) throw new IllegalArgumentException("expected details for label "+labelName);
    OP_DATA kind = null;String prepost = tokenizer.nextToken();
    try
    {
View Full Code Here

        }
    makeSteps();
    computeDifference(new PatchGraph() {
      protected Label copyVertexWithPrefix(String prefix, Label origLabel)
      {
        Label result = null;
        if (origLabel instanceof StringLabel)
          result = new StringLabel(prefix+origLabel);
        else
        if (origLabel instanceof ErlangLabel)
        {
          ErlangLabel oErl = (ErlangLabel)origLabel;
          result = new ErlangLabel(oErl.function,prefix+oErl.callName,
              oErl.input, oErl.expectedOutput);
        }
        else
          assert false;
       
        return result;
      }
     
      @Override
      public void addTransition(CmpVertex from, Label origLabel, CmpVertex to)
      {
        Label label = copyVertexWithPrefix("ADD_",origLabel);
        mutator.addTransition(from, label, to);
        TransitionChanges changes = pairToNumberOfChanges.get(new StatePair(from,to));
        if (changes == null)
        {
          changes = new TransitionChanges();pairToNumberOfChanges.put(new StatePair(from,to),changes);
        }
        changes.added++;
      }

      @Override
      public void removeTransition(CmpVertex from, Label origLabel, CmpVertex to)
      {
        Label label = copyVertexWithPrefix("REM_",origLabel);
        mutator.removeTransition(from, origLabel, to);// remove the original transition
        mutator.addTransition(from, label, to);// and add the renamed one
        TransitionChanges changes = pairToNumberOfChanges.get(new StatePair(from,to));
        if (changes == null)
        {
View Full Code Here

TOP

Related Classes of statechum.Label

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.