In this assignment, you will need to write an agent that uses logical inference to find the answers to the given questions based on the data given in the below table: 1. Python Code Filename: ID.py ID Name GPA Program City Ahmed 3.56 BS-CS Gujranwala 123 Zahid 2.85 BS-SE Lahore 456 Baber 3.70 BS-DS Gujranwala 789 Shahid 2.99 BS-CS Gujranwala 321 Jamal 3.33 BS-DS Lahore 654 Use the given code puzzle.py and amend the code so that it finds the answer to these questions: a. Who lives in Lahore? b. Who studies in the BS-DS program? c. Who has the minimum GPA and who has the maximum GPA? You are restricted to using only the kanren logical AI library and the given code for the Logical Programming lectures. You may use any mathematical library (if needed) for any math related work. 2. Write a report (ID.pdf) that describes the logie of your solution. Make sure to describe all main steps that your code uses to find the answers of the given questions.
In this assignment, you will need to write an agent that uses logical inference to find the answers to the given
questions based on the data given in the below table:
1. Python Code Filename: ID.py
ID | Name | GPA | City | |
123 | Ahmed | 3.56 | BS-CS | Gujranwala |
456 | Zahid | 2.85 | BS-SE | Lahore |
789 | Baber | 3.70 | BS-DS | Gujranwala |
321 | Shahid | 2.99 | BS-CS | Gujranwala |
654 | Jamal | 3.33 | BS-DS | Lahore |
Use the given code puzzle.py and amend the code so that it finds the answer to these questions:
a. Who lives in Lahore?
b. Who studies in the BS-DS program?
c. Who has the minimum GPA and who has the maximum GPA?
You are restricted to using only the kanren logical
Programming lectures. You may use any mathematical library (if needed) for any math related work.
2. Write a report (ID.pdf) that describes the logic of your solution. Make sure to describe all main steps that
your code uses to find the answers of the given questions.
puzzle.py; from kanren import * # Declare the variable # Define the rules # Steve's car is blue # Person who owns the cat lives in Canada # Matthew lives in USA # The person who has a black car lives in Australia # Jack has a cat # Alfred lives in Australia # Person who owns the dog lives in France # Who is the owner of the rabbit? # Run the solver # Extract the output # Print the output
|
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 6 images