Highlights
AI/Prolog
1) Probabilistic reasoning(3p)
A knight wants to find and kill a dragon who lives in a maze. The knight has a bag of pills where each pill can either be magical(magical)or not magical(?magical).The knight does not know which pills are magical, but does know that the bag contains 5 magical pills and 15non magical ones.Thus,the probability of the knight pulling a magical pill from the bag, i.e. P(magical), is 0,25 and the probability of non-magical pill, P(?magical), is 0,75. When fighting the dragon, the knight can either win (win) or not win (win) the battle. Before encountering the dragon, the knight eats a random pill from the bag. The following then holds:
Let the two binary random variables M∈{magical,?magical }andW∈{ win,?win}represent the outcome of the pill pulled from the bag and the outcome of the battle, respectively.
Now solve the tasks below. In order to obtain the maximum points, you will have to state your calculations clearly (at least which formula you use and which values goes where), as well as the final probabilities. Also note that some tasks might require you to do a calculation in several steps. Each task is worth 1 point.
Task a.
What are the marginal probabilities of W, i.e. what is P(win) and P(?win)?
Task b.
Calculate the conditional probabilities P(?win|magical) and P(?win|?magical).
Task c.
What is the probability that the knight ate a magic pill, given that the battle was won? 2) Certainty factors(2p)
In a career-planning expert system certainty factors are used to handle uncertainties. We have two rules regarding if a person should elect to become an engineer:
(i) IF SMART AND BORINGTHENENGINEER (CF=0.8)
(ii) IF GO-GETTER OR GEEKTHENENGINEER (CF=0.5)
WhatistheCFforENGINEERifwehavethefollowingvaluesbeforetherulesareapplied? SMART(CF=0.8), BORING(CF=0.5), GO-GETTER(CF=0.6),GEEK(CF=0.4) (This is the first evidence concerning ENGINEER.)
3) MDP / Reinforcement learning (5p)
This question may be solved inpairs
In this task,you should find the optimal policy and the corresponding state utility values for an MDP. We use the same setting as in the book, i.e., an agent capable of moving {UP, RIGHT, DOWN, LEFT}, but with a probability (20%) that an intended move turns out to be90degreeswrong.Asanexample,iftheintendedmoveisUP,the agentwillinfactmove UP with probability 0.8, move LEFT with probability 0.1 and move RIGHT with probability0.1.Iftheagentbumpsintoawall,itremainsinitscurrentposition.Everymove, even if staying in the same position from bumping into a wall costs R, where R may have differentvalues.
Find optimal policies and corresponding state values for the environment below. LetR(s)= -0.2 and R(s)=-0.01.
-1 +1
-1
START
Youmayuseanyofthemethodswediscussedforthiskindofproblem,i.e.,valueiteration, policyiteration,MonteCarloorTD-learning.Thechoiceofprogramminglanguageisfree.
(Hint: You can test your program on the problem from the book, where you know the answers!)
Hand in the following:
-1 +1
-1
State values for R(s) = -0.2
-1 +1
-1
Policy for R(s) = -0.2
4) Minimax and alpha-beta(3p)
Consider a game tree with the branching factor 2 and a depth of four plys (levels) where MAX is making the first move. Draw the game tree and give values to the leavesso that themaximumnumberofnodesiscut.Backupthevaluesinthetreeallthewaytotheroot and show which nodes that are cut. Just to be clear – the game tree will have 16 leaves. Note: for nodes that are cut, values should not begiven.
5) Game theory(5p)
This question may be solved in pairs
Two players are playing a game loosely based on Poker. Here, the deck consists of exactly three cards; an Ace, a King and a Queen. The format of the game is as follows: ? Each player antes$1.
o Ifplayertwochecksthereisashowdownforthepotof2(i.e.thehighercard wins 1 from the otherplayer).
o If player two bets then player one can fold orcall.
o If player two folds then player one takes the pot of 3 (i.e. winning 1 from player2).
o If player two calls there is a showdown for the pot of 4 (i.e. the higher card wins 2 from the other player).
Solve this game! You should hand in:
a) The reduced normal form of the game, i.e., with dominated strategies removed. b) A CLP-Prolog program linear program solving the game. Include a screen dump where the actual solution is found.
c) The optimal strategies, expressed as behaviors, and the value of the game.
PROLOG PART (12 points)
Each solution in this part must include both the source Prolog code and examples of questions with answers.
Please do not include screenshots of code. Just copy and paste the text into a document keeping indentation but not the color of the background. To do this:
6) Constraint Logic Programming (2p)
Severalfriendsaregoingtobuyapresenttogether.Ifeachonepays140krthenthereisadeficit of 40 kr. If each one pays 160 kr then there is 60 kr leftover.
How much does the present cost?
Solve the problem using CLP(R).
7) Database Manipulation(4p)
Your task now is to write a Prolog program that will manipulate the Prolog database. Although it is not a recommended style for everyday programming, it can be quite useful in certain situations.
You are given these six clauses describing size and color of balloons in a room. They are the initial part of your program:
balloon(size(big), color(red)).
balloon(size(big),
color(green)).balloon(size(medium),
balloon(size(big),c o l o r ( a m b e r ) )
color(magenta)).balloon(size(medium),
color(cyan)). balloon(size(small),
color(red)). balloon(size(small),
color(yellow)).
Imagine that some of the balloons are replaced with different colors. To reflect these changes in the Prolog database, create the predicatechange_balloons(List)that accepts as its argument a list of color substitutions of the formold_color/new_color, e.g. [red/amber, cyan/ teal].change_balloonshas to change the color of all the balloons whose color is given in one of the substitution pairs to the corresponding new color. This means that the appropriate facts have to be dynamically changed.
Moreover, you want to know the colors of your “party balloons”. A balloon is considered a “party” one if its size is big or medium. To do this, you have to create the predicateadd_rulethat adds a new rule with the headparty_balloon(color(Color))to the Prolog database. After adding the new predicateparty_balloon, the ruleadd_ruleshould delete itself from the database.
You program should be able to answer this kind of questions to change color of balloons:
- change_balloons([red/amber, cyan/teal]), listing(balloon),listing(add_rule).
r ( C ) ) . C= amber;
balloon(size(big),
color(green)).balloon(size(medium),
color(magenta)).balloon(size(medium),
color(teal)). balloon(size(small),
color(amber)). balloon(size(small),
color(yellow)).
:-dynamic add_rule/0.
true.
Then it should be able to find colors of “party balloons”:
C = green;
C = magenta;C
=teal;false.
8) Knowledge Representation and Expert Systems (6p)
This question may be solved inpairs
Thistaskistocreateaminiexpertsystemtodiagnoseproblemsofacarinacarworkshop.This includes representation of domain knowledge that is necessary to repair cars. An experienced car mechanic would possess such knowledge. It is also necessary to represent facts describing the state of a particular car in the workshop. As soon as the car is examined and relevant facts entered into the system, the mechanic can ask the system to find problems with thiscar.
Start with finding and structuring relevant knowledge about (personal) cars. You can rely on your general knowledge of cars – you are not supposed to be 100% technically correct. The main goal of this exercise is to learn how to represent and use knowledge about a domain. But if you want, you can also google for additional facts about cars, e.g.http://auto.howstuffworks.com/under-the-hood-channel.htm. You will need to represent knowledge about structural parts of a car like a car engine, fuel system, electrical system, and the like, as well as reasons for malfunction of certain car systems/parts.
First of all, you need to create severalif-thenrules that describe reasons for malfunctioning of a car. Here you can find two examples of rules (in plain English). You will need to add more rules of your own.
If the engine gets fuel and start engine turns, then the sparkling is theproblem. ? If there is gas in the tank and there is gas in the carburettor then the engine getsfuel.
After writing down rules in plain English, represent them as Prolog clauses. Use the operator notation introduced in Chapter 15 of Bratko’s book. Yourif-thenrules are supposed to be formulated in a general way, i.e. they shoulduse variablesto be applicable to different cars(in contrast to the example about water leaks in theflat).
Then,addfactsrepresentingaparticularinstanceofacar,e.g.VolvoV50withtheregistration number “ABC 123”, and results of the car examination. The facts should describe the status of different car systems/parts. Each particular is supposed to be represented with its own set of facts.
Finishedd i a g n o s i n g
Finally,modifytheforwardchaininginterpreterfromFig15.7inthetextbooktomakeitwork with your rules and facts. The interpreter is to be started with the predicatediagnose(Car), whereCaris instantiated with the ID of one of the cars in the workshop. During each run, the interpreterhastoderivenewfactsandidentifyproblemsrelevantonlytothecarwiththegiven ID. The interpreter should output the derived facts and found problems. The output should includeadescriptionofthecarandshortdescriptionofeachproblem.A n exampleofquestions with answers for the program having facts about twocars:
- diagnose(toyota_QWE789).
DiagnosingthecarToyotaCorolla"QWE- 789"Found problem:startengine problem true.
- diagnose(volvo_XYZ123).
Diagnosing the car Volvo V70 "XYZ-123"
Derived fact: engine_gets_fuel(volvo_XYZ123) Found problem: sparkling problem Finished diagnosingtrue.
You should hand in:
This Engineering Assignment has been solved by our Engineering Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.