Пример #1
0
def cycles_compatible(left, right):
  if left[1] == right[1]:
    # same cycle, different inputs, this cannot be part of a consistent mapping
    return False
  elif len(set(cycles[left[1]]).intersection(set(cycles[right[1]]))) == 0:
    # disjoint cycles are always locally compatible
    return True
  elif left[0] == right[0]:
    # this is an adjoint cycle, it can only be compatible if the intersection of states is empty
    # therefore it is not compatible
    return False
  else:
    # there is some overlap, we need to evaluate pairwise consistency explicitly
    decider = InequalityDecider()
    decider.add_cycle(problem_def, left[0], cycles[left[1]])
    decider.add_cycle(problem_def, right[0], cycles[right[1]])
    return decider.satisfiable()