Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from copy import deepcopy
- import math
- # (No overlap) Decide if a subset of lists can be
- # multiplied together that will equal N.
- # Take any Exact-3-Cover Instance
- # for the Reduction
- s = [11,12,13,14,15,16]
- c = [[11,12,13],[14,15,16]]
- s_copy = deepcopy(s)
- c_copy = deepcopy(c)
- def bijective_mapp():
- for a in range(0, len(s)):
- s[a] = a+1
- for b in range(0, len(c)):
- for bb in range(0, len(c[b])):
- c[b][bb] = s_copy.index(c[b][bb])+1
- bijective_mapp()
- # Take the total product of s
- # Which is factorial(len(s))
- N = math.factorial(len(s))
- # We are going to need to convert N into
- # a Universe. To show that both N & S
- # can be reduced into each other
- # efficently
- n = 0
- m = 1
- u = []
- while m < N:
- n = n + 1
- m = m * n
- u.append(n)
- if u == s:
- print('Both u & s are equal')
- print('input for N: ',N)
- print('input for c: ',c)
- print('original inputs')
- print('s: ',s_copy)
- print('c: ',c_copy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement