Package statechum.model.testset

Examples of statechum.model.testset.PTASequenceSet


   *
   * @param questions
   * @return a set of questions which are not prefixes of other questions.
   */
  protected Collection<List<Label>> trimSet(Collection<List<Label>> questions){
    PTASequenceSet collection = new PTASequenceSet();collection.addAll(questions);
    return collection.getData();
  }
View Full Code Here


    //l.setGeneralisationThreshold(1);
    //l.setCertaintyThreshold(5);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
    LearnerGraph learntStructureA = new LearnerGraph(l.learnMachine(buildSet(plus,config), buildSet(minus,config)),expected.config);
    // Now do the same with ptasets instead of real sets
    PTASequenceSet plusPTA = new PTASequenceSet();plusPTA.addAll(buildSet(plus,config));PTASequenceSet minusPTA = new PTASequenceSet();minusPTA.addAll(buildSet(minus,config));
    LearnerGraph learntStructureB = new LearnerGraph(l.learnMachine(plusPTA, minusPTA),expected.config);
    Assert.assertNull(WMethod.checkM(learntStructureA, learntStructureB));
    LearnerGraph learntMachineNoRejects = new LearnerGraph(expected.config);
    AbstractPathRoutines.removeRejectStates(learntStructureA,learntMachineNoRejects);
    Assert.assertNull(WMethod.checkM(learntMachineNoRejects, expected));
View Full Code Here

    //l.setGeneralisationThreshold(1);
    //l.setCertaintyThreshold(5);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
    LearnerGraph learntStructureA = new LearnerGraph(l.learnMachine(buildSet(plus,testConfig,getLabelConverter()), buildSet(minus,testConfig,getLabelConverter())),expected.config);
    // Now do the same with ptasets instead of real sets
    PTASequenceSet plusPTA = new PTASequenceSet();plusPTA.addAll(buildSet(plus,testConfig,getLabelConverter()));PTASequenceSet minusPTA = new PTASequenceSet();minusPTA.addAll(buildSet(minus,testConfig,getLabelConverter()));
    LearnerGraph learntStructureB = new LearnerGraph(l.learnMachine(plusPTA, minusPTA),expected.config);
    Assert.assertNull(WMethod.checkM(learntStructureA, learntStructureB));
    LearnerGraph learntMachineNoRejects = new LearnerGraph(expected.config);
    AbstractPathRoutines.removeRejectStates(learntStructureA,learntMachineNoRejects);
    Assert.assertNull(WMethod.checkM(learntMachineNoRejects, expected));
View Full Code Here

  final ConvertALabel converter = null;
 
  @Test
  public final void testPrefixRemovingCollection0()
  {
    PTASequenceSet c = new PTASequenceSet();
    Assert.assertEquals(0, c.size());
    Assert.assertFalse(c.getData().iterator().hasNext());
    Assert.assertTrue(c.getData().isEmpty());

    Assert.assertTrue(c.containsAll(c));

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertFalse(c.contains(labelList(new String[]{"a"})));
  }
View Full Code Here

  }
 
  @Test
  public final void testPrefixRemovingCollection1()
  {
    PTASequenceSet c = new PTASequenceSet();
    c.addSequence(new LinkedList<Label>());
    Set<List<Label>> expected = buildSet(new String[][]{
        new String[]{}
    },config,converter),actual = new HashSet<List<Label>>();actual.addAll(c.getData());
    Assert.assertEquals(1, c.getData().size());
    Assert.assertTrue(expected.equals(actual));
    Assert.assertFalse(c.getData().isEmpty());

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertFalse(c.contains(labelList(new String[]{"a"})));

    Assert.assertTrue(c.containsAll(expected));
    Assert.assertTrue(c.containsAll(c));
  }
View Full Code Here

  }
 
  @Test
  public final void testPrefixRemovingCollection2()
  {
    PTASequenceSet c = new PTASequenceSet();
    c.addSequence(new LinkedList<Label>());
    c.addSequence(new LinkedList<Label>());
    c.addSequence(new LinkedList<Label>());
    Set<List<Label>> expected = buildSet(new String[][]{
        new String[]{}
    },config,converter),actual = new HashSet<List<Label>>();actual.addAll(c.getData());
    Assert.assertEquals(1, c.getData().size());
    Assert.assertFalse(c.getData().isEmpty());
    Assert.assertTrue(expected.equals(actual));

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertFalse(c.contains(labelList(new String[]{"a"})));
   
    Assert.assertTrue(c.containsAll(expected));
    Assert.assertTrue(c.containsAll(c));
  }
