From 040e6de811efc30dba009607aff30af7b3ef12a2 Mon Sep 17 00:00:00 2001 From: Sudhanshu Bhoi <34285367+SudhanshuBhoi@users.noreply.github.com> Date: Tue, 26 Mar 2019 20:45:03 +0530 Subject: [PATCH 1/2] Correct BREADTH_FIRST_SEARCH.md Updated BREADTH_FIRST_SEARCH.md according to the aima4e-algorithms.pdf. --- md/Breadth-First-Search.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/md/Breadth-First-Search.md b/md/Breadth-First-Search.md index 684d655..ecb0c1b 100644 --- a/md/Breadth-First-Search.md +++ b/md/Breadth-First-Search.md @@ -2,24 +2,24 @@ ## AIMA4e -__function__ BREADTH-FIRST-SEARCH(_problem_) __returns__ a solution, or failure - __if__ problem's initial state is a goal __then return__ empty path to initial state - _frontier_ ← a FIFO queue initially containing one path, for the _problem_'s initial state - _reached_ ← a set of states; initially empty - _solution_ ← failure +__function__ BREADTH-FIRST-SEARCH(_problem_) __returns__ a solution node, or failure + __if__ the initial state is a goal __then__ +  __return__ a node for the initial state + _frontier_ ← a FIFO queue, with a node for the initial state + _reached_ ← a set of states, initially empty  __while__ _frontier_ is not empty __do__ -   _parent_ ← the first node in _frontier_ -   __for__ _child_ __in__ successors(_parent_) __do__ -     _s_ ← _child_.state -     __if__ _s_ is a goal __then__ -       __return__ _child_ -     __if__ _s_ is not in _reached_ __then__ -       add _s_ to _reached_ -       add _child_ to the end of _frontier_ - __return__ _solution_ +  node ← POP(_frontier_) +  __if__ _node_ is a goal __then__ __return__ _node_ +  __for__ _child_ __in__ EXPAND(_problem_, _node_) __do__ +   _s_ ← _child_.STATE +   __if__ _s_ is a goal __then__ __return__ _child_ +   __if__ _s_ is not in _reached_ __then__ +    add _s_ to _reached_ +    add _child_ to _frontier_ + __return__ _failure_ --- -__Figure 3.9__ Breadth-first search algorithm. +__Figure 3.2__ Breadth-first search algorithm. ## AIMA3e From 2496eefe88e670dc5e6a949cae1d5d7754848102 Mon Sep 17 00:00:00 2001 From: Sudhanshu Bhoi <34285367+SudhanshuBhoi@users.noreply.github.com> Date: Tue, 26 Mar 2019 22:01:04 +0530 Subject: [PATCH 2/2] Indentation Breadth-First-Search.md --- md/Breadth-First-Search.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/md/Breadth-First-Search.md b/md/Breadth-First-Search.md index ecb0c1b..3f8419b 100644 --- a/md/Breadth-First-Search.md +++ b/md/Breadth-First-Search.md @@ -4,18 +4,18 @@ __function__ BREADTH-FIRST-SEARCH(_problem_) __returns__ a solution node, or failure  __if__ the initial state is a goal __then__ -  __return__ a node for the initial state +   __return__ a node for the initial state  _frontier_ ← a FIFO queue, with a node for the initial state  _reached_ ← a set of states, initially empty  __while__ _frontier_ is not empty __do__ -  node ← POP(_frontier_) -  __if__ _node_ is a goal __then__ __return__ _node_ -  __for__ _child_ __in__ EXPAND(_problem_, _node_) __do__ -   _s_ ← _child_.STATE -   __if__ _s_ is a goal __then__ __return__ _child_ -   __if__ _s_ is not in _reached_ __then__ -    add _s_ to _reached_ -    add _child_ to _frontier_ +   node ← POP(_frontier_) +   __if__ _node_ is a goal __then__ __return__ _node_ +   __for__ _child_ __in__ EXPAND(_problem_, _node_) __do__ +    _s_ ← _child_.STATE +    __if__ _s_ is a goal __then__ __return__ _child_ +    __if__ _s_ is not in _reached_ __then__ +     add _s_ to _reached_ +     add _child_ to _frontier_  __return__ _failure_ ---