}
protected final void findIncompatibleTestHelper(LearnerGraph gr,List<StringPair> incompatibles_list)
{
HashSet<StatePair> incompatibles = new HashSet<StatePair>();
StatesToConsider filter = LearnerGraphND.ignoreRejectStates;
GDLearnerGraph ndGraph = new GDLearnerGraph(gr,filter, false);
for(StringPair p:incompatibles_list)
{
incompatibles.add(new StatePair(gr.findVertex(p.firstElem),gr.findVertex(p.secondElem)));
incompatibles.add(new StatePair(gr.findVertex(p.secondElem),gr.findVertex(p.firstElem)));
}
Set<StatePair> incompatiblePairs = new HashSet<StatePair>();
for(StatePair s:buildSetOfIncompatiblePairsSlowly(gr,ThreadNumber))
{
incompatiblePairs.add(s);incompatiblePairs.add(new StatePair(s.secondElem,s.firstElem));
}
// incompatiblePairs these are the pairs which cannot be merged which may be a larger set than
// the set of clearly incompatible pairs, because incompatiblePairs is computed based on
// the outcome of computePairCompatibilityScore_general. The difference between computing incompatibility of pairs
// and doing computePairCompatibilityScore_general is that when pairs are merged, more traces
// are created, hence it is possible that some of those new traces will be in conflict.
// Example: states A3 and A2 in findIncompatibleStates6()
HashSet<StatePair> pairs_extra = new HashSet<StatePair>();pairs_extra.addAll(incompatibles);pairs_extra.removeAll(incompatiblePairs);
Assert.assertTrue("compatible pairs included :"+pairs_extra,pairs_extra.isEmpty());// this is a check that incompatibles_list does not include any compatible pairs
final int size=ndGraph.getPairNumber();
final int highNumber = 10000;
int pairs[]=new int[size];for(int i=0;i<pairs.length;++i) pairs[i]=highNumber;
// reverseMap maps state pair number to the actual state pairs, we slowly build it here
// rather then rely on getPairScore() which may have not even been written when
// I was doing this kind of testing.
reverseMap = new HashMap<Integer,StatePair>();
for(CmpVertex A:gr.transitionMatrix.keySet())
if (filter.stateToConsider(A))
for(CmpVertex B:gr.transitionMatrix.keySet())
if (filter.stateToConsider(B))
reverseMap.put(ndGraph.vertexToIntNR(A, B), new StatePair(A,B));
Assert.assertEquals(size,reverseMap.size());
ndGraph.buildMatrix(ThreadNumber);
ndGraph.findIncompatiblePairs(pairs,ThreadNumber);