mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-14 18:51:52 +01:00
Add FAIKR informed search
This commit is contained in:
BIN
src/fundamentals-of-ai-and-kr/img/_a_start_example.pdf
Normal file
BIN
src/fundamentals-of-ai-and-kr/img/_a_start_example.pdf
Normal file
Binary file not shown.
BIN
src/fundamentals-of-ai-and-kr/img/_a_start_optimality.pdf
Normal file
BIN
src/fundamentals-of-ai-and-kr/img/_a_start_optimality.pdf
Normal file
Binary file not shown.
BIN
src/fundamentals-of-ai-and-kr/img/_greedy_best_first_example.pdf
Normal file
BIN
src/fundamentals-of-ai-and-kr/img/_greedy_best_first_example.pdf
Normal file
Binary file not shown.
250
src/fundamentals-of-ai-and-kr/img/best_first_example.drawio
Normal file
250
src/fundamentals-of-ai-and-kr/img/best_first_example.drawio
Normal file
@ -0,0 +1,250 @@
|
||||
<mxfile host="app.diagrams.net" modified="2023-10-04T11:52:48.592Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0" etag="rB-WY7iQEXeYjvBIMtut" version="22.0.0" type="device">
|
||||
<diagram name="Pagina-1" id="IcjLR0G3Itd0aWnBn49A">
|
||||
<mxGraphModel dx="819" dy="426" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-1" value="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="240" y="200" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-2" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="320" y="160" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-3" value="2" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="320" y="240" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-4" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=18;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-1" target="kcsDUwO9FnMU6XCRbURZ-3">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="250" as="sourcePoint" />
|
||||
<mxPoint x="380" y="300" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-5" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=18;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-1" target="kcsDUwO9FnMU6XCRbURZ-2">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="250" as="sourcePoint" />
|
||||
<mxPoint x="380" y="300" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-6" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="380" y="160" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-8" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-2" target="kcsDUwO9FnMU6XCRbURZ-6">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="250" as="sourcePoint" />
|
||||
<mxPoint x="380" y="300" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-9" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="160" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-11" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-6" target="kcsDUwO9FnMU6XCRbURZ-9">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="390" as="sourcePoint" />
|
||||
<mxPoint x="380" y="440" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-12" value="3" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="380" y="240" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-13" value="4" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="240" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-14" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-12" target="kcsDUwO9FnMU6XCRbURZ-13">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="270" y="310" as="sourcePoint" />
|
||||
<mxPoint x="220" y="360" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-15" value="5" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="500" y="240" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-16" value="6" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="560" y="240" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-17" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-15" target="kcsDUwO9FnMU6XCRbURZ-16">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="270" y="430" as="sourcePoint" />
|
||||
<mxPoint x="220" y="480" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-18" value="7" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="620" y="240" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-20" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-3" target="kcsDUwO9FnMU6XCRbURZ-12">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="460" y="440" as="sourcePoint" />
|
||||
<mxPoint x="410" y="490" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-21" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-13" target="kcsDUwO9FnMU6XCRbURZ-15">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="460" y="400" as="sourcePoint" />
|
||||
<mxPoint x="410" y="450" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-24" value="" style="endArrow=none;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-18" target="kcsDUwO9FnMU6XCRbURZ-16">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="460" y="360" as="sourcePoint" />
|
||||
<mxPoint x="410" y="410" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-25" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 3</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="230" y="240" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-26" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 4</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="310" y="130" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-28" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="370" y="130" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-30" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 2</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="310" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-31" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="370" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-32" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="430" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-33" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="490" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-34" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="550" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-35" value="<font style="font-size: 18px;">Goal</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="660" y="245" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-37" value="<div style="font-size: 18px;"><font style="font-size: 18px;">Goal</font></div>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="480" y="165" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-40" value="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="240" y="460" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-41" value="6" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="320" y="420" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-42" value="2" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="320" y="500" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-43" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=18;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-40" target="kcsDUwO9FnMU6XCRbURZ-42">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="510" as="sourcePoint" />
|
||||
<mxPoint x="380" y="560" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-44" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=18;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-40" target="kcsDUwO9FnMU6XCRbURZ-41">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="510" as="sourcePoint" />
|
||||
<mxPoint x="380" y="560" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-45" value="7" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="380" y="420" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-46" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-41" target="kcsDUwO9FnMU6XCRbURZ-45">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="510" as="sourcePoint" />
|
||||
<mxPoint x="380" y="560" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-47" value="8" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="420" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-48" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-45" target="kcsDUwO9FnMU6XCRbURZ-47">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="650" as="sourcePoint" />
|
||||
<mxPoint x="380" y="700" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-49" value="3" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="380" y="500" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-50" value="4" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="440" y="500" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-51" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-49" target="kcsDUwO9FnMU6XCRbURZ-50">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="270" y="570" as="sourcePoint" />
|
||||
<mxPoint x="220" y="620" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-52" value="5" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="500" y="500" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-53" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="560" y="500" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-54" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-52" target="kcsDUwO9FnMU6XCRbURZ-53">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="270" y="690" as="sourcePoint" />
|
||||
<mxPoint x="220" y="740" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-55" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;direction=north;fontSize=24;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="620" y="500" width="40" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-56" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-42" target="kcsDUwO9FnMU6XCRbURZ-49">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="460" y="700" as="sourcePoint" />
|
||||
<mxPoint x="410" y="750" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-57" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-50" target="kcsDUwO9FnMU6XCRbURZ-52">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="460" y="660" as="sourcePoint" />
|
||||
<mxPoint x="410" y="710" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-58" value="" style="endArrow=none;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fontSize=24;fontFamily=Times New Roman;" edge="1" parent="1" source="kcsDUwO9FnMU6XCRbURZ-55" target="kcsDUwO9FnMU6XCRbURZ-53">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="460" y="620" as="sourcePoint" />
|
||||
<mxPoint x="410" y="670" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-59" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 0+3</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="230" y="500" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-60" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1+4</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="310" y="390" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-61" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 2+1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="370" y="390" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-62" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 1+2</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="310" y="540" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-63" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 2+1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="370" y="540" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-64" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 3+1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="430" y="540" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-65" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 4+1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="490" y="540" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-66" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 5+1</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="550" y="540" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-67" value="<font style="font-size: 18px;">Goal</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="660" y="505" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-68" value="<div style="font-size: 18px;"><font style="font-size: 18px;">Goal</font></div>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="480" y="425" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-69" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 3+0</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="430" y="390" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-70" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 6+0</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="610" y="540" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-71" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 0</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="430" y="130" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="kcsDUwO9FnMU6XCRbURZ-72" value="<font style="font-size: 18px;"><i style="font-size: 18px;">f</i> = 0</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontFamily=Times New Roman;" vertex="1" parent="1">
|
||||
<mxGeometry x="610" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
@ -47,7 +47,7 @@
|
||||
\end{description}
|
||||
|
||||
\begin{algorithm}
|
||||
\caption{Tree search algorithm} \label{alg:search_tree_search}
|
||||
\caption{Tree search} \label{alg:search_tree_search}
|
||||
\begin{lstlisting}
|
||||
def treeSearch(problem, fringe):
|
||||
fringe.push(problem.initial_state)
|
||||
@ -112,10 +112,10 @@ Always expands the less deep node. The fringe is implemented as a queue (FIFO).
|
||||
\hline
|
||||
\textbf{Completeness} & Yes \\
|
||||
\hline
|
||||
\textbf{Optimality} & Only if cost is uniform (i.e. all edges have same cost) \\
|
||||
\textbf{Optimality} & Only with uniform cost (i.e. all edges have same cost) \\
|
||||
\hline
|
||||
\textbf{\makecell{Time and space\\complexity}}
|
||||
& $O(b^d)$, where the depth is $d$ and the branching factor is $b$ (i.e. each non-leaf node has $b$ children) \\
|
||||
& $O(b^d)$, where the solution depth is $d$ and the branching factor is $b$ (i.e. each non-leaf node has $b$ children) \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
@ -124,7 +124,7 @@ The exponential space complexity makes BFS impractical for large problems.
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=0.40\textwidth]{img/_bfs.pdf}
|
||||
\includegraphics[width=0.30\textwidth]{img/_bfs.pdf}
|
||||
\caption{BFS visit order}
|
||||
\end{figure}
|
||||
|
||||
@ -142,19 +142,19 @@ Same as BFS, but always expands the node with the lowest cumulative cost.
|
||||
\textbf{Optimality} & Yes \\
|
||||
\hline
|
||||
\textbf{\makecell{Time and space\\complexity}}
|
||||
& $O(b^d)$, with depth $d$ and branching factor $b$ \\
|
||||
& $O(b^d)$, with solution depth $d$ and branching factor $b$ \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=0.60\textwidth]{img/_ucs.pdf}
|
||||
\includegraphics[width=0.50\textwidth]{img/_ucs.pdf}
|
||||
\caption{Uniform-cost search visit order. $(n)$ is the cumulative cost}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\subsection{Depth-first search}
|
||||
\subsection{Depth-first search (DFS)}
|
||||
\marginnote{Depth-first search}
|
||||
Always expands the deepest node. The fringe is implemented as a stack (LIFO).
|
||||
|
||||
@ -162,21 +162,184 @@ Always expands the deepest node. The fringe is implemented as a stack (LIFO).
|
||||
\def\arraystretch{1.2}
|
||||
\begin{tabular}{c | m{10cm}}
|
||||
\hline
|
||||
\textbf{Completeness} & No \\
|
||||
\textbf{Completeness} & No (loops) \\
|
||||
\hline
|
||||
\textbf{Optimality} & No \\
|
||||
\hline
|
||||
\textbf{Time complexity}
|
||||
& $O(b^d)$, with depth $d$ and branching factor $b$ \\
|
||||
& $O(b^m)$, with maximum depth $m$ and branching factor $b$ \\
|
||||
\hline
|
||||
\textbf{Space complexity}
|
||||
& $O(b \cdot d)$, with depth $d$ and branching factor $b$ \\
|
||||
& $O(b \cdot m)$, with maximum depth $m$ and branching factor $b$ \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=0.40\textwidth]{img/_dfs.pdf}
|
||||
\includegraphics[width=0.30\textwidth]{img/_dfs.pdf}
|
||||
\caption{DFS visit order}
|
||||
\end{figure}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\subsection{Depth-limited search}
|
||||
\marginnote{Depth-limited search}
|
||||
Same as DFS, but introduces a maximum depth.
|
||||
A node at the maximum depth will not be explored further.
|
||||
|
||||
This allows to avoid infinite branches (i.e. loops).
|
||||
|
||||
|
||||
|
||||
\subsection{Iterative deepening}
|
||||
\marginnote{Iterative deepening}
|
||||
Rus a depth-limited search by trying all possible depth limits.
|
||||
It is important to note that each iteration is executed from scratch (i.e. a new execution of depth-limited search).
|
||||
|
||||
\begin{algorithm}
|
||||
\caption{Iterative deepening}
|
||||
\begin{lstlisting}
|
||||
def iterativeDeepening(G):
|
||||
for c in range(G.max_depth):
|
||||
sol = depthLimitedSearch(G, c)
|
||||
if sol is not FAILURE:
|
||||
return sol
|
||||
return FAILURE
|
||||
\end{lstlisting}
|
||||
\end{algorithm}
|
||||
|
||||
Both advantages of DFS and BFS are combined.
|
||||
|
||||
\begin{center}
|
||||
\def\arraystretch{1.2}
|
||||
\begin{tabular}{c | m{10cm}}
|
||||
\hline
|
||||
\textbf{Completeness} & Yes \\
|
||||
\hline
|
||||
\textbf{Optimality} & Only with uniform cost \\
|
||||
\hline
|
||||
\textbf{Time complexity}
|
||||
& $O(b^d)$, with solution depth $d$ and branching factor $b$ \\
|
||||
\hline
|
||||
\textbf{Space complexity}
|
||||
& $O(b \cdot d)$, with solution depth $d$ and branching factor $b$ \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
|
||||
|
||||
\section{Informed search}
|
||||
\marginnote{Informed search}
|
||||
Informed search uses evaluation functions (heuristics) to reduce the search space and
|
||||
estimate the effort needed to reach the final goal.
|
||||
|
||||
|
||||
\subsection{Best-first search}
|
||||
\marginnote{Best-first seacrh}
|
||||
Uses heuristics to compute the desirability of the nodes (i.e. how close they are to the goal).
|
||||
The fringe is ordered according the estimated scores.
|
||||
|
||||
|
||||
\begin{description}
|
||||
\item[Greedy search / Hill climbing]
|
||||
\marginnote{Greedy search / Hill climbing}
|
||||
The heuristic only evaluates nodes individually and does not consider the path to the root
|
||||
(i.e. expands the node that currently seems closer to the goal).
|
||||
\begin{center}
|
||||
\def\arraystretch{1.2}
|
||||
\begin{tabular}{c | m{9cm}}
|
||||
\hline
|
||||
\textbf{Completeness} & No (loops) \\
|
||||
\hline
|
||||
\textbf{Optimality} & No \\
|
||||
\hline
|
||||
\textbf{\makecell{Time and space\\complexity}}
|
||||
& $O(b^d)$, with solution depth $d$ and branching factor $b$ \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
% The complexity can be reduced depending on the heuristic.
|
||||
|
||||
\begin{figure}[ht]
|
||||
\centering
|
||||
\includegraphics[width=0.65\textwidth]{img/_greedy_best_first_example.pdf}
|
||||
\caption{Hill climbing visit order}
|
||||
\end{figure}
|
||||
|
||||
\item[A$^\textbf{*}$]
|
||||
\marginnote{A$^*$}
|
||||
The heuristic also considers the cumulative cost needed to reach a node from the root.
|
||||
The score associated to a node $n$ is:
|
||||
\[ f(n) = g(n) + h'(n) \]
|
||||
where $g$ is the depth of the node and $h'$ is the heuristic that computes the distance to the goal.
|
||||
|
||||
\begin{description}
|
||||
\item[Optimistic/Feasible heuristic]
|
||||
\marginnote{Optimistic/Feasible heuristic}
|
||||
Given $t(n)$ that computes the true distance of a node $n$ to the goal.
|
||||
An heuristic $h'(n)$ is optimistic (i.e. feasible) if:
|
||||
\[ h'(n) \leq t(n) \]
|
||||
In other words, $h'$ is optimistic if it always underestimates the distance to the goal.
|
||||
\end{description}
|
||||
|
||||
\begin{theorem}
|
||||
If the heuristic used by A${^*}$ is optimistic $\Rightarrow$ A${^*}$ is optimal
|
||||
\end{theorem}
|
||||
\begin{proof}
|
||||
Consider a scenario where the queue contains:
|
||||
\begin{itemize}
|
||||
\item A node $n$ whose child is the optimal solution
|
||||
\item A sub-optimal solution $G_2$
|
||||
\end{itemize}
|
||||
\begin{center}
|
||||
\includegraphics[width=0.5\textwidth]{img/_a_start_optimality.pdf}
|
||||
\end{center}
|
||||
We want to prove that A$^*$ will always expand $n$.
|
||||
|
||||
Given an optimistic heuristic $f(n) = g(n) + h'(n)$ and
|
||||
the true distance of a node $n$ to the goal $t(n)$,
|
||||
we have that:
|
||||
\[
|
||||
\begin{split}
|
||||
f(G_2) &= g(G_2) + h'(G_2) = g(G_2) \text{, as } G_2 \text{ is a solution: } h'(G_2)=0 \\
|
||||
f(G) &= g(G) + h'(G) = g(G) \text{, as } G \text{ is a solution: } h'(G)=0
|
||||
\end{split}
|
||||
\]
|
||||
Moreover, $g(G_2) > g(G)$ as $G_2$ is suboptimal.
|
||||
Therefore, $\bm{f(G_2) > f(G)}$.
|
||||
|
||||
Furthermore, as $h'$ is feasible, we have that:
|
||||
\[
|
||||
\begin{split}
|
||||
h'(n) \leq t(n) &\iff g(n) + h'(n) \leq g(n) + t(n) = g(G)=f(G) \\
|
||||
&\iff \bm{f(n) \leq f(G)}
|
||||
\end{split}
|
||||
\]
|
||||
In the end, we have that $f(G_2) > f(G) \geq f(n)$.
|
||||
So we can conclude that A$^*$ will never expand $G_2$ as:
|
||||
\[ f(G_2) > f(n) \]
|
||||
\end{proof}
|
||||
|
||||
\begin{center}
|
||||
\def\arraystretch{1.2}
|
||||
\begin{tabular}{c | m{9cm}}
|
||||
\hline
|
||||
\textbf{Completeness} & Yes \\
|
||||
\hline
|
||||
\textbf{Optimality} & Only if the heuristic is optimistic \\
|
||||
\hline
|
||||
\textbf{\makecell{Time and space\\complexity}}
|
||||
& $O(b^d)$, with solution depth $d$ and branching factor $b$ \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
In generally, it is better to use heuristics with large values (i.e. heuristics that don't underestimate too much).
|
||||
|
||||
\begin{figure}[ht]
|
||||
\centering
|
||||
\includegraphics[width=0.65\textwidth]{img/_a_start_example.pdf}
|
||||
\caption{A$^*$ visit order}
|
||||
\end{figure}
|
||||
\end{description}
|
||||
|
||||
Reference in New Issue
Block a user