# Cas d'echec : concept disjonctif du restaurant (donnees SL-1, AIMA Table 19.1)
restaurant_data = [
{"Alternate": "Yes", "Bar": "No", "Fri/Sat": "No", "Hungry": "Yes", "Patrons": "Some", "Price": "$$$", "Raining": "No", "Reservation": "Yes", "Type": "French", "WaitEstimate": "0-10", "WillWait": "Yes"},
{"Alternate": "Yes", "Bar": "No", "Fri/Sat": "No", "Hungry": "Yes", "Patrons": "Full", "Price": "$", "Raining": "No", "Reservation": "No", "Type": "Thai", "WaitEstimate": "30-60", "WillWait": "Yes"},
{"Alternate": "No", "Bar": "Yes", "Fri/Sat": "No", "Hungry": "No", "Patrons": "Some", "Price": "$", "Raining": "No", "Reservation": "No", "Type": "Burger", "WaitEstimate": "0-10", "WillWait": "No"},
{"Alternate": "Yes", "Bar": "No", "Fri/Sat": "Yes", "Hungry": "Yes", "Patrons": "Full", "Price": "$", "Raining": "Yes", "Reservation": "No", "Type": "Thai", "WaitEstimate": "10-30", "WillWait": "Yes"},
{"Alternate": "Yes", "Bar": "No", "Fri/Sat": "Yes", "Hungry": "No", "Patrons": "Full", "Price": "$$$", "Raining": "No", "Reservation": "Yes", "Type": "French", "WaitEstimate": ">60", "WillWait": "No"},
{"Alternate": "No", "Bar": "Yes", "Fri/Sat": "No", "Hungry": "Yes", "Patrons": "Some", "Price": "$$", "Raining": "Yes", "Reservation": "Yes", "Type": "Italian", "WaitEstimate": "0-10", "WillWait": "Yes"},
{"Alternate": "No", "Bar": "Yes", "Fri/Sat": "No", "Hungry": "No", "Patrons": "None", "Price": "$", "Raining": "Yes", "Reservation": "No", "Type": "Burger", "WaitEstimate": "0-10", "WillWait": "No"},
{"Alternate": "No", "Bar": "No", "Fri/Sat": "No", "Hungry": "Yes", "Patrons": "Some", "Price": "$$", "Raining": "Yes", "Reservation": "Yes", "Type": "Thai", "WaitEstimate": "0-10", "WillWait": "Yes"},
{"Alternate": "No", "Bar": "Yes", "Fri/Sat": "Yes", "Hungry": "No", "Patrons": "Full", "Price": "$", "Raining": "Yes", "Reservation": "No", "Type": "Burger", "WaitEstimate": "10-30", "WillWait": "No"},
{"Alternate": "Yes", "Bar": "Yes", "Fri/Sat": "Yes", "Hungry": "Yes", "Patrons": "Full", "Price": "$$$", "Raining": "No", "Reservation": "Yes", "Type": "Italian", "WaitEstimate": "10-30", "WillWait": "No"},
{"Alternate": "No", "Bar": "No", "Fri/Sat": "No", "Hungry": "No", "Patrons": "None", "Price": "$", "Raining": "No", "Reservation": "No", "Type": "Thai", "WaitEstimate": "0-10", "WillWait": "No"},
{"Alternate": "Yes", "Bar": "Yes", "Fri/Sat": "Yes", "Hungry": "Yes", "Patrons": "Full", "Price": "$", "Raining": "No", "Reservation": "No", "Type": "Burger", "WaitEstimate": "30-60", "WillWait": "Yes"},
]
RESTAURANT_ATTRS = ["Alternate", "Bar", "Fri/Sat", "Hungry", "Patrons",
"Price", "Raining", "Reservation", "Type", "WaitEstimate"]
print("MINIMAL-CONSISTENT-DET sur le restaurant (concept disjonctif)")
print("=" * 62)
print()
print("Recherche sur les 5 premiers attributs :")
rest5 = minimal_consistent_det(restaurant_data, RESTAURANT_ATTRS[:5], "WillWait")
print()
if rest5.determination is None:
print("Aucune determination sur les 5 premiers attributs :")
print("le concept disjonctif n'est une fonction d'aucun de ces sous-ensembles.")
print()
print("Recherche sur les 10 attributs :")
rest10 = minimal_consistent_det(restaurant_data, RESTAURANT_ATTRS, "WillWait", verbose=False)
if rest10.determination:
print(f" Determination 'trouvee' : {{{', '.join(rest10.determination)}}}"
f" apres {rest10.subsets_tested} tests")
print()