Package statechum

Examples of statechum.Configuration


   */
  public final void testChooseStatePairs(String fsm, String [] initialReds, String [][] expectedReds, List<PairScore> expectedPairs, String graphName)
  {
    final DirectedSparseGraph gB = TestFSMAlgo.buildGraph(fsm, graphName);
    // check how the reference pair selection function performs
    Configuration conf = (Configuration)testConfig.clone();conf.setLearnerUseStrings(false);conf.setLearnerCloneGraph(false);
    testChooseStatePairsInternal(gB,new LearnerGraph(gB, conf), initialReds, expectedReds, expectedPairs, new InterfaceChooserToTest() {
      public Stack<StatePair> choosePairs() {// Here I need to convert the old type of pairs to the new one.
        Stack<OrigStatePair> pairs = chooseStatePairs(gB, new HashSet<List<String>>(), new HashSet<List<String>>());
        Stack<StatePair> result = new Stack<StatePair>();
        for(OrigStatePair pair:pairs) result.add(new StatePair((CmpVertex)pair.getQ(),(CmpVertex)pair.getR()));
View Full Code Here


     
      // It is not hard to calculate what blue states will directly surround a specific state chosen to become red, however those blue states may in turn immediately become red after evaluation and the same would apply
      // to the newly-discovered red states, so we effectively have to re-implement blue state calculation here. For this reason, it was decided not to do this but instead clone the state machine (possibly in a trimmed form)
      // and ask it for a list of pairs.
      // In practice, this algorithm turned out to be rather slow because there could be many red states to choose from and among those, many would lead to many pairs, all of which have to be scored.
      Configuration configCloneAll = coregraph.config.copy();configCloneAll.setLearnerCloneGraph(true);// we need to clone vertices because chooseStatePairs would colour some of the vertices red or blue.
      for(CmpVertex tentativeRed:tentativeRedNodes)
      {
        LearnerGraph graph = new LearnerGraph(configCloneAll);LearnerGraph.copyGraphs(coregraph,graph);
        graph.findVertex(tentativeRed).setColour(JUConstants.RED);// mark the tentative blue as red
        Stack<PairScore> pairs = graph.pairscores.chooseStatePairs(null);// calculate the subsequent red-blue pairs
View Full Code Here

      // It is not hard to calculate what blue states will directly surround a specific state chosen to become red, however those blue states may in turn immediately become red after evaluation and the same would apply
      // to the newly-discovered red states, so we effectively have to re-implement blue state calculation here. For this reason, it was decided not to do this but instead clone the state machine (possibly in a trimmed form)
      // and ask it for a list of pairs.
      // Assuming that we received red states in the same order as they are encountered by Statechum, it is appropriate to return the first state that has the highest number of reds after mergers,
      // because where it is actually
      Configuration configCloneAll = coregraph.config.copy();configCloneAll.setLearnerCloneGraph(true);// we need to clone vertices because chooseStatePairs would colour some of the vertices red or blue.
      for(CmpVertex tentativeRed:tentativeRedNodes)
      {
        LearnerGraph graph = new LearnerGraph(configCloneAll);LearnerGraph.copyGraphs(coregraph,graph);
        graph.findVertex(tentativeRed).setColour(JUConstants.RED);// mark the tentative blue as red
        graph.pairscores.chooseStatePairs(null);// calculate the subsequent red-blue pairs
View Full Code Here

  {
    Set<List<String>> plusStrings = buildSet(new String[][] { new String[] {"a","b","c"},new String[]{"a","d","c"} });
    DirectedSparseGraph actualA = new RPNIBlueFringeLearnerOrig(null,Configuration.getDefaultConfiguration()).augmentPTA(DeterministicDirectedSparseGraph.initialise(), plusStrings, true),
      actualC = null;
    DeterministicDirectedSparseGraph.numberVertices(actualA);// Numbering is necessary to ensure uniqueness of labels used by LearnerGraph constructor.
    Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
    config.setAllowedToCloneNonCmpVertex(true);
    LearnerGraph l = new LearnerGraph(config);
    actualC = l.paths.augmentPTA(plusStrings, true).paths.getGraph();
    DeterministicDirectedSparseGraph.numberVertices(actualA);
    String expectedPTA = "A-a->B--b->C-c->End1\nB--d->C2-c->End2";
    TestFSMAlgo.checkM(actualA, expectedPTA,config);
View Full Code Here

      eA = e;
    }

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      l.init(plusStrings, minusStrings);
      actualC = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
      // ignore this - it might be expected.
      eC = e;
    }

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
      // ignore this - it might be expected.
      eD = e;
    }

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      l.init(buildPTA(plusStrings, buildSet(new String[][] {})),0,0);
      for(List<String> seq:minusStrings)
        l.scoreComputer.paths.augmentPTA(buildPTA(buildSet(new String[][] {}),buildSet(new String[][] { (String [])seq.toArray()})));
      actualE = l.scoreComputer.paths.getGraph();
    }
View Full Code Here

      eA = e;
    }

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      l.init(plusStrings, minusStrings);
      actualC = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
      // ignore this - it might be expected.
      eC = e;
    }
   
    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
      // ignore this - it might be expected.
      eD = e;
    }

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      l.init(buildPTA(plusStrings, buildSet(new String[][] {})),0,0);
      for(List<String> seq:minusStrings)
        l.scoreComputer.paths.augmentPTA(buildPTA(buildSet(new String[][] {}),buildSet(new String[][] { (String [])seq.toArray()})));
      actualE = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
      // ignore this - it might be expected.
      eE = e;
    }

    if (eA != null)
    {
      Assert.assertNotNull(eC);
      Assert.assertNotNull(eD);
      Assert.assertNotNull(eE);
      throw eA;
    }

    Assert.assertNull(eA);
    Assert.assertNull(eC);
    Assert.assertNull(eD);
    Assert.assertNull(eE);

    Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
    config.setAllowedToCloneNonCmpVertex(true);
    TestFSMAlgo.checkM(actualA, expectedPTA,config);
    TestFSMAlgo.checkM(actualC, expectedPTA,config);
    //Visualiser.updateFrame(actualE,TestFSMAlgo.buildGraph(expectedPTA,"expected graph"));Visualiser.waitForKey();
    TestFSMAlgo.checkM(actualD,expectedPTA ,config);
    TestFSMAlgo.checkM(actualE,expectedPTA ,config);
View Full Code Here

          SequenceHandler stackHandler = new ExtendedSequenceHandler(namesToMethods, filesToHandlers.get(files[i]));
          parser.parse((File)files[i], stackHandler);
          System.out.println(stackHandler.getFunctionString(3));
          sPlus.add(stackHandler.getArrayListFunctionString(3));
        }
        Configuration config = Configuration.getDefaultConfiguration();
        PickNegativesVisualiser.setSimpleConfiguration(config, true,0);
        new PickNegativesVisualiser(split,ans).construct(sPlus, new HashSet<List<String>>(),null,config);
      }
      catch(Exception ex){
        ex.printStackTrace();
View Full Code Here

    } catch (IOException e) {
      e.printStackTrace();
    }
    // new PickNegativesVisualiser(new
    // SootCallGraphOracle()).construct(sPlus, sMinus,null, active);
    Configuration config = Configuration.getDefaultConfiguration();
    String AutoName = System.getProperty(VIZ_ENV_PROPERTIES.VIZ_AUTOFILENAME.toString());
    if (AutoName != null) config.setAutoAnswerFileName(AutoName);
    if(textoutput) config.setGenerateTextOutput(true);
    if(dotoutput) config.setGenerateDotOutput(true);
    PickNegativesVisualiser.setSimpleConfiguration(config, active, k);
    PickNegativesVisualiser pnv = new PickNegativesVisualiser();
    if (!includeLTL)
      pnv.construct(sPlus, sMinus, null, config);
    else
View Full Code Here

    LearnerGraph.testMode = true;
    setAutoOracle();
    Map<Integer, AtomicInteger> whichScoresWereUsedForMerging = new HashMap<Integer, AtomicInteger>(), restartScoreDistribution = new HashMap<Integer, AtomicInteger>();
    Map<PairScore, Integer> scoresToIterations = new HashMap<PairScore, Integer>();
    Map<PairScore, Integer> restartsToIterations = new HashMap<PairScore, Integer>();
    final Configuration shallowCopy = (Configuration)scoreComputer.config.clone();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraph ptaHardFacts = scoreComputer.copy(shallowCopy);// this is cloned to eliminate counter-examples added to ptaSoftFacts by Spin
    LearnerGraph ptaSoftFacts = scoreComputer;

    if (!SpinUtil.check(ptaHardFacts.paths.getGraph(), ltl))
      throw new IllegalArgumentException(getHardFactsContradictionErrorMessage(ltl));
View Full Code Here

public class Benchmarklinear {
  static LearnerGraph graph = null;

  public static void main(String[] args)
  {
    Configuration config = Configuration.getDefaultConfiguration();
    //config.setConsistencyCheckMode(true);
    //config.setQuestionGenerator(QuestionGeneratorKind.SYMMETRIC);
    synchronized (LearnerGraph.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
View Full Code Here

TOP

Related Classes of statechum.Configuration

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.