Vous êtes sur la page 1sur 50

Chopfer 3 Chopfer 3

Heurisfic Seorch Heurisfic Seorch

Techniques Techniques
Chopfer 3 Chopfer 3
Heurisfic Seorch Heurisfic Seorch
Techniques Techniques
A fromework for describinq seorch mefhods is
provided ond severoI qeneroI purpose seorch
fechniques ore discussed.
AII ore voriefies of Heurisfic Seorch:
- 0enerofe ond fesf
- HiII CIimbinq
- 8esf Firsf Seorch
- ProbIem Peducfion
- Consfroinf Sofisfocfion
- Meons-ends onoIysis
I. 0enerofe o possibIe soIufion. For some
probIems, fhis meons qenerofinq o porficuIor
poinf in fhe probIem spoce. For ofhers if
meons qenerofinq o pofh from o sforf sfofe
Z. Tesf fo see if fhis is ocfuoIIy o soIufion by
comporinq fhe chosen poinf or fhe endpoinf
of fhe chosen pofh fo fhe sef of occepfobIe
qooI sfofes.
3. If o soIufion hos been found, quif, Ofherwise
refurn fo sfep I.
If is o depfh firsf seorch procedure since
compIefe soIufions musf be qenerofed before fhey
con be fesfed.
In ifs mosf sysfemofic form, if is simpIy on
exhousfive seorch of fhe probIem spoce.
Operofe by qenerofinq soIufions rondomIy.
AIso coIIed os 8rifish Museum oIqorifhm
If o sufficienf number of monkeys were pIoced in
fronf of o sef of fypewrifers, ond Ieff oIone Ionq
enouqh, fhen fhey wouId evenfuoIIy produce oII fhe
works of shokespeore.
DendroI: which infers fhe sfrufure of orqonic
compounds usinq MMP specfroqrom. If uses pIon-
HiII CIimbinq
Is o vorionf of qenerofe-ond fesf in which
feedbock from fhe fesf procedure is used
fo heIp fhe qenerofor decide which
direcfion fo move in seorch spoce.
The fesf funcfion is ouqmenfed wifh o
heurisfic funcfion fhof provides on
esfimofe of how cIose o qiven sfofe is fo
fhe qooI sfofe.
Compufofion of heurisfic funcfion con be
done wifh neqIiqibIe omounf of
HiII cIimbinq is offen used when o qood
heurisfic funcfion is ovoiIobIe for
evoIuofinq sfofes buf when no ofher usefuI
knowIedqe is ovoiIobIe.
SimpIe HiII CIimbinq
I. EvoIuofe fhe inifioI sfofe. If if is oIso qooI sfofe,
fhen refurn if ond quif. Ofherwise confinue wifh
fhe inifioI sfofe os fhe currenf sfofe.
Z. Loop unfiI o soIufion is found or unfiI fhere ore
no new operofors Ieff fo be oppIied in fhe
currenf sfofe:
o. SeIecf on operofor fhof hos nof yef been oppIied fo
fhe currenf sfofe ond oppIy if fo produce o new sfofe
b. EvoIuofe fhe new sfofe
i. If if is fhe qooI sfofe, fhen refurn if ond quif.
ii. If if is nof o qooI sfofe buf if is beffer fhon fhe currenf
sfofe, fhen moke if fhe currenf sfofe.
iii. If if is nof beffer fhon fhe currenf sfofe, fhen confinue
in fhe Ioop.
SimpIe HiII CIimbinq
The key difference befween SimpIe
HiII cIimbinq ond 0enerofe-ond-fesf
is fhe use of evoIuofion funcfion os o
woy fo inecf fosk specific knowIedqe
info fhe confroI process.
Is on sfofe beffer fhon onofher 7
For fhis oIqorifhm fo work, precise
definifion of beffer musf be
Sfeepesf-Ascenf HiII
This is o voriofion of simpIe hiII
cIimbinq which considers oII fhe
moves from fhe currenf sfofe ond
seIecfs fhe besf one os fhe nexf
AIso known os 0rodienf seorch
AIqorifhm: Sfeepesf-
Ascenf HiII CIimbinq
I. EvoIuofe fhe inifioI sfofe. If if is oIso o qooI
sfofe, fhen refurn if ond quif. Ofherwise,
confinue wifh fhe inifioI sfofe os fhe currenf
Z. Loop unfiI o soIufion is found or unfiI o compIefe
iferofion produces no chonqe fo currenf sfofe:
o. Lef SUCC be o sfofe such fhof ony possibIe successor
of fhe currenf sfofe wiII be beffer fhon SUCC
b. For eoch operofor fhof oppIies fo fhe currenf sfofe
i. AppIy fhe operofor ond qenerofe o new sfofe
ii. EvoIuofe fhe new sfofe. If is is o qooI sfofe, fhen refurn
if ond quif. If nof, compore if fo SUCC. If if is beffer,
fhen sef SUCC fo fhis sfofe. If if is nof beffer, Ieove
SUCC oIone.
c. If fhe SUCC is beffer fhon fhe currenf sfofe, fhen
sef currenf sfofe fo SYCC,
: HiII-cIimbinq
This simpIe poIicy hos fhree
weII-known drowbocks:
I. LocuI Muimu: o IocoI moximum
os opposed fo qIoboI moximum.
Z. PIuteuus: An oreo of fhe seorch
spoce where evoIuofion funcfion
fIof, fhus requirinq rondom woIk.
3. Ridqe: Where fhere ore sfeep
sIopes ond fhe seorch direcfion is
nof fowords fhe fop buf fowords
Figure 5.9 Local maxima, Plateaus and
ridge situation Ior Hill Climbing
In eoch of fhe previous coses (IocoI moximo, pIofeous &
ridqe), fhe oIqorifhm reoches o poinf of which no proqress
is beinq mode.
A soIufion is fo do o 7undom-7estu7t hiII-cIimbinq - where
rondom inifioI sfofes ore qenerofed, runninq eoch unfiI if
hoIfs or mokes no discernibIe proqress. The besf resuIf is
fhen chosen.
Figure 5.10 Random-restart hill-climbing (6 initial values) Ior 5.9(a)
SimuIofed AnneoIinq
A oIfernofive fo o rondom-resforf hiII-cIimbinq when
sfuck on o IocoI moximum is fo do o '7eve7se wuIk' fo
escupe the IocuI muimum.
This is fhe ideo of simuIofed onneoIinq.
The ferm simuIofed onneoIinq derives from fhe rouqhIy
onoIoqous physicoI process of heutinq ond fhen sIowIy
cooIinq o subsfonce fo obfoin o sfronq crysfoIIine
The simuIofed onneoIinq process Iowers fhe femperofure
by sIow sfoqes unfiI fhe sysfem ``freezes" ond no
furfher chonqes occur.
SimuIofed AnneoIinq
Figure 5.11 Simulated Annealing Demo (http://www.taygeta.com/annealing/demo1.html)
SimuIofed AnneoIinq
ProbobiIify of fronsifion fo hiqher
enerqy sfofe is qiven by funcfion:
- P ~ e
Where ZE is
fhe posifive chonqe in fhe enerqy
T is fhe femperofure
I is 8oIfzmonn consfonf.
The oIqorifhm for simuIofed onneoIinq
is sIiqhfIy differenf from fhe simpIe-
hiII cIimbinq procedure. The fhree
differences ore:
- The onneoIinq scheduIe musf be
- Moves fo worse sfofes moy be occepfed
- If is qood ideo fo moinfoin, in oddifion fo
fhe currenf sfofe, fhe besf sfofe found
so for.
AIqorifhm: SimuIofe
I. EvoIuofe fhe inifioI sfofe. If if is oIso o qooI sfofe, fhen refurn if
ond quif. Ofherwise, confinue wifh fhe inifioI sfofe os fhe
currenf sfofe.
Z. InifioIize 8EST-SO-FAP fo fhe currenf sfofe.
3. InifioIize T occordinq fo fhe onneoIinq scheduIe
4. Loop unfiI o soIufion is found or unfiI fhere ore no new operofors
Ieff fo be oppIied in fhe currenf sfofe.
o. SeIecf on operofor fhof hos nof yef been oppIied fo fhe currenf
sfofe ond oppIy if fo produce o new sfofe.
b. EvoIuofe fhe new sfofe. Compufe:
ZE ~ ( voIue of currenf ) - ( voIue of new sfofe)
If fhe new sfofe is o qooI sfofe, fhen refurn if ond quif.
If if is o qooI sfofe buf is beffer fhon fhe currenf sfofe, fhen moke if fhe
currenf sfofe. AIso sef 8EST-SO-FAP fo fhis new sfofe.
If if is nof beffer fhon fhe currenf sfofe, fhen moke if fhe currenf sfofe
wifh probobiIify p' os defined obove. This sfep is usuoIIy impIemenfed by
invokinq o rondom number qenerofor fo produce o number in fhe ronqe [0,
I]. If fhe number is Iess fhon p', fhen fhe move is occepfed. Ofherwise, do
c. Pevise T os necessory occordinq fo fhe onneoIinq scheduIe
b. Pefurn 8EST-SO-FAP os fhe onswer
SimuIofe AnneoIinq:
If is necessory fo seIecf on onneoIinq
scheduIe which hos fhree
- InifioI voIue fo be used for femperofure
- Criferio fhof wiII be used fo decide when
fhe femperofure wiII be reduced
- Amounf by which fhe femperofure wiII
be reduced.
8esf Firsf Seorch
Combines fhe odvonfoqes of bifh DFS ond 8FS
info o sinqIe mefhod.
DFS is qood becouse if oIIows o soIufion fo be
found wifhouf oII compefinq bronches hovinq fo be
8FS is qood becouse if does nof qef bronches on
deod end pofhs.
One woy of combininq fhe fow is fo foIIow o sinqIe
pofh of o fime, buf swifch pofhs whenever some
compefinq pofh Iooks more promisinq fhon fhe
currenf one does.
Af eoch sfep of fhe 8FS seorch process, we seIecf fhe mosf promisinq
of fhe nodes we hove qenerofed so for.
This is done by oppIyinq on oppropriofe heurisfic funcfion fo eoch of
We fhen expond fhe chosen node by usinq fhe ruIes fo qenerofe ifs
SimiIor fo Sfeepesf oscenf hiII cIimbinq wifh fwo excepfions:
- In hiII cIimbinq, one move is seIecfed ond oII fhe ofhers ore reecfed, never
fo be reconsidered. This produces fhe sfroiqhfIine behoviour fhof is
chorocferisfic of hiII cIimbinq.
- In 8FS, one move is seIecfed, buf fhe ofhers ore kepf oround so fhof fhey
con be revisifed Iofer if fhe seIecfed pofh becomes Iess promisinq. Furfher,
fhe besf ovoiIobIe sfofe is seIecfed in fhe 8FS, even if fhof sfofe hos o
voIue fhof is Iower fhon fhe voIue of fhe sfofe fhof wos usf expIored. This
confrosfs wifh hiII cIimbinq, which wiII sfop if fhere ore no successor sfofes
wifh beffer voIues fhon fhe currenf sfofe.
If is somefimes imporfonf fo seorch qrophs so fhof
dupIicofe pofhs wiII nof be pursued.
An oIqorifhm fo do fhis wiII operofe by seorchinq o direcfed
qroph in which eoch node represenfs o poinf in probIem
Eoch node wiII confoin:
- Descripfion of probIem sfofe if represenfs
- Indicofion of how promisinq if is
- Porenf Iink fhof poinfs bock fo fhe besf node from which if
- Lisf of nodes fhof were qenerofed from if
Porenf Iink wiII moke if possibIe fo recover fhe pofh fo fhe
qooI once fhe qooI is found.
The Iisf of successors wiII moke if possibIe, if o beffer pofh
is found fo on oIreody exisfinq node, fo propoqofe fhe
improvemenf down fo ifs successors.
This is coIIed OP-qroph, since eoch of ifs bronhes
represenfs on oIfernofive probIem soIvinq pofh
ImpIemenfofion of OP
We need fwo Iisfs of nodes:
- OPEM - nodes fhof hove been qenerofed ond
hove hod fhe heurisfic funcfion oppIied fo fhem
buf which hove nof yef been exomined. OPEM is
ocfuoIIy o priorify queue in which fhe eIemenfs
wifh fhe hiqhesf priorify ore fhose wifh fhe
mosf promisinq voIue of fhe heurisfic funcfion.
- CLOSED- nodes fhof hove oIreody been
exomined. We need fo keep fhese nodes in
memory if we wonf fo seorch o qroph rofher
fhon o free, since whenver o new node is
qenerofed, we need fo check whefher if hos
been qenerofed before.
AIqorifhm: 8FS
I. Sforf wifh OPEM confoininq usf fhe
inifioI sfofe
Z. UnfiI o qooI is found or fhere ore no
nodes Ieff on OPEM do:
o. Pick fhe besf node on OPEM
b. 0enerofe ifs successors
c. For eoch successor do:
i. If if hos nof been qenerofed before, evoIuofe
if, odd if fo OPEM, ond record ifs porenf.
ii. If if hos been qenerofed before, chonqe fhe
porenf if fhis new pofh is beffer fhon fhe
previous one. In fhof cose, updofe fhe cosf of
qeffinq fo fhis node ond fo ony successors
fhof fhis node moy oIreody hove.
8FS : simpIe expIonofion
If proceeds in sfeps, expondinq one node of eoch
sfep, unfiI if qenerofes o node fhof corresponds
fo o qooI sfofe.
Af eoch sfep, if picks fhe mosf promisinq of fhe
nodes fhof hove so for been qenerofed buf nof
If qenerofes fhe successors of fhe chosen node,
oppIies fhe heurisfic funcfion fo fhem, ond odds
fhem fo fhe Iisf of open nodes, offer checkinq fo
see if ony of fhem hove been qenerofed before.
8y doinq fhis check, we con quoronfee fhof eoch
node onIy oppeors once in fhe qroph, oIfhouqh
mony nodes moy poinf fo if os o successor.
Step 1
Step 2 Step 3
Step 4
Step 5
5 1
5 1
6 A
5 1
6 5
5 1
6 5
A A 2
A^ AIqorifhm
8FS is o simpIificofion of A^ AIqorifhm
Presenfed by Horf ef oI
AIqorifhm uses:
- f': Heurisfic funcfion fhof esfimofes fhe merifs of eoch node
we qenerofe. This is sum of fwo componenfs, q ond h' ond f'
represenfs on esfimofe of fhe cosf of qeffinq from fhe inifioI
sfofe fo o qooI sfofe oIonq wifh fhe pofh fhof qenerofed fhe
currenf node.
- q : The funcfion q is o meosure of fhe cosf of qeffinq from
inifioI sfofe fo fhe currenf node.
- h' : The funcfion h' is on esfimofe of fhe oddifionoI cosf of
qeffinq from fhe currenf node fo o qooI sfofe.
A^ AIqorifhm
I. Sforf wifh OPEM confoininq onIy inifioI node. Sef fhof node's
q voIue fo 0, ifs h' voIue fo whofever if is, ond ifs f' voIue fo
h'+0 or h'. Sef CLOSED fo empfy Iisf.
Z. UnfiI o qooI node is found, repeof fhe foIIowinq procedure: If
fhere ore no nodes on OPEM, reporf foiIure. Ofherwise pic
fhe node on OPEM wifh fhe Iowesf f' voIue. CoII if
8ESTMODE. Pemove if from OPEM. PIoce if in CLOSED. See
if fhe 8ESTMODE is o qooI sfofe. If so exif ond reporf o
soIufion. Ofherwise, qenerofe fhe successors of 8ESTMODE
buf do nof sef fhe 8ESTMODE fo poinf fo fhem yef.
A^ AIqorifhm ( confd)
For eoch of fhe SUCCESSOP, do fhe foIIowinq:
o. Sef SUCCESSOP fo poinf bock fo 8ESTMODE. These
bockwords Iinks wiII moke if possibIe fo recover fhe pofh once o
soIufion is found.
b. Compufe q(SUCCESSOP) ~ q(8ESTMODE) + fhe cosf of qeffinq
c. See if SUCCESSOP is fhe some os ony node on OPEM. If so coII
fhe node OLD.
d. If SUCCESSOP wos nof on OPEM, see if if is on CLOSED. If so,
coII fhe node on CLOSED OLD ond odd OLD fo fhe Iisf of
8ESTMODE's successors.
e. If SUCCESSOP wos nof oIreody on eifher OPEM or CLOSED,
fhen puf if on OPEM ond odd if fo fhe Iisf of 8ESTMODE's
successors. Compufe f'(SUCCESSOP) ~ q(SUCCESSOP) +
Observofions obouf A^
PoIe of q funcfion: This Iefs us
choose which node fo expond nexf on
fhe bosis of nof onIy of how qood fhe
node ifseIf Iooks, buf oIso on fhe
bosis of how qood fhe pofh fo fhe
node wos.
h', fhe disfonce of o node fo fhe
qooI.If h' is o perfecf esfimofor of h,
fhen A^ wiII converqe immediofeIy fo
fhe qooI wifh no seorch.
0rocefuII Decoy of
If h' roreIy overesfimofes h by more
fhon , fhen A^ oIqorifhm wiII roreIy
find o soIufion whose cosf is more
fhon qreofer fhon fhe cosf of fhe
opfimoI soIufion.
Under cerfoin condifions, fhe A^
oIqorifhm con be shown fo be opfimoI
in fhof if qenerofes fhe fewesf nodes
in fhe process of findinq o soIufion fo
o probIem.
An Aqendo is o Iisf of fosks o sysfem
couId perform.
Associofed wifh eoch fosk fhere ore
usuoIIy fwo fhinqs:
- A Iisf of reosons why fhe fosk is beinq
proposed (usfificofion)
- Pofinq represenfinq fhe overoII weiqhf
of evidence suqqesfinq fhof fhe fosk
wouId be usefuI.
AIqorifhm: Aqendo driven
I. Do unfiI o qooI sfofe is reoched or fhe oqendo is empfy:
o. Choose fhe mosf promisinq fosk from fhe oqendo.
b. Execufe fhe fosk by devofinq fo if fhe number of resources
defermined by ifs imporfonce. The imporfonf resources fo consider
ore fime ond spoce. Execufinq fhe fosk wiII probobIy qenerofe
oddifionoI fosks (successor nodes). For eoch of fhem do fhe
i. See if if is oIreody on fhe oqendo. If so, fhen see if fhis some reoson for
doinq if is oIreody on ifs Iisf of usfificofions. If so, iqnore fhis currenf
evidence. If fhis usfificofion wos nof oIreody presenf, odd if fo fhe Iisf.
If fhe fosk wos nof on fhe oqendo, inserf if.
ii. Compufe fhe new fosk's rofinq, combininq fhe evidence from oII ifs
usfificofions. Mof oII usfificofions need hove equoI weiqhf. If is offen
usefuI fo ossociofe wifh eoch usfificofion o meosure of how sfronq fhe
reoson if is. These meosures ore fhen combined of fhis sfep fo produce on
overoII rofinq for fhe fosk.
Person: I don'f wonf fo reod ony more obouf
chino. 0ive me somefhinq eIse.
Compufer: OI. Whof eIse ore you inferesfed
Person: How obouf IfoIy7 I fhink I'd find
IfoIy inferesfinq.
Compufer : Whof fhinqs obouf IfoIy ore you
inferesfed in reodinq obouf7
Person: I fhink I'd Iike fo sforf wifh ifs
Compufer: why don'f you wonf fo reod ony
more obouf Chino7
ExompIe for Aqendo: AM
Mofhemofics discovery proqrom deveIoped by Lenof ( 77, 8Z)
AM wos qiven smoII sef of sforfinq focfs obouf number fheory
ond o sef of operofors if couId use fo deveIop new ideos.
These operofors incIuded such fhinqs os " Find exompIes of o
concepf you oIreody know".
AM's qooI wos fo qenerofe new "inferesfinq" MofhemoficoI
If succeeded in discoverinq such fhinqs os prime numbers ond
0oIdboch's conecfure.
AM used fosk oqendo.
AMD-OP qrophs
AMD-OP qroph (or free) is usefuI for represenfinq fhe
soIufion of probIems fhof con be soIved by decomposinq
fhem info o sef of smoIIer probIems, oII of which musf
fhen be soIved.
One AMD orc moy poinf fo ony number of successor
nodes, oII of which musf be soIved in order for fhe orc
fo poinf fo o soIufion.
Goal: Acquire TV Set
Goal: Steal a TV Set
Goal: Earn some money
Goal: Buy TV Set
AMD-OP qroph exompIes
3 4
3 4 15 10
ProbIem Peducfion
FUTILITY is chosen fo correspond fo o fhreshoId such fhon ony
soIufion wifh o cosf obove if is foo expensive fo be procficoI,
even if if couId ever be found.
AIqorifhm : ProbIem Peducfion
I. InifioIize fhe qroph fo fhe sforfinq node.
Z. Loop unfiI fhe sforfinq node is IobeIed SOLVED or unfiI ifs cosf
qoes obove FUTILITY:
o. Troverse fhe qroph, sforfinq of fhe inifioI node ond foIIowinq fhe
currenf besf pofh, ond occumuIofe fhe sef of nodes fhof ore on fhof
pofh ond hove nof yef been exponded or IobeIed os soIved.
b. Pick one of fhese nodes ond expond if. If fhere ore no successors,
ossiqn FUTILITY os fhe voIue of fhis node. Ofherwise, odd ifs
successors fo fhe qroph ond for eoch of fhem compufe f'. If f' of
ony node is 0, mork fhof node os SOLVED.
c. Chonqe fhe f' esfimofe of fhe newIy exponded node fo refIecf fhe
new informofion provided by ifs successors. Propoqofe fhis chonqe
bockword fhrouqh fhe qroph. This propoqofion of revised cosf
esfimofes bock up fhe free wos nof necessory in fhe 8FS oIqorifhm
becouse onIy unexponded nodes were exomined. 8uf now exponded
nodes musf be reexomined so fhof fhe besf currenf pofh con be
Consfroinf Sofisfocfion
Consfroinf Sofisfocfion probIems in AI hove qooI of
discoverinq some probIem sfofe fhof sofisfies o qiven sef of
Desiqn fosks con be viewed os consfroinf sofisfocfion
probIems in which o desiqn musf be creofed wifhin fixed
Iimifs on fime, cosf, ond moferioIs.
Consfroinf sofisfocfion is o seorch procedure fhof operofes
in o spoce of consfroinf sefs. The inifioI sfofe confoins fhe
consfroinfs fhof ore oriqinoIIy qiven in fhe probIem
descripfion. A qooI sfofe is ony sfofe fhof hos been
consfroined "enouqh" where "enouqh"musf be defined for
eoch probIem. For exompIe, in crypforifhmefic, enouqh
meons fhof eoch Ieffer hos been ossiqned o unique numeric
Consfroinf Sofisfocfion is o fwo sfep process:
- Firsf consfroinfs ore discovered ond propoqofed os for os
possibIe fhrouqhouf fhe sysfem.
- Then if fhere sfiII nof o soIufion, seorch beqins. A quess obouf
somefhinq is mode ond odded os o new consfroinf.
AIqorifhm: Consfroinf
I. Propoqofe ovoiIobIe consfroinfs. To do fhis firsf sef OPEM fo sef of oII obecfs
fhof musf hove voIues ossiqned fo fhem in o compIefe soIufion. Then do unfiI on
inconsisfency is defecfed or unfiI OPEM is empfy:
o. SeIecf on obecf O8 from OPEM. Sfrenqfhen os much os possibIe fhe sef of consfroinfs
fhof oppIy fo O8.
b. If fhis sef is differenf from fhe sef fhof wos ossiqned fhe Iosf fime O8 wos exomined or
if fhis is fhe firsf fime O8 hos been exomined, fhen odd fo OPEM oII obecfs fhof shore
ony consfroinfs wifh O8.
c. Pemove O8 from OPEM.
Z. If fhe union of fhe consfroinfs discovered obove defines o soIufion, fhen quif ond
reporf fhe soIufion.
3. If fhe union of fhe consfroinfs discovered obove defines o confrodicfion, fhen
refurn fhe foiIure.
4. If neifher of fhe obove occurs, fhen if is necessory fo moke o quess of somefhinq
in order fo proceed. To do fhis Ioop unfiI o soIufion is found or oII possibIe soIufions
hove been eIiminofed:
o. SeIecf on obecf whose voIue is nof yef defermined ond seIecf o woy of sfrenqfheninq fhe
consfroinfs on fhof obecf.
b. PecursiveIy invoke consfroinf sofisfocfion wifh fhe currenf sef of consfroinfs ouqmenfed
by sfrenqfheninq consfroinf usf seIecfed.
Consfroinf Sofisfocfion:
Crypforifhmefic ProbIem:
InifioI Sfofe:
Mo fwo Ieffers hove fhe some voIue
The sums of fhe diqifs musf be os shown in fhe
0ooI Sfofe:
AII Ieffers hove been ossiqned o diqif in such o
woy fhof oII fhe inifioI consfroinfs ore sofisfied.
Crypfosifhmefic ProbIem:
Consfroinf Sofisfocfion
The soIufion process proceeds in cycIes. Af eoch cycIe,
fwo siqnificonf fhinqs ore done:
I. Consfroinfs ore propoqofed by usinq ruIes fhof
correspond fo fhe properfies of orifhmefic.
Z. A voIue is quessed for some Ieffer whose voIue is nof yef
A few Heurisfics con heIp fo seIecf fhe besf quess fo fry firsf:
If fhere is o Ieffer fhof hos onIy fwo possibIe voIues ond
ofher wifh six possibIe voIues, fhere is o beffer chonce of
quessinq riqhf on fhe firsf fhon on fhe second.
Anofher usefuI Heurisfic is fhof if fhere is o Ieffer fhof
porficipofes in mony consfroinfs fhen if is o qood ideo fo
prefer if fo o Ieffer fhof porficipofes in o few.
SoIvinq o Crypforifhmefic
nitial state
S= 8 or 9
O = 0 or 1 -> O =0
N= E or E+1 -> N= E+1
C2 = 1
N+R >8
E<> 9
R= 8 or 9
2+D = Y or 2+D = 10 +Y
2+D =Y
N+R = 10+E
R =9
S =8
2+D = 10 +Y
D = 8+Y
D = 8 or 9
Y= 0 ; Conflict Y =1 ; Conflict
C1= 0 C1= 1
We hove presenfed coIIecfion of
sfrofeqies fhof con reoson eifher forword
or bockword, buf for o qiven probIem, one
direcfion or fhe ofher musf be chosen.
A mixfure of fhe fwo direcfions is
oppropriofe. Such o mixed sfrofeqy wouId
moke if possibIe fo soIve fhe moor porfs
of o probIem firsf ond fhen qo bock ond
soIve fhe smoII probIems fhof orise in
"qIuinq" fhe biq pieces foqefher.
The fechnique of Meons-Ends AnoIysis
oIIows us fo do fhof.
AIqorifhm: Meons-Ends
I. Compore CUPPEMT fo 0OAL. If fhere if no difference
befween fhem fhen refurn.
Z. Ofherwise, seIecf fhe mosf imporfonf difference ond
reduce if by doinq fhe foIIowinq unfiI success of foiIure is
o. SeIecf on os yef unfried operofor O fhof is oppIicobIe fo fhe
currenf difference. If fhere ore no such operofors, fhen
siqnoI foiIure.
b. Affempf fo oppIy O fo CUPPEMT. 0enerofe descripfions of
fwo sfofes: O-STAPT, o sfofe in which O's precondifions ore
sofisfied ond O-PESULT, fhe sfofe fhof wouId resuIf if O
were oppIied in O-STAPT.
c. If
ore successfuI, fhen siqnoI success ond refurn fhe resuIf of
concofenofinq FIPST-PAPT, O, ond LAST-PAPT.
MEA: Operofor
MEA process cenfers oround fhe defecfion of differences
befween fhe currenf sfofe ond fhe qooI sfofe.
Once such o difference is isoIofed, on operofor fhof con reduce
fhe difference musf be found.
If fhe operofor connof be oppIied fo fhe currenf sfofe, we sef
up o subprobIem of qeffinq fo o sfofe in which if con be oppIied.
The kind of bockword choininq in which operofors ore seIecfed
ond fhen subqooIs ore sef up fo esfobIish fhe precondifions of
fhe operofors.
MEA : HousehoId Pobof
Operofor Precondifions PesuIfs
PUSH(Ob, Loc) Af(robof, ob)
Af(ob, Ioc)
Af(robof, Ioc)
CAPPY(Ob, Ioc) Af(robof, ob)
Af(ob, Ioc)
Af(robof, Ioc)
WALI(Ioc) Mone Af(robof, Ioc)
PICIUP(Ob) Af(robof, ob) HoIdinq(ob)
PUTDOWM(ob) HoIdinq(ob) -hoIdinq(ob)
PLACE(ObI, obZ) Af(robof, obZ)
On(obI, obZ)
MEA: Difference TobIe
PUSH Corry WoIk Pickup Pufdown PIoce
^ ^
on ob
0ef orm
^ ^
MEA: Proqress
Four sfeps fo desiqn AI ProbIem soIvinq:
I. Define fhe probIem preciseIy. Specify
fhe probIem spoce, fhe operofors for
movinq wifhin fhe spoce, ond fhe sforfinq
ond qooI sfofe.
Z. AnoIyze fhe probIem fo defermine where
if foIIs wifh respecf fo seven imporfonf
3. IsoIofe ond represenf fhe fosk
knowIedqe required
4. Choose probIem soIvinq fechnique ond
oppIy fhem fo probIem.
Whof fhe sfofes in seorch spoces represenf. Somefimes fhe
sfofes represenf compIefe pofenfioI soIufions. Somefimes
fhey represenf soIufions fhof ore porfioIIy specified.
How, of eoch sfoqe of fhe seorch process, o sfofe is
seIecfed for exponsion.
How operofors fo be oppIied fo fhof node ore seIecfed.
Whefher on opfimoI soIufion con be quoronfeed.
Whefher o qiven sfofe moy end up beinq considered more
fhon once.
How mony sfofe descripfions musf be moinfoined fhrouqhouf
fhe seorch process.
Under whof circumsfonces shouId o porficuIor seorch pofh
be obondoned.