View Full Code Here

  }
 
  @Test
  public final void testPrefixRemovingCollection3()
  {
    PTASequenceSet c = new PTASequenceSet();
    c.addSequence(new LinkedList<Label>());
    c.addSequence(labelList(new String[]{"a"}));
    Set<List<Label>> expected = buildSet(new String[][]{
        new String[]{"a"}
    },config,converter),actual = new HashSet<List<Label>>();actual.addAll(c.getData());
    Assert.assertEquals(1, c.getData().size());
    Assert.assertTrue(expected.equals(actual));
    Assert.assertFalse(c.getData().isEmpty());

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertTrue(c.contains(labelList(new String[]{"a"})));
    Assert.assertFalse(c.contains(labelList(new String[]{"a","a"})));
   
    Assert.assertTrue(c.containsAll(expected));
    Assert.assertTrue(c.containsAll(c));
  }
View Full Code Here

  }
 
  @Test
  public final void testPrefixRemovingCollection4()
  {
    PTASequenceSet c = new PTASequenceSet();
    c.addSequence(new LinkedList<Label>());
    c.addSequence(labelList(new String[]{"a"}));
    c.addSequence(labelList(new String[]{"a","a"}));
    Set<List<Label>> expected = buildSet(new String[][]{
        new String[]{"a","a"}
    },config,converter),actual = new HashSet<List<Label>>();actual.addAll(c.getData());
    Assert.assertEquals(1, c.getData().size());
    Assert.assertTrue(expected.equals(actual));
    Assert.assertFalse(c.getData().isEmpty());

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertTrue(c.contains(labelList(new String[]{"a"})));
    Assert.assertTrue(c.contains(labelList(new String[]{"a","a"})));
    Assert.assertFalse(c.contains(labelList(new String[]{"a","a","a"})));
   
    Assert.assertTrue(c.containsAll(expected));
    Assert.assertTrue(c.containsAll(c));
  }
View Full Code Here

  }
 
  @Test
  public final void testPrefixRemovingCollection5()
  {
    PTASequenceSet c = new PTASequenceSet();
    c.addSequence(new LinkedList<Label>());
    c.addSequence(labelList(new String[]{"a","a"}));
    c.addSequence(labelList(new String[]{"a"}));
    c.addSequence(labelList(new String[]{}));
    Set<List<Label>> expected = buildSet(new String[][]{
        new String[]{"a","a"}
    },config,converter),actual = new HashSet<List<Label>>();actual.addAll(c.getData());
    Assert.assertEquals(1, c.getData().size());
    Assert.assertTrue(expected.equals(actual));
    Assert.assertFalse(c.getData().isEmpty());

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertTrue(c.contains(labelList(new String[]{"a"})));
    Assert.assertTrue(c.contains(labelList(new String[]{"a","a"})));
    Assert.assertFalse(c.contains(labelList(new String[]{"a","a","a"})));
   
    Assert.assertTrue(c.containsAll(expected));
    Assert.assertTrue(c.containsAll(c));
  }
View Full Code Here

  }
 
  @Test
  public final void testPrefixRemovingCollection6()
  {
    PTASequenceSet c = new PTASequenceSet();
    c.addSequence(new LinkedList<Label>());
    c.addSequence(labelList(new String[]{"a"}));
    c.addSequence(labelList(new String[]{}));
    c.addSequence(labelList(new String[]{"a","a"}));
    c.addSequence(labelList(new String[]{"a"}));
    Set<List<Label>> expected = buildSet(new String[][]{
        new String[]{"a","a"}
    },config,converter),actual = new HashSet<List<Label>>();actual.addAll(c.getData());
    Assert.assertEquals(1, c.getData().size());
    Assert.assertTrue(expected.equals(actual));
    Assert.assertFalse(c.getData().isEmpty());

    Assert.assertTrue(c.contains(new LinkedList<Label>()));
    Assert.assertTrue(c.contains(labelList(new String[]{"a"})));
    Assert.assertTrue(c.contains(labelList(new String[]{"a","a"})));
    Assert.assertFalse(c.contains(labelList(new String[]{"a","a","a"})));
   
    Assert.assertTrue(c.containsAll(expected));
    Assert.assertTrue(c.containsAll(c));
  }
View Full Code Here

TOP

Related Classes of statechum.model.testset.PTASequenceSet

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.