(The below text version of the notes is for search purposes and convenience. See the PDF version for proper formatting such as bold, italics, etc., and graphics where applicable. Copyright: 2022 Retraice, Inc.)

Re89: The multimap Function, Part C (Best-First-Search Part 8, AIMA4e pp. 73-74)

retraice.com

How multimap works. Code and math vs. AI; Retraice code quality issues; Mappasses a modified linksto multimap; multimapcreates a defaultdict, a dictwith default values, from collections; multimapthen strips the values from the linksdictionary, and parses the keys, which should be pairs, into key-value pairs for the new dictionary of neighbors, i.e. actions available at each state.

Air date: Wednesday, 21st Dec. 2022, 10:00 PM Eastern/US.

Various prefatory remarks

  • Remember: We're skilling-up in code and math during the December to Remember Math and Code Event. Any lacking scrutiny of the AI aspects of the code we're working are merely a postponement to Jan.-Jun., 2023--almost here! * Thanks to Alexandre Brown for the following during the Re88 livestream: "defaultdict is the same as dict but defaultdict inserts a default value instead of raising an exception when a key does not exist". * Current Retraice code quality is low (e.g. violating style guidelines,^1 and not respecting the 80-character width wisdom^2). This will change. * We've had a couple of livestream visual fails recently. Onward.

multimap creates a dictionary of actions ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

PIC multimapstrips the values off of dictionary key-value pairs and then parses the key if it's a pair or throws an error. The purpose is to return a dictionary of neighborsto Map, which represents the actions available at each state in our state space. ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Other sources consulted during this livestream: * Russell & Norvig (2020); * Retraice (2022/12/14); * Retraice (2022/12/15); * Retraice (2022/12/16); * Retraice (2022/12/17); * Retraice (2022/12/18); * Retraice (2022/12/19); * Retraice (2022/12/20); * http://aima.cs.berkeley.edu/figures.pdf; * https://github.com/aimacode/aima-python/blob/master/search4e.ipynb; * https://github.com/retraice/ReAIMA4e/.

__

References

Retraice (2022/12/14). Re82: What is a problem? (BEST-FIRST-SEARCH Part 1, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re82Retrieved 15th Dec. 2022.

Retraice (2022/12/15). Re83: A Problem Instantiated (BEST-FIRST-SEARCH Part 2, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re83Retrieved 16th Dec. 2022.

Retraice (2022/12/16). Re84: A Node Instantiated (BEST-FIRST-SEARCH Part 3, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re84Retrieved 17th Dec. 2022.

Retraice (2022/12/17). Re85: The Details (BEST-FIRST-SEARCH Part 4, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re85Retrieved 18th Dec. 2022.

Retraice (2022/12/18). Re86: Code Reading (BEST-FIRST-SEARCH Part 5, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re86Retrieved 19th Dec. 2022.

Retraice (2022/12/19). Re87: The multimap Function, Part A (BEST-FIRST-SEARCH Part 6, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re87Retrieved 20th Dec. 2022.

Retraice (2022/12/20). Re88: The multimap Function, Part B (BEST-FIRST-SEARCH Part 7, AIMA4e pp. 73-74). retraice.com. https://www.retraice.com/segments/re88Retrieved 21th Dec. 2022.

Russell, S., & Norvig, P. (2020). Artificial Intelligence: A Modern Approach. Pearson, 4th ed. ISBN: 978-0134610993. Searches: https://www.amazon.com/s?k=978-0134610993 https://www.google.com/search?q=isbn+978-0134610993 https://lccn.loc.gov/2019047498

Footnotes

^1 https://google.github.io/styleguide/pyguide.html

^2 https://stackoverflow.com/a/578318/17875494 "Have mercy on the programmers who have to maintain your software later and stick to a limit of 80 characters. Reasons to prefer 80: Readable with a larger font on laptops; Leaves space for putting two versions side by side for comparison; Leaves space for navigation views in the IDE; Prints without arbitrarily breaking lines (also applies to email, web pages, ...); Limits the complexity in one line; Limits indentation which in turn limits complexity of methods / functions. Yes, it should be part of the coding standard." --starblue