0% found this document useful (0 votes)
54 views23 pages

Effective Computer Memory Systems

An effective Computer Memory Organisation System should allow for the integration of new knowledge without size limitations, facilitate efficient retrieval of stored items, and maintain accessibility as more information is added. It should also recognize similar knowledge for reasoning and allow for the consolidation or forgetting of outdated information. The document further discusses various search strategies, including uninformed and informed searches, and algorithms like Breadth-First Search, Depth-First Search, and A* algorithm, along with heuristic functions to improve search efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views23 pages

Effective Computer Memory Systems

An effective Computer Memory Organisation System should allow for the integration of new knowledge without size limitations, facilitate efficient retrieval of stored items, and maintain accessibility as more information is added. It should also recognize similar knowledge for reasoning and allow for the consolidation or forgetting of outdated information. The document further discusses various search strategies, including uninformed and informed searches, and algorithms like Breadth-First Search, Depth-First Search, and A* algorithm, along with heuristic functions to improve search efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Features that an effective Computer

Memory Organisation System should posess

1. It should be possible to add and integrate new knowledge


in memory as needed without concern for limitations in size.

2. Any organizational scheme chosen should facilitate the


remembering process. Thus, it should be possible to locate any
stored item of knowledge efficiently from its content alone.

3. The addition of more knowledge to memory should have no


adverse effects on the accessibility of items already stored there.
Thus, the search time should not increase appreciably with the
amount of information stored.
Features that an effective Computer
Memory Organisation System should posess

4. The organization scheme should facilitate the recognition of


similar items of knowledge. This is essential for reasoning
and learning functions. It suggests that existing knowledge
be used to determine the location and manner in which new
knowledge is integrated into memory.

5. The organization should facilitate the process of consolidating


recurrent incidents or episodes and forgetting” knowledge
when it is no longer valid or no longer needed.
Uninformed vs. informed search
• Uninformed search strategies
– Also known as “blind search,” uninformed search
strategies use no information about the likely “direction”
of the goal node(s)
– Uninformed search methods: Breadth-first, depth-first etc
• Informed search strategies
– Also known as “heuristic search,” informed search
strategies use information about the domain to (try to)
(usually) head in the general direction of the goal node(s)
– Informed search methods: Hill climbing, best-first, A* etc
Breadth First Search
Breadth-first searches are performed by exploring all nodes at a
given depth before proceeding to the next level. This means that all
immediate children of nodes are explored before any of the
children's children are considered .Breadth first tree search is
illustrated below:
Algorithm for Breadth First Search
1. Place the starting node s on the queue.
2. If the queue is empty, return failure
and stop.
3. If the first element on the queue is a
goal node g,
return success and stop. Otherwise ,
4. Remove and expand the first element
from the queue and place at the end of
the queue.
5. Return to step 2.
Depth First Search
Depth-first search generates a child node from the most
recently expanded node, then generating that child's children,
and so on until a goal is found. If a goal is not found when a
leaf node is reached, the program backtracks to the most
recently expanded node and generates another of its children.
This process continues until goal is found or failure occurs.
Depth First Search
Algorithm for Depth First Search :-
1. Place the starting node s on the
queue.
2. If the queue is empty, return failure
and stop.
3. If the first element on the queue is a
goal node g, return success and stop.
Otherwise,
4. Remove and expand the first
element, and place the children at the
front of the queue.
5. Return to step 2.
Heuristic Search
• Heuristic: a rule of thumb.
• Heuristic is a technique that improves the efficiency
of a search process.
• Use common sense, experience and testing.
• This type of reasoning may not always be correct, but
it frequently is, and then leads to a quick solution.
Heuristics cont’d…
Applying it to the travelling sales man problem,
1. First randomly select a starting city.
2. To select the next city, look all cities not yet visited. And

select the closest to the current city.


3. Repeat step 2 until all cities have been visited.
Heuristic Function
• “A heuristic function is a function that maps from
Problem State descriptions to measures of desirability,
usually represented as numbers.”
• Well-designed heuristic functions can play an important
role in efficiently guiding a search process towards a
solution.
• The purpose of heuristic function is to guide the search
process in the most profitable direction by suggesting
which path to follow first when more than one is
available.
Simple Heuristic Functions:
Problem Heuristic
sum of the distance so far.
• Traveling salesman
Always the missionaries should be
• Missionaries &
greater in number than the
Cannibals
Cannibals on either side of the river
by following the rule of Boat
capacity two.
Heuristic Techniques
Algorithm: Simple Hill Climbing
1. Evaluate the initial state. If it is also a goal state, then
return it and quit. Otherwise, continue with the initial
state as the current state.
2. Loop until a solution is found or until there are no new
operators left to be applied in the current state:
a. Select an operator that has not yet been applied to the
current state and apply it to produce a new state.
b. Evaluate the new state.
i. If it is a goal state, then return it and quit.
ii. If it is not a goal state but it is better than the
current state, then make it the current state.
iii. If it is not better than the current state, then
continue in the loop.
8-puzzle example
heuristic(State) = # of tiles in place, including the space
1 2 3
8 6
7 5 4 •start state has 5 tiles in
hval = 5 place

1 2 1 2 3 1 2 3
8 6 3 8 6 8 6 4
7 5 4 7 5 4 7 5
hval = 4 hval = 6 hval = 6
move leads to a dead-end (no
successor state improves the
1 3 1 2 3 1 2 3 situation) so STOP!
8 2 6 8 6 8 5 6
7 5 4 7 5 4 7 4
hval = 4 hval = 4 hval = 5
Best First Search
• The Best-first search depends on the use of a heuristic to
select most promising paths to the goal node.

• This algorithm retains all estimates computed for previously


generated nodes and makes its selection base on the best

• among them all. Thus, at any point in the search process,


best-first moves forward from the most promising of all the
nodes generated so far.
Algorithm for Best First Search
1. Place the starting node s on the queue.
2. If the queue is empty, return failure and stop.
3. If the first element on the queue is a goal node g, return success
and stop. Otherwise,
4. Remove the first element from the queue, expand it and compute
the estimated goal distances for each child. Place the children on
the queue (at either end) and arrange all queue elements in
ascending order corresponding to goal distance from the front of
the queue.
5. Return to step 2.
Example: Best First Expanded
Node
List

Search A
A CB
C GHB
G MLHB
M LHB
L HB
H NB
N B
B FED
F ED
E KJD
K JD
J D
D I
I ----
Best first example
1 2 3
8 6
heuristic(State) = # of tiles
7 5 4 in place, including the space
hval = 5

1 2 1 2 3 1 2 3
8 6 3 8 6 8 6 4
7 5 4 7 5 4 7 5
hval = 4 hval = 6 hval = 6

1 3 1 2 3 1 2 3 1 2 3 1 2 3
8 2 6 8 6 8 5 6 8 6 8 6 4
7 5 4 7 5 4 7 4 7 5 4 7 5
hval = 4 hval = 4 hval = 5 hval = 5 hval = 7

1 2 3 1 2 3
OR graph, since each of its branches represents an
8 4 8 6 4
alternative problem-solving path.
7 6 5 7 5
hval = infinity hval = 4
A* Algorithm
1. Place the starting node s on open.
2. If open is empty, stop and return failure.
3. Remove from open the node n that has the smallest value of f*(n).
If the node is a goal node, return success and stop. Otherwise,
4. Expand n, generating all of its successors n' and place n on closed.
For every successor n', if n' is not already on open or closed attach
a back-pointer to n, compute f*(n') and place it on open.
5. Each n' that is already on open or closed should be attached to
back-pointers which reflect the lowest g*(n') path. If n' was on
closed and its pointer was changed, remove it and place it on open.
6. Return to step 2.
heuristic(State) = A5 1 2 3
# of misplaced 2 8 3
(5) 8 4
tiles including 1 6 4
space 7 6 5
7 5
B6 (7) C3 (4) D6 (7)
2 8 3 2 8 3 2 8 3
1 6 4 1 4 1 6 4
Open Closed
g(n)= 1 7 5 7 6 5 7 5 A5 ɸ
E4 (6) F4 (6) G5 (7) C4 B7 D7 A5
2 8 3 2 3 2 8 3 E6 F6 B7 D7 G7 A5C4
g(n)= 2 1 4 1 8 4 1 4
F6B7D7G7H7I8 A5C4E6
7 6 5 7 6 5 7 6 5
J6B7D7G7H7I8K8 A5C4E6F6
H4 (7) I 5(8) J3 (6) K5 (8)
L6B7D7G7H7I8K8 A5C4E6F6J6
8 3 2 8 3 2 3 2 3
g(n)= 3 2 1 4 7 1 4 1 8 4 1 8 4 N5B7D7G7H7I8K8M8 A5C4E6F6J6L6
7 6 5 6 5 7 6 5 7 6 5 A5C4E6F6J6L6N5
B7D7G7H7I8K8M8
L 2(6)
1 2 3
8 4
A -> C -> E -> F -> J -> L -> N
g(n)= 4
7 6 5
M 3(8) N 0(5)
1 2 3 1 2 3
g(n)= 5 7 8 4 8 4
6 5 7 6 5
AND- OR Graph
• There are certain type of AI problems that can be decomposed into
smaller problems. ‘And – OR graph is useful for finding the solution
of such problems
• The problem is solved by breaking the problem into a set of smaller
sub problems, all of which must be solved in order to solve the
complete problem.
• Several arcs may emerge from a single node, indicating a variety of
ways in which the original problem might be solved.
Goal: Acquire TV Set

Goal: Steal a TV Set Goal: Earn some money Goal: Buy TV Set
AND-OR graph examples

A A

9 38
B C D B C D
5 3 4

17 9 27

E F G H I J

5 10 3 4 15 10
AO * ALGORITHM
1. Initialise the graph to start node
2. Traverse the graph following the current path accumulating nodes that have
not yet been expanded or solved
3. Pick any of these nodes and expand it and if it has no successors call this value
FUTILITY otherwise calculate only f' for each of the successors.
4. If f' is 0 then mark the node as SOLVED
5. Change the value of f' for the newly created node to reflect its successors by
back propagation.
6. Wherever possible use the most promising routes and if a node is marked as
SOLVED then mark the parent node as SOLVED.
7. If starting node is SOLVED or value greater than FUTILITY, stop, else repeat
from 2.

You might also like