public int countMutations(Solution_ a, Solution_ b) {
        int mutationCount = 0;
        for (EntityDescriptor<Solution_> entityDescriptor : solutionDescriptor.getGenuineEntityDescriptors()) {
            List<Object> aEntities = entityDescriptor.extractEntities(a);
            List<Object> bEntities = entityDescriptor.extractEntities(b);
            for (Iterator<Object> aIt = aEntities.iterator(), bIt = bEntities.iterator(); aIt.hasNext() && bIt.hasNext(); ) {
                Object aEntity =  aIt.next();
                Object bEntity =  bIt.next();
                for (GenuineVariableDescriptor<Solution_> variableDescriptor : entityDescriptor.getGenuineVariableDescriptors()) {
                    // TODO broken if the value is an entity, because then it's never the same
                    // But we don't want to depend on value/entity equals() => use surrogate entity IDs to compare
                    // https://issues.jboss.org/browse/PLANNER-170
                    if (variableDescriptor.getValue(aEntity) != variableDescriptor.getValue(bEntity)) {
                        mutationCount++;
                    }
                }
            }
            if (aEntities.size() != bEntities.size()) {
                mutationCount += Math.abs(aEntities.size() - bEntities.size())
                        * entityDescriptor.getGenuineVariableDescriptors().size();
            }
        }
        return mutationCount;
    }
public int countMutations ( Solution_ a , Solution_ b ) { int mutationCount = 0 ; for ( EntityDescriptor < Solution_ > entityDescriptor : solutionDescriptor . getGenuineEntityDescriptors ( ) ) { List < Object > aEntities = entityDescriptor . extractEntities ( a ) ; List < Object > bEntities = entityDescriptor . extractEntities ( b ) ; for ( Iterator < Object > aIt = aEntities . iterator ( ) , bIt = bEntities . iterator ( ) ; aIt . hasNext ( ) && bIt . hasNext ( ) ; ) { Object aEntity = aIt . next ( ) ; Object bEntity = bIt . next ( ) ; for ( GenuineVariableDescriptor < Solution_ > variableDescriptor : entityDescriptor . getGenuineVariableDescriptors ( ) ) { if ( variableDescriptor . getValue ( aEntity ) != variableDescriptor . getValue ( bEntity ) ) { mutationCount ++ ; } } } if ( aEntities . size ( ) != bEntities . size ( ) ) { mutationCount += Math . abs ( aEntities . size ( ) - bEntities . size ( ) ) * entityDescriptor . getGenuineVariableDescriptors ( ) . size ( ) ; } } return mutationCount ; }
@param a never null
@param b never null
@return {@code >= 0}, the number of planning variables that have a different value in {@code a} and {@code b}.