You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2d966e6
Browse filesBrowse the repository at this point in the historyBrowse files
Fix HybridWumpusAgent (Fig 7.20) so it runs and reasons correctly (#961)
The agent crashed immediately and, where it didn't, used inverted logic. Fixed,
faithfully to AIMA Fig 7.20:
- WumpusKB now asserts the ok_to_move axiom at time 0 too (it was only added for
t>0), so the agent can prove [1,1] safe on its first move; previously the safe
set was empty at t=0 and planning crashed.
- execute(): 'unvisited' was collecting *visited* squares (inverted) -> now the
squares never been located in (for all t' <= t), intersected with safe;
possible_wumpus uses 'not KB entails ~W' and not_unsafe uses 'not KB entails
~OK' (were 'not entails W' / 'not entails OK'); guarded the pose update when no
location is entailed.
- plan_route(): returns [] when A* finds no path (was crashing on None.solution()).
- plan_shot(): used EAST/WEST/NORTH/SOUTH orientations that PlanRoute/WumpusPosition
never use -> mapped to RIGHT/LEFT/UP/DOWN; set.remove -> set.discard (the wumpus
cells were never added, so removing them raised KeyError).
- make_percept_sentence(): handled only a single percept via an elif-chain -> now
accepts a collection (a square can give Stench *and* Breeze at once) and None.
The agent now runs and returns legal actions with correct logic. Added tests for
make_percept_sentence, plan_shot, plan_route (no-path) and the t=0 end-to-end step.
NB: only the first step is exercised in tests -- the propositional Fig 7.20
inference (SAT entailment over a temporal KB) grows expensive as the KB
accumulates, which is inherent to the textbook algorithm, not a remaining bug.
0 commit comments