Exemplo n.º 1
0
 def _isConsistent_2ways(self, x, y, const_dict):
     x_tag = x[0]
     y_tag = y[0]
     x_val = x[1]
     y_val = y[1]
     constraints = []
     permutations = ((x_tag, y_tag), (y_tag, x_tag))
     for p in permutations:
         if p in const_dict.keys():
             constraints.append((permutations.index(p), const_dict[p]))
     if len(constraints) != 0:
         for tuple in constraints:
             if tuple[0] == 0:
                 constraints = tuple[1]
                 for constraint in constraints:
                     if constraint._func(x_val, y_val) == False:
                         return False
             else:  # constraint[0] == 1:
                 constraints = tuple[1]
                 for constraint in constraints:
                     if constraint._func(y_val, x_val) == False:
                         return False
     return True
Exemplo n.º 2
0
 def _isConsistent_2ways(self, x, y, const_dict):
     x_tag = x[0]
     y_tag = y[0]
     x_val = x[1]
     y_val = y[1]
     constraints = []
     permutations = ( (x_tag, y_tag) , (y_tag, x_tag) )
     for p in permutations:
         if p in const_dict.keys():
             constraints.append( (permutations.index(p) , const_dict[p]) )
     if len(constraints) != 0:
         for tuple in constraints:
             if tuple[0] == 0:
                 constraints = tuple[1]
                 for constraint in constraints:
                     if constraint._func(x_val, y_val) == False:
                         return False
             else:   # constraint[0] == 1:
                 constraints = tuple[1]
                 for constraint in constraints:
                     if constraint._func(y_val, x_val) == False:
                         return False
     return True
Exemplo n.º 3
0
 def _isConsistent(self, x, y, const_dict):
     x_tag = x[0]
     y_tag = y[0]
     x_val = x[1]
     y_val = y[1]
     constraints = []
     # Two variables with no constraints relating them are automatically
     # consistent
     if not (const_dict.has_key((x_tag, y_tag))):
         return True
     constraints.extend(const_dict[(x_tag, y_tag)])
     if len(constraints) != 0:
         for constraint in constraints:
             if constraint._func(x_val, y_val) == False:
                 return False
     return True
Exemplo n.º 4
0
 def _isConsistent(self, x, y, const_dict):
     x_tag = x[0]
     y_tag = y[0]
     x_val = x[1]
     y_val = y[1]
     constraints = []
     # Two variables with no constraints relating them are automatically
     # consistent
     if not(const_dict.has_key( (x_tag, y_tag) )):
         return True
     constraints.extend(const_dict[ (x_tag, y_tag) ])
     if len(constraints) != 0:
         for constraint in constraints:
             if constraint._func(x_val, y_val) == False:
                 return False
     return True