Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Python by orkutner ( 6 years ago )
def add_lvp(self, lvp):
# Only if lvp is not dominated by any other pair, add it.
for my_lvp in self.LVP_Set.values():
# If a pair dominates, stop.
if my_lvp.is_dominant(lvp):
return False
# If no pair is dominant, Check if it dominates any other lvp,
# Remove dominated lvps and add new lvp.
for my_lvp in list(self.LVP_Set.values()):
if lvp.is_dominant(my_lvp):
del self.LVP_Set[my_lvp.get_name()]
# If no pair is dominant, add lvp to lvs.
self.LVP_Set.update({lvp.get_name(): copy.deepcopy(lvp)})
return True
def merge_with_completions(self, lvs):
Q = Phi_Environment()
for my_lvp in lvs.LVP_Set.values():
is_added = self.add_lvp(my_lvp)
if is_added:
for my_choice in my_lvp.get_phi_l().get_choices_list():
Q.add_choice(my_lvp.get_phi_l().get_choice(my_choice))
# while Q isn't empty
try:
while Q.get_length_list():
variable = list(Q.choicesList.values()).pop()
Q.remove_choice(variable.get_name())
C = self.find_lvs_completions(variable)
for pair in C.LVP_Set.values():
is_added2 = self.add_lvp(pair)
if is_added2:
for my_choice2 in pair.get_phi_l().get_choices_list():
Q.add_choice(pair.get_phi_l().get_choice(my_choice2))
except StopIteration:
return self
return self
Revise this Paste
Parent: 109348