Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assigned: Friday 2 6 Jan 2 0 2 4 Due: Friday 2 Feb 2 0 2 4 Objective: This lab activity aims to demonstrate how

Assigned: Friday 26 Jan 2024
Due: Friday 2 Feb 2024
Objective:
This lab activity aims to demonstrate how to use the logpy or Kanren library for logic programming in Python.
Lab Activity No.1:
Write a Python program that uses logic programming to recommend a dish to a person. The recommendation is made based on:
if someone likes a dish of a certain type that has a certain flavor, so most probably they would like other dishes with the same flavor.
Facts about food types and flavors
Relations
We need to initiate the following relations to construct the facts about food types, food flavors, and a set of persons favorite food:
Food Type
Food Flavor
Likes
Facts:
The following statements declare facts about some foods and some persons favorite foods:
Food Types:
Gouda is cheese
Ritz is cracker
Steak is meat
Sausage is meat
Lemonade is juice
Cookie is dessert
Flavors:
Dessert is sweet
Meat is savory
Cheese is savory
Cracker is savory
Juice is sweet
Likes:
Noor likes sausage
Melissa likes Ritz
Dmitry likes cookie
Nikita likes sausage
Assel likes limonade
Solution Instructions:
You should write your information (Name, ID, Section)
# EMAI-611: Advanced Programming for Al
# Lecture 1 Lab Activity
#Date:
#Name:
#KAU ID:
#Section:
Step 1: Define the three relations using Relation ()
Step 2: Construct all the listed facts for each relation defined in Step 1 using the fact
Step 3: Define a method, food_flavor(x,y that takes two parameters the first parameter for flavor and the second for food type, and should return all the foods with the same flavor.
Step 4: Define a method, dish_to_like(person, what)
that takes two parameters a person's name and a parameter for what food the person likes and returns what other options of food are recommended for that person.
Note: dish_to_like method will calls food_flavor method
You need to define all variables using var () and you need conde, run, and llal methods.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions