0% found this document useful (0 votes)
42 views40 pages

Ai Spectrum U-2

The document outlines a syllabus focused on problem-solving through search techniques and propositional logic, covering topics such as adversarial search, constraint satisfaction problems, and knowledge-based agents. It includes learning objectives and definitions related to game theory, search algorithms like alpha-beta pruning, and the structure of constraint satisfaction problems. Additionally, it discusses the components of games, types of games, and the importance of game theory in various fields, including computer science.

Uploaded by

ketahay994
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views40 pages

Ai Spectrum U-2

The document outlines a syllabus focused on problem-solving through search techniques and propositional logic, covering topics such as adversarial search, constraint satisfaction problems, and knowledge-based agents. It includes learning objectives and definitions related to game theory, search algorithms like alpha-beta pruning, and the structure of constraint satisfaction problems. Additionally, it discusses the components of games, types of games, and the importance of game theory in various fields, including computer science.

Uploaded by

ketahay994
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

1A8

UNIT for
theLogo theTitf

Problem Solving bySearch-Iland


on eCoverBefore
You

2
Propositional Logic
SIAGROUP
OUSHFOUC

SIA GROUP

Syllabus
Adversarial Search: Games, OptimalDecisions in Games,Alpha-Beta Pruning,
Imperfect Real-Time Decisions.
Constraint Satisfaction Problems: Defining Constraint Satisfaction Problems
,Constraint Propagation,Backtracking
Search for CSPs, Local Search for CSPs,The Structure of Problems.
Propositional Logic: Knowledge-based Agents,TheWumpusWorld,Logic,Propositional
Logic, Propositional Theorem
Proving: Inference and Proofs, Proof by Resolution, Horn Clauses and Definite Clauses,Forward and Backward
क Chaining,Effective Propositional ModelChecking, Agents BasedonPropositional Logic.

LEARNING OBJECTIVES

Introduction to Games, Reasons for Studying Games


Performing Search using Alpha-Beta Pruning
Managing Imperfect and Real-Time Decisions
Introduction to Constraint Satisfaction Problem and Various Types of CSPs

Processing Jobs using Job Shop Scheduling


Constraint Propagation'and TypesofLocal Consistencies
CSPBased Backtracking Search and Local Search
Components and Levels of Knowledgebased Agents
Definition and Kinds of Logics i.e., Propositional and First-Order Logic

Inference RulesofPropositional Logic, Resolution andCompleteness of Resolution


Categories of HornClauses,Forward and Backward Chaining in Propositional Logic
Efficient Algorithms for Propositional Inference Based Model Checking
Frame Problem and Hybrid Agent

INTRODUCTION.

Agame is asearch problem where two players or agents perform certain actions or moves, such that
the looser gets
their actions are against each other.Whenthegamecompletesthe winner gets points and
situations . Byapplying
penalties. Gamesarestudiedtocapture and represent the behavior of strategic
(moves) andachieve
principles of gametheory,onecananalyze the problem,select appropriate choices
which leadsto а
success. The minimax procedure is arecursive procedurethat finds an optimal strategy
win state in agivengametree. Alpha-beta pruning is asearch algorith
m that improvesthe efficiency of
to beevaluated in the search tree.
minimaxalgorithm byreducingthenumber ofnodes

The Constraint Satisfaction Problem (CSP) can be described as asetofvariables K,,K₂...K and
setof

constraintsC,,C₂,...C wherein each and everyvariable K, ofthe setconsisting ofnon-empty domain


D, of values. It can besolved using various methods including backtracking search
and local search.

Ageneric knowledge-based agent or simply aknowledge based agent is an agent that knows
about
the world, reasons the possible courses of actions and learns to adapt changes. In propositio nal logic,
statements arerepresented aspropositions whosevalues are eithertrue or false but not both. This makes
it easierto draw inference fromthe given statements.

EJSPECTRUM ALL-IN-ONE JOURNALFORENGINEERING STUDENTS


44 ARTIFICIAL INTELLIGENCE
idw
[JNTU-HYDERABAD]

UTIONS
PART-A SHORTQUESTIONSWITH SOL
A

ent s ofagame?
Q1. Whataretheformalcompon
Mode
lPape 1.
Answer: r-1,Q1
(c)
e are asfollows,
Theformalcomponents ofagam
f
1. Initial State

tostart playingthegameand it also


specifiesthe positionofthe game orboard. 2
Itidentifiestheplayerwho has
2. Successor Function
Ic
player can perform. This pairs
functionreturnthat of<move, state>,where
Itdefines aset oflegal moves or actions that
state thatresults afterperforming
mov e.
'stat e'
a
repre sents the
'move'indicates a legal mov eand 3

3. TerminalTest
inal state.
Thestatewhere the game ends is
called term
Itchecks whenthe gameis over.

4. Utility Function
valuedetermines theoutcomeor result ofthe game.
It returns anumericvaluefortheterminal states.This
Q2. Listsomeapplications ofgametheory.
ModelPaper-4,Q1(
Answer: d)

Incomputerscience, gametheoryplays avitalrole.Thefollowing are someofitsapplications.

Gamesare usedto modelinteractive computations.

Game semanticsformsthe basis forseverallogicaltheories.

Gametheory is used tomodelmultiagentsystems.


Game theory is used in the developmentofonline algorithms.

Q3. Writeshortnotes onalpha-betapruning.


Answer : ModelPaper-III,Q1(c)

Alpha-betapruning is asearch algorithmthat improvestheefficiencyofminimax algorithmbyreducingthe numberof


nodestobeevaluated inthe search tree.Theminimaxprocedure explores allthe nodes ofthe search tree, whereasalpha-beta
pruning(using branch andbound techniques) ignores all those nodesthat areworsethanthe nodesevaluated so far.Asaresult,
lotofsearchingeffortis saved.Animportantcharacteristic ofalpha-betapruningis thatit returns thesame solutionasminimax
algorithmwould have returned.Moreover, itignores (prunesorcuts off)those nodes(branches)that doesnotinfluence thefinal
solution.

Q4. Define constraintsatisfaction problems.


Answer:
ModelPaper-II,Q1(
c)

TheConstraintSatisfactionProblem(CSP)can bedeseribedas asetofvariablesK,,


K..K andsetofconstraints CC
Cwhereineach andeveryvariableKoftheset consists of non-emptydomainDofvalues.Onthe
....
otherhand,each constraint
'C iscomposed ofcertain subsetof variablesand alsoprovidesvarious permissiblecombinationsofvalues that perhapste
wellsuited forsubset. Based onthe assignments ofvalues to the variables {K=VK =V....),astate oftheproblemis defined.
Anassignment is said tobeconsistent or legalwhenit does notbreakanyconstraint
s. Ifanassignmentincludeseverypossible
variable,it is saidto becomplete.
Q5. Define backtracking search.
Answer:

Backtracking searchisatype ofdepth-firstsearchwhereinasingle successorisgenerated atagiveninstanceoftimeinstead


ofall successor at atime. Every nodethat ispartially expanded hastheinformation regardingthe next consecutive successor
that istobegenerated.Dueto this, the memorycapacity is reducedfromO(bm)toO(m). Inadditionto this, backtrackingsearch
provideanothermethod ofusingmemory(time)space efficiently.Inthis methodasuccessorisgeneratedbyexplicitlymodifying
the current state description rather than copying the description.This method decreases the memoryrequirement
to onestate
descriptionandO(m)actions. However,this methodrequiresundoingeverymodificationswhenbacktrackingisdoneforgenerating
nextconsecutive successors.

WARNING:Xerox/Photocopying of thisbook isaCRIMINAL detAnyone found guilty is LIABLE toface LEGAL proceedings.
UNIT-2 ProblemSolving bySearch-IIandPropositional Logic 45

Q6. Whatare thethreelevels onwhich aknowledgebased agentis described?

Answer:
28
Model Paper-Il, Q1(d)

er Aknowledge-based agentcan bedescribed atthree levels,


-l
,Q
1. KnowledgeLevel

Knowledge levelalsoknownas epistemologicallevelisthelevelatwhichtheknowledgeisrepresented inthe moreabstract


form. Forexample, the KBatknowledgelevelmighthave asentence, Neysaloves flowers and chocolątes.
2. Logical Level

Logical level is thelevelatwhichtheknowledgeisrepresentedinthe form oflogical sentences.Thus,thesentence, Neysa


whe lovesflowers andchocolates isrepresented at the logicallevelas,loves (Neysa,
flowers,chocolates).

3. Implementation Level

Implementationlevelisthelevelatwhichthelogicalsentencesarerepresentedasphysical
sentencesbyquotingthemorby
placing1fortheirentryina3-dimensional table.Therepresentationusedat implementation level affects theagent'sperformance.
However,the representation doesnot mattertotheknowledgelevel orlogical level.

Q7. State universalelimination rule.

Answer :

Universal Elimination Rule

Universal Elimination (UE) or UniversalInstantiation (UI) rule foruniversalquantifiers statesthat auniversal sentence
can be eliminatedbyreplacing (substituting) avariable with aground term(termwithoutvariables). This is done byusing a
notationcalled substitutions. ConsiderSUBST(, B), where џis thesubstitution applied to sentence ẞ. Based onthis, UErule
canbe symbolicallyrepresentedas,
VuB
SUBSTITUTE({u/g},B)
Here,uis thevariable andgis the groundterm.

0% Example
ber
VaPlays(a, Football)can bewrittenasPlays(Ronaldo, Football)with{a/Ronaldo} assubstitution.
a-be
Describe amethod ofsolving frame problem.
resut
Q8.

nim Answer: Model Paper-III, Q1(d)


ef
i
Frameproblemcanbe solvedbywritingexplicitframeaxiomsthatindicatesthethings thatremainthesame.Forinstance,
considerthe agents movementsin thewumpusworld.Untiltheagentperformactions, the objects remainstationaryandoncethe
agentperforming actions, object starts moving. Thissituationcan berepresented as,
O
At(obj, a, stn) (obj ≠Agt) Holding(obj, stn)=At(obj, a,Res(Go(b,c),stn))

a
Frameproblemcan becategorized twotypes.Theyare,
Str
(a) Representational frameproblem

(b) Inferentialframeproblem.

SPECTRUM ALL-IN-ONEJOURNAL FORENGINEERINGSTUDENTS


TEOY
ARTIN DER
ABA T
PI I
46
UN
S WITHSOLU
TIONS !)
AY QUESTION (!i
PART-B ESS

LSEAR CH ve
2.1 ADVERSARIA mo
r
whe
ir
timal Decisi onsin Games the
2.1.1 Games,Op ga
me

Write short notes on


Games.
Q9.
don
Answer : v
mo
suchthat theiractionsare
a
toe
oragents perfor
mcertain actions or moves,
pla yer s . For mal ly,agameisdefineda
blemwh thelooser gets penalties
etw o
gameis asearch pro
er
A
ingple
testhe win ner get s poi ntsand
(iv)
hother.Whenthegame
against eacob owcom components.
asearch pr lemhavingthefoll

1. Initial State each


game orboard.
to start playingthe
game and it alsospecifiesthepositionofthe and
Itidentifiestheplayerwhohas situ
aco
2. Successor Function

urnpairs of<move, state>,


sfunctionret
wthe
that per for m.Thi min g
sasetoflega
Itdefineindi l moves oract ion s pla yercan
esentsthestatethàt results after
a perfor tha tmov e. am
'move' cates alegalmoveand'state'repr the
ba
3. TerminalTest

thegameendsis called terminal stat


e. (1
.Thestate where
Itcheckswhenthe game is over

4. Utility Function

states. This value determines the outc


ome orresult ofthe game.
It returns anumericvaluefortheterminal

awinand-1meansaloss.
Forexample, inchessthevalue0means draw, +1 means

Types ofGames

Thereare severaltypes ofgames. Someofthemare,

(i) Zero-sum and Non-Zero-sum Games

In zero-sumgames, thebenefitsofthewinningplayer isequal to the losses ofotherplayer,i.e., if wesumupthe total


benefitsofone playerand thetotal lossesofanother player,then theresultwillbezero.This means that thewinsandlossesof
playersarebalanced.Zero-sumgames are also knownas strictlycompetitive games.

Example

ScoreofA 10, Score ofB=-10[10+(-10)=


=
0]
Player 1=2,Player 2=-2[2 +(-2 )=0]

Innon-zero-sum games,thesum
oftotalbenefits andlosses ofplayers
maybegreaterorlessthanzer
oneplayermaynot
necessarilybe equal tothelosses o, i.e, the benefitsof
ofanotherplayer.
(ii) Single-Player andMultiplayerGames

Insingle-playergames, anindividu resim


ilarto
al playertriesto reachagoalbyfollowin
individual decisionproblemsandhencetheyare modele g thegame rules.Thesegamesares
dusing thetoolsavailableinthediscipline
ofdecisiontheory:
e
Amultiplayergameisonethatisplay multipl131
edbytwoormoreplayers,whereeachofthe
m
maketheirownmoves.When
agentsare involvedin aproblemthentheproblembecomesgametheoretical. Gameswherethenumberofplayersare infiniteare
calledas'n-person'games.

WARNING:Xerox/Photocopying ofthis book isaCRIMINALact.Anyonefound


gully isLIABLEto facoLEGALprocedings.
UNIT-2 Problem Solving bySearch-Il and Propo
sitional Logic 47
(iii) Perfect Information and Impe
rfect Information Q10. Whatarethe reasons to studygames?
Games
Answer :
In perfect information games, all players kno
w the
movespreviously mad ebyother players. Forexample Gamesareadversarialsearchproblemswhereinmultiple
wherebothplayers canseethe piece chess,
s ontheboard including agents are present such that their goals are in conflict with
their moves,atalltimes.Otherexamp each other. Game theory is the branch of mathematies that
les-ofperfectinformation
gamesare GO, Macala andArimaa. has its applications in several branches ofsocial sciences like
economics, biology, engineering, philosophy, international
Imperfectinformationgamesarethosewherethe relations, political science aswellasincomputer science.
players
donot have the complete information abouttheir
opponent's
moves.Bridgeis onesuchgamewhereallcards Gamesareusedto capture andrepresentthebehavior of
arenotvisible
to each other.
strategic situations. Byapplyingprinciplesofgametheory to
thesesituationsonecananalyzetheproblem, selectappropriate
(iv) Cooperative orNon-cooperative Games choices(moves)andachieve success.

In cooperative games, players can communicate


with. Incomputerscience,gametheoryplays avital role.The
eachother.Moreover,theplayers are allowedto form following are someofits applications.
bindings
and play together. Cooperative games
can model the game
situations to thefinestdetails,takegooddecisions and Gamesareusedtomodel interactive computations.
produce
accurateresults.
Game semantics formsthe basis for several logical
theories.
In non-cooperative games, bindings are not
allowed
amongtheplayers andeventhereis nocommunicationbetween
Gametheory is usedtomodel multiagentsystems.
the players.Anothertype ofgamecalled hybrid gamecontains
bothcooperativeandnon-cooperative elements. Gametheory is used inthe development of online
algorithms.
(v) Discrete and Continuous Games
Gametheory is extensivelyused inthefield ofartificial
Discrete gamesarethosethat have afinite numberof intelligence. Theabstract nature ofgamesmakesit interesting
players, moves,events, outcomes etc. Mostofthegametheory subjectforstudy.Artificial intelligence researcherstudygames
isconcerned with discretegamesandit is usedto extendmany because ofthe twoimportant reasons given below.
concepts. In continuous games,the players choose astrategy
1. Gamesprovide aneasywayto represent different states
fromaset ofcontinuous strategiesandfollowsthe samestrategy
during the game. Examples ofcontinuous games include and agents. Moreover, they provide structured task
whereinwecanmeasure success orfailure easily.
Evasiongame, Continuouspursuit etc.
2. Theagents in the gameare allowedtoperform alimited
(vi) SimultaneousandSequential Games
(finite) number of actions whose result is defined by
In simultaneous games, both players move at the same precise rules. Games do notrequire large amounts of
time. Otherwise, ifthey move at different times then the knowledge.Theycanbesolvedbysearchinga pathfrom
moves performed by first player is hidden from the second
initial state to winning state.
player, thereby makingthemvirtually simultaneous. Usually, Additionally,gamessimulatetherealworldscenarioand
simultaneous games are represented usingnormal forms. In henceartificialintelligencecanmakeuseofgameprinciples'to
sequential games(alsocalled asdynamic games),the players solve real world problems.
play one after the other, i.e., the second player has some
knowledgeabout the movesoffirst player. Sequential games Q11. Drawand explain the search treeforthe game
areusuallyrepresented throughextensive forms.
ofTic-tac-toe.

(vii) SymmetricandAsymmetricGames Answer :

Insymmetricgames,the payoffforplaying aparticular 'Tic-tac-toe' also knownas 'Noughts and crosses' is a


gameinwhichtwoplayerstaketurntowrite X'sandO'sin aset
strategy doesnotdependonwhois playingratherit dependson
otherstrategies thatareemployed.Inotherwords,insymmetric ofninesquares. Thefirst playertowritethree X'sorthreeO's
games,theplayer's identities canbechangedwithoutchanging
inaparticularrow, columnordiagonal willwinthe game.
the payoff to the strategies. Examples ofsymmetric games Ο XX
include'Theprisoner's dilemma'.'Thestag hunt'etc. Usually, X Player 'Max
X 이
=

2x2games are symmetric, Inasymmetricgames,the strategies O=Player'Min'(winner)


ofboth the players are not same. Examples ofsuch games 이
include 'The ultimatum', The dictator'etc,where eachplayer
has differentst Figure (1): AnExampleofTic-tac-toe
rategies.

AD.SPECTRUMALL-IN-ONEJOURNALFORENGINEERINGSTUDENTS
ARTIFICIALINTELLIGENCE [JNTU-HYDE
IN
RABAD]
N
48
10
A
andallthe possible(legal)successivemovesofeachplayercann be
thegameand
search tree defines the initial state of 30
follows,
nas
drawnthepartialgametreeoftictoc toecanbe show

#(Initial state)

PlayerMax(X)

Playermin
(Ο)
##
Playermax Algo
(X)
………

Step

XIOX Step
(Terminal state)
OIXIO
+1 -1 0
(Utility value)
Step
Figure(2): Partial SearchTreeforTic-tac-toe Game

Theplayers 'max'and 'min'play alternately byplacing X's and O's


respectively,untiltheterminal state is reached. The
Step
terminal state is detected whenanyoneofthefollowing eventoccurs.

Allthesquares are filled. (i)

Anyoneplayerhassuccessfullyplacedthree X'sorO'sinarow/column/diagonal.
(ii)
Afterreachingterminal state,theutility function calculatestheutilityvalue.Inthefigure (2),the utilityvaluesofdifferent
nodesare shown.Highutilityvalues aregoodforplayer'max'andbad forplayer'min'.Similarly, lowutility valuesaregoodfor
player 'min'and badforplayer 'max'.Theleafnodes(terminal states) withutilityvalue 0(zero)represents atie (matchdraw).
Theplayerscan determinethebestmovebysearchingthegametree.

Q12. Explainminimaxprocedurefor gameplaying.


Answer:

Theminimaxprocedureis arecursiveprocedurethat finds anoptimal strategywhichleads toawinstate inagivengane


tree.Theminimaxproceduretakes threeparameters,aboardposition'Pos',thecurrent depthofthesearch 'Depth' andtheplaye
to move'P-name'.Thereturn value ofminimaxprocedure isastructurecontainingtwocomponents, onone theback
upvalueofte
path thatminimaxchoosesand theother the path itselffunctions VAL()and PATH() areusedtoseparatethesetwocompoen
from thereturn value.

Additionally, theminimaxprocedureusesthefollowing functions. Step


1. GENERATOR(Pos, P_name)

It is the movegenerator function that generates all possible movesthat player 'P_name' can performfrom the positioa
'Pos'.It returns alistofnodesrepresentingthepossible moves
. Sol
2. EVAL-FUNC(Pos, P_name)
gam
It is the static evaluation functionthatdetermines howpromisingaposition 'Pos'isforthe player'P_name".Itreturnsa
numberthatrepresents thepromisingvalue. ‫ו‬

WARNING:Xerox/Photocopying of this bookis aCRIMINAE aict.Anyonefound guilty isLABLE toface LEGALproceedings


UNIT-2 Problem Solving
bySearch -llandPropositional Logic 49
3. SUFFICIENT DEPT
H(Pos, Depth)
-

This function determines whether the recursion should besto


(Since, minimaxprocedure is a ppedat the position 'Pos' given the dep
recursive procedure, it should th limit 'Depth'.
recursion). This function haveamechanismthat determ
takes intoconsiderationthe ineswhenit shouldstop the
following factorstotakethis dec
Hasanyoneplayer
ision.
wonthegame.
Thenumberofpl
ythat havebeenexplor
ed.
* Th
epromising val ue ofthepath.
Thetimethat is lef
tto completethe game
.
Thestabilityofconfig
uration.
ThefunctionSUFFICIENT
-DEPTHreturns TRUEif
recursive search hastobe sto
Algorithm pped otherwise aFALSE.
Minimax-procedure (Po
s, Depth, P_name)
Step1:IfSUFFICIENT-DEP
TH(Pos,Depth)is TRUE
,then returnthe structure wit
h its,
Value=EVAL-FUNC(Po
s, P_name) and
Path=Null.
Inthis step, it isverifi
ed ifsufficient numberof
calledto calculatethepro ply areexploredandifso,
misingvalueat thepositi call staticevaluationfuncti
on 'Pos'.Thevariable path onEVAL-FUNC()is
is initialized tonull.
Step2:IfSUFFICIENT-DEPTH(Po
s, Depth)is FALSEthenwecallfun
plyofthe game tree.TheGENE ctionGENERATOR(Pos,P_n
RATOR() functionreturnsalistof ame)to generateonemore
nodes,weassignthislisttoaset nam
i.e.,SUCCESSORS =GE edSUCCESSORS.
NERATOR(Pos,P-name)
Step3:IfSUCCESSORSis anemp
tyset,then it meansthere
step 1. arenomore moves.
Therefore,wereturn thesamestru
ctur e asin

Step4:IfSUCCESSORSsetcontains
nodes,then examine eachnode andkee
doneasfollows: ptrackofthe most promising one,whi
chcanbe
(i) Initialize the variable 'Promisin
g-score'to minimumvalue that functi
updatedinthe later steps. onEVAL-FUNC()canreturn.Thi
svariable will be
(ii) Foreachnode'N'present inSUCCES
SORSset,perform the steps (a)through
(c)
(a) RES-SUCCESSOR Minimax-Procedure
=
(N, Depth +1, opposite playe r'sname)
This is arecursive callthatwill perform
thefurtherexplorationofsuccessor node
N.
(b) Assign, New-Value =- VALUE(RES - SUCCESSOR)
Thevariable ‘New-value'will, now
contain theadvantage (or meri
t) ofposition from theperspective of
player forthe nextlower level. opposite
(c) IfNew-Value>Promising-score,thenit meansthata
thenodesexaminedtill now.Thissuccessor
successor node is discovered (or position)that is better than
node is examinedasfollows.
Promising-score = New-Value
Promising-Path =PATH(RES-SUCCESSOR)+Node'N'

Step5:Atthispoint all the successornodes ofthe game tree are examined. Therefore,
wewillreturn the structure with its
componentsas,

Value =Promising-Score
Path =Promising-Path.
SolvingTic-tac-toe Usin
gMinimaxSearch

Drawing
andanalyzingthecompletegametreeofTic-tac-toegameis
gametree asshow
ninfigure.
quitecomplex.Therefore,wewillconsideratrivial

3SPECTRUMALL-IN-ONEJOURNALFORENGINEERINGSTUDENTS

You might also like