CS计算机代考程序代写 from csp import *

from csp import *
import itertools

def generate_and_test(csp):
names, domains = zip(*csp.var_domains.items())
for values in itertools.product(*domains):
assignment = {x:v for x, v in zip(names, values)}
#print(assignment)
if all([satisfies(assignment, constraint) for constraint in csp.constraints]):
yield assignment