- int maxListLength = choiceUpperBound + 1;
- int listLength = maxListLength - minChoice;
- Integer[] choiceList = new Integer[listLength+1];
- // Put the conflicting event numbers first and reverse the order
- choiceList[0] = maxChoice;
- choiceList[1] = minChoice;
- // Put the rest of the event numbers into the array starting from the minimum to the upper bound
- for(int i = minChoice + 1, j = 2; j < listLength; i++) {
- if (i != maxChoice) {
- choiceList[j] = i;
- j++;
+ if (!isResetAfterAnalysis) {
+ int maxListLength = choiceUpperBound + 1;
+ int listLength = maxListLength - conflictEventNumber;
+ Integer[] newChoiceList = new Integer[listLength + 1];
+ // Put the conflicting event numbers first and reverse the order
+ newChoiceList[0] = choices[currentChoice];
+ newChoiceList[1] = choices[conflictEventNumber];
+ // Put the rest of the event numbers into the array starting from the minimum to the upper bound
+ for (int i = conflictEventNumber + 1, j = 2; j < listLength; i++) {
+ if (choices[i] != choices[currentChoice]) {
+ newChoiceList[j] = choices[i];
+ j++;
+ }
+ }
+ // Set the last element to '-1' as the end of the sequence
+ newChoiceList[newChoiceList.length - 1] = -1;
+ backtrackChoiceLists.addLast(newChoiceList);
+ // The start index for the recursion is always 1 (from the main branch)
+ choiceListStartIndexMap.put(newChoiceList, 1);
+ } else { // This is a sub-graph
+ int listLength = choices.length;
+ Integer[] newChoiceList = new Integer[listLength];
+ // Copy everything before the conflict number
+ for(int i = 0; i < conflictEventNumber; i++) {
+ newChoiceList[i] = choices[i];