Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. def f(dataset):
  2.     inp,out,comp = dataset
  3.     out = []
  4.     for var in itertools.product(*[(True,False) for _ in range(len(comp))]):
  5.         temp_comp = copy.deepcopy(comp)
  6.         for b,func in zip(var,temp_comp):
  7.             if b and var != (True)*len(comp):
  8.                 temp_comp.remove(func)
  9.        
  10.         if eval(temp_comp.compose(inp)) == output:
  11.             out.append(temp_comp)
  12.     t= min(out,key=len)
  13.     return (len(comp),len(t))
  14.  
  15. a = [f(a) for a in dataset]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement