// now a simulator to a learner
if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
VertexID.comparisonKind = ComparisonKind.COMPARISON_LEXICOGRAPHIC_ORIG;// this is a major change in a configuration of learners, affecting the comparison between vertex IDs
final LearnerSimulator simulator = new LearnerSimulator(new java.io.FileInputStream(logFileName),true);
final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData();
// Now we need to choose learner parameters based on the kind of file we are given
// (given the pace of Statechum evolution, I cannot expect all the correct options
// to be stored in log files).
if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_MAY2008.name()))
{
evalData.config.setUseAmber(false);evalData.config.setUseLTL(false);
evalData.config.setSpeculativeQuestionAsking(false);
evalData.config.setIgnoreDepthInTheChoiceOfRepresentatives(true);evalData.config.setIgnoreVertexAttributesInLogReplay(true);
}
else
if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEAMBER_MAY2008.name()))
{
evalData.config.setUseAmber(true);evalData.config.setUseLTL(false);
evalData.config.setSpeculativeQuestionAsking(false);
evalData.config.setIgnoreDepthInTheChoiceOfRepresentatives(true);evalData.config.setIgnoreVertexAttributesInLogReplay(true);
}
else
if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
{// we'd like to make sure that the initial configuration is loaded with the correct configuration values.
evalData.config.setInitialIDvalue(1);
VertexID.comparisonKind = ComparisonKind.COMPARISON_LEXICOGRAPHIC_ORIG;
evalData.config.setUseAmber(false);evalData.config.setUseLTL(false);
evalData.config.setSpeculativeQuestionAsking(false);
evalData.config.setDefaultInitialPTAName("Init");
evalData.config.setIgnoreDepthInTheChoiceOfRepresentatives(true);evalData.config.setIgnoreVertexAttributesInLogReplay(true);
}
else
Assert.fail("unknown type of log file");
final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
final ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
if (evalData.labelDetails != null)
{
initial.plus.addAll(evalData.labelDetails.getSPlus());initial.minus.addAll(evalData.labelDetails.getSMinus());
}
simulator.setNextElement(nextElement);
Learner learner2 = null;
if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
{// have to patch the learner.
learner2 = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,evalData.config,null,null))
{
/* (non-Javadoc)
* @see statechum.analysis.learning.observers.DummyLearner#init(java.util.Collection, java.util.Collection)
*/
@Override
public LearnerGraph init(Collection<List<String>> plus, Collection<List<String>> minus)
{
return super.init(plus, minus);
}
/* (non-Javadoc)
* @see statechum.analysis.learning.RPNIUniversalLearner#ComputeQuestions(statechum.analysis.learning.PairScore, statechum.analysis.learning.rpnicore.LearnerGraph, statechum.analysis.learning.rpnicore.LearnerGraph)
*/
@Override
public List<List<String>> ComputeQuestions(PairScore pair, LearnerGraph original, LearnerGraph tempNew)
{
return ArrayOperations.sort(ComputeQuestions.computeQS_origReduced(pair,original,tempNew));
}
/* (non-Javadoc)
* @see statechum.analysis.learning.RPNIUniversalLearner#MergeAndDeterminize(statechum.analysis.learning.rpnicore.LearnerGraph, statechum.analysis.learning.StatePair)
*/
@Override
public LearnerGraph MergeAndDeterminize(LearnerGraph original, StatePair pair)
{
return MergeStates.mergeAndDeterminize(original,pair);
}
@Override
public Pair<Integer,String> CheckWithEndUser(
@SuppressWarnings("unused") LearnerGraph model,
List<String> question, @SuppressWarnings("unused") int answerForNoRestart,
@SuppressWarnings("unused") List<Boolean> acceptedElements,
@SuppressWarnings("unused") final Object [] moreOptions)
{
return new Pair<Integer,String>(evalData.graph.paths.tracePathPrefixClosed(question),null);
}
@Override
public void AugumentPTA_and_QuestionPTA(LearnerGraph pta, RestartLearningEnum ptaKind,
List<String> sequence, boolean accepted, JUConstants newColour)
{
topLevelListener.AugmentPTA(pta, ptaKind, sequence, accepted, newColour);
}
};
}
else
if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_MAY2008.name()) ||
logFileName.contains(Configuration.LEARNER.LEARNER_BLUEAMBER_MAY2008.name())
)
{// have to patch the learner.
learner2 = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,evalData.config,null,null))
{
/* (non-Javadoc)
* @see statechum.analysis.learning.observers.DummyLearner#init(java.util.Collection, java.util.Collection)
*/
@Override