assert scoreComputer.config.getQuestionGenerator() == QuestionGeneratorKind.CONVENTIONAL;
assert scoreComputer.config.getQuestionPathUnionLimit() < 0;
Collection<List<String>> questionsOrigA = ComputeQuestions.computeQS_orig(pair, scoreComputer,tempOrig);
//CmpVertex Rnew = tempNew.getVertex(scoreComputer.wmethod.computeShortPathsToAllStates().get(pair.getR()));
CmpVertex Rnew = tempNew.getStateLearnt();
assert Rnew == tempNew.getVertex(scoreComputer.wmethod.computeShortPathsToAllStates().get(pair.getR()));
Collection<List<String>> questionsOrigB = ComputeQuestions.computeQS_orig(new StatePair(Rnew,Rnew), scoreComputer,tempNew);
PTASequenceSet newQuestions =new PTASequenceSet();newQuestions.addAll(questions);
assert newQuestions.containsAll(questionsOrigA);
assert newQuestions.containsAll(questionsOrigB);
}
if (questions.isEmpty())
++counterEmptyQuestions;
}
boolean restartLearning = false;// whether we need to rebuild a PTA and restart learning.
//System.out.println(Thread.currentThread()+ " "+pair + " "+questions);
Iterator<List<String>> questionIt = questions.iterator();
while(questionIt.hasNext()){
List<String> question = questionIt.next();
boolean accepted = pair.getQ().isAccept();
Pair<Integer,String> answer = topLearner.CheckWithEndUser(scoreComputer, question, null);
this.questionCounter++;
if (answer.firstElem == USER_CANCELLED)
{
System.out.println("CANCELLED");
return null;
}
CmpVertex tempVertex = temp.getVertex(question);
if(answer.firstElem == USER_ACCEPTED)
{
++counterAccepted;
//sPlus.add(question);
topLearner.AugmentPTA(newPTA, RestartLearningEnum.restartHARD, question, true, null);
//newPTA.paths.augmentPTA(question, true, null);
++plusSize;
if (ans != null) System.out.println(howAnswerWasObtained+question.toString()+ " <yes>");
if (counterRestarted == restartOfInterest) System.out.println(question.toString()+ " <yes>");
if(!tempVertex.isAccept())
{
restartLearning = true;break;
}
}
else
if(answer.firstElem >= 0)
{// The sequence has been rejected by a user
assert answer.firstElem < question.size();
++counterRejected;
LinkedList<String> subAnswer = new LinkedList<String>();subAnswer.addAll(question.subList(0, answer.firstElem+1));
//sMinus.add(subAnswer);
topLearner.AugmentPTA(newPTA, RestartLearningEnum.restartHARD, subAnswer, false, null);
//newPTA.paths.augmentPTA(subAnswer, false, null);
++minusSize ;// important: since vertex IDs are
// only unique for each instance of ComputeStateScores, only once
// instance should ever receive calls to augmentPTA
if (ans != null) System.out.println(howAnswerWasObtained+question.toString()+ " <no> at position "+answer.firstElem+", element "+question.get(answer.firstElem));
if (counterRestarted == restartOfInterest) System.out.println(question.toString()+ " <no> at position "+answer.firstElem+", element "+question.get(answer.firstElem));
if( (answer.firstElem < question.size()-1) || tempVertex.isAccept())
{
assert accepted == true;
restartLearning = true;break;
}
}