{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Copy of FINAL Template_for CIS521_midterm notes.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "brNDGX-kvzds"
      },
      "source": [
        "# Template for Notes for CIS 521 Midterm 1\n",
        "\n",
        "The midterm exam for CIS 521 will be **open notes**. No other matierals are allowed for the exam - you may not use the textbook, the internet, a Python envionement, or communicate with anyone during the exam. \n",
        "\n",
        "This python notebook is where you should save all of your notes.  It provides a structured template that allows you to add summaries for each of the textbook sections that are part of the required reading, plus room for lecture notes and definitions.\n",
        "\n",
        "Your summaries must be written in your own words.  Do not copy and paste from the textbook.  Do not share your notes with classmates, or copy any of your classmates' notes.  "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "aPtM8g7R0Pds"
      },
      "source": [
        "# Instructions\n",
        "\n",
        "1. Make a copy of this Google Colab file. From the colab menu, pick **File > Save a copy in Drive**.  That will save a copy of this notebook in your Google drive.\n",
        "2. Go through each section of the notebook, and fill in all the summaries for each chapter and its corresponding sections.  Be sure to save your work frequently!\n",
        "3. Read the notes below about how you can format your summaries.\n",
        "4. In addition to these notes, you are allowed 1 page (both sides) for figures or handwritten notes.\n",
        "5. Submit your version of this notebook to Gradescope before you start the exam.\n",
        "6. If you are taking the exam in person, then you must print a copy of your notes for yourself.   Here's how to print: \n",
        "* Run the last cell of this notebook\n",
        "* Click the \"Mirror cell in tab\" button (this is located in the upper right corner of the cell, immediately to the right of the trash can).  This will open the cell.  \n",
        "* In Chrome, you can then print your notes using the **File > Print** option from the browser's menu.  \n",
        "* In the print options, change the layout from Landscape to Portrait. \n",
        "* Clicking the Save, will save a PDF that you can then print.\n",
        "\n",
        "## Formatting Notes\n",
        "\n",
        "1. The max length for each section's summary is 500 words / 3000 characters.\n",
        "2. You can also write a 2000 word summary of the lectures for each module.\n",
        "3. You may also write definitions of concepts for each module.  The definitions should be written in your own words (not copy and pasted), and they should be no more than 20 words long for each concept. \n",
        "2. You can use Markdown formatting for your summaries. \n",
        "3. You can use Latex formatting for equations. Put two dollar signs before and after your equation like this: \n",
        "$$ \\epsilon = \\frac{1}{mc^2} $$\n",
        "4. When you write python code or psuedocode algorithms, you should surround it with triple backticks like this:\n",
        "```\n",
        "def function():\n",
        "      print('hello world')\n",
        "```\n",
        "5. Write \\ whenever you want to keep writing on the next line without a newline being inserted."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cw5IpDLCZa4W"
      },
      "source": [
        "## Example summary\n",
        "\n",
        "This is a sample summary of [Section 2.1.1](https://web.stanford.edu/~jurafsky/slp3/2.pdf ) of Jurfasky and Martin's Speech and Language Processing's book\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lzaavW96tcxM",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "062d4ae5-06d8-4575-ff1d-06f2bd1816e6"
      },
      "source": [
        "chapter_2_1_example = \"\"\"\n",
        "Regular expressions are an algebraic notation for characterizing \\\n",
        "a set of strings that are useful for searching for a pattern or through a corpus.\\\n",
        "Only the first matching result will be shown. The search string is case sensitive, \\\n",
        "but it can consist of a single character or a sequence of characters. \\\n",
        "While square braces specify a disjunction of characters, the dash can more easily look \\\n",
        "for characters over a range. The caret specifies the non-existence of a character. \\\n",
        "Additionally, the (?) is used to for flexibility on a single character, meaning \\\n",
        "\"the preceding character or nothing\". More importantly, the Kleene star means zero or \\\n",
        "more occurrences of the immediately previous character or regular expression in square braces.\\\n",
        "...\n",
        "\"\"\"\n",
        "\n",
        "length = len(chapter_2_1_example.split(\" \"))\n",
        "print(\"The example summary is {len} words long, so you could write an additional \\\n",
        "{remaining} words.\".format(len=length, remaining=(500-length)))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The example summary is 116 words long, so you could write an additional 384 words.\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "s3Uk9gQTevcj"
      },
      "source": [
        "## Example summary length\n",
        "\n",
        "The maximum summary length for each section is 500 words / 3000 characters.  Hopefully you'll find that to be quite generous. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "8DvZ57A-djo1",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "32698fc5-7ae1-453e-ec56-8f8e5fe74b06"
      },
      "source": [
        "# This is an example of a 500 word placeholder\n",
        "placeholder = \"\"\"ultrices vitae auctor eu augue ut lectus arcu bibendum at varius \\\n",
        " vel pharetra vel turpis nunc eget lorem dolor sed viverra ipsum nunc aliquet \\\n",
        " bibendum enim facilisis gravida neque convallis a cras semper auctor neque vitae \\\n",
        " tempus quam pellentesque nec nam aliquam sem et tortor consequat id porta nibh \\\n",
        " venenatis cras sed felis eget velit aliquet sagittis id consectetur purus ut \\\n",
        " faucibus pulvinar elementum integer enim neque volutpat ac tincidunt vitae semper \\ \n",
        " quis lectus nulla at volutpat diam ut venenatis tellus in metus vulputate eu \\\n",
        " scelerisque felis imperdiet proin fermentum leo vel orci porta non pulvinar neque \\ \n",
        " laoreet suspendisse interdum consectetur libero id faucibus nisl tincidunt eget \\\n",
        " nullam non nisi est sit amet facilisis magna etiam tempor orci eu lobortis \\\n",
        " elementum nibh tellus molestie nunc non blandit massa enim nec dui nunc mattis \\\n",
        " enim ut tellus elementum sagittis vitae et leo duis ut diam quam nulla porttitor \\\n",
        " massa id neque aliquam vestibulum morbi blandit cursus risus at ultrices mi tempus \\\n",
        " imperdiet nulla malesuada pellentesque elit eget gravida cum sociis natoque \\\n",
        " penatibus et magnis dis parturient montes nascetur ridiculus mus mauris vitae \\\n",
        " ultricies leo integer malesuada nunc vel risus commodo viverra maecenas accumsan \\\n",
        " lacus vel facilisis volutpat est velit egestas dui id ornare arcu odio ut sem nulla \\\n",
        " pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies integer \\\n",
        " quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa \\\n",
        " tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc \\\n",
        " consequat interdum varius sit amet mattis vulputate enim nulla aliquet porttitor \\\n",
        " lacus luctus accumsan tortor posuere ac ut consequat semper viverra nam libero \\\n",
        " justo laoreet sit amet cursus sit amet dictum sit amet justo donec enim diam \\\n",
        " vulputate ut pharetra sit amet aliquam id diam maecenas ultricies mi eget mauris \\\n",
        " pharetra et ultrices neque ornare aenean euismod elementum nisi quis eleifend quam \\\n",
        " adipiscing vitae proin sagittis nisl rhoncus mattis rhoncus urna neque viverra justo \\\n",
        " nec ultrices dui sapien eget mi proin sed libero enim sed faucibus turpis in \\\n",
        " eu mi bibendum neque egestas congue quisque egestas diam in arcu cursus euismod \\\n",
        " quis viverra nibh cras pulvinar mattis nunc sed blandit libero volutpat sed cras \\\n",
        " ornare arcu dui vivamus arcu felis bibendum ut tristique et egestas quis ipsum \\\n",
        " suspendisse ultrices gravida dictum fusce ut placerat orci nulla pellentesque \\\n",
        " dignissim enim sit amet venenatis urna cursus eget nunc scelerisque viverra mauris \\\n",
        " in aliquam sem fringilla ut morbi tincidunt augue interdum velit euismod in \\\n",
        " pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id aliquet \\\n",
        " risus feugiat in ante metus dictum at tempor commodo ullamcorper a lacus vestibulum \\\n",
        " sed arcu non odio euismod lacinia at quis risus sed vulputate odio ut enim blandit \\\n",
        " volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque in \\\n",
        " dictum non consectetur a erat nam at lectus urna\"\"\"\n",
        "\n",
        "print(\"The length in words is\", len(placeholder.split(' ')))\n",
        "print(\"The length in characters is\", len(placeholder))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The length in words is 500\n",
            "The length in characters is 3030\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5yG3-YncJfTB"
      },
      "source": [
        "# Permissions to use your summaries\n",
        "\n",
        "We'd like to use your summaries to help develop better educational resources like [remember.school](https://remember.school) or a question-answering system about the textbook.  \n",
        "\n",
        "1. Please enter your name.  \n",
        "\n",
        "2. If you grant permission for us to use your summaries under a [Creative Commons License](https://creativecommons.org/licenses/by/4.0/), please set ```permission = True```.  If you do not grant permission, please set it to false. Your answer won't affect your grade.\n",
        "\n",
        "3. If you grant us permission, and you'd like to remain anonymous, set ```anonymous = True```.  We'll remove your name before sharing your summaries with anyone. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "2RECnJArJew4"
      },
      "source": [
        "name = \"\"\n",
        "permission = True\n",
        "anonymous = False"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GZZXyrV-xuAp"
      },
      "source": [
        "# Module 1 - Intro to AI"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Y2NfE1CKxzS-"
      },
      "source": [
        "# Russell and Norvig, AIMA 4th Edition, Chapter 1 “Introduction”, Section 1.1 “What is AI”\n",
        "\n",
        "chapter1_1 = \"\"\"rationality, or doing the right thing in human terms (we define this as\n",
        "following a defined objective in the standard model). rational agent trys to acheive the \n",
        "best outcome or best expected outcome (if uncertainty). selects an action that (is expected to)\n",
        "maximize its performance measure. \\ Turing test- testing human vs machine by having participants check if written\n",
        "responses were front human or computer. The problem of achieving agreement between \n",
        "our true preferences and the objective we put into the machine is called the value \n",
        "alignment problem \"\"\" \n",
        "\n",
        "# Russell and Norvig, AIMA 4th Edition, Chapter 27 “Philosophical Foundations”, Sections 27.1 “The Limits of AI” and 27.2 “Can Machines Really Think?”\n",
        "chapter27_1 = \"\"\"what is AI? the science of making machines that think/act rationally and think/act \n",
        "like people. \\ strong (general) vs weak AI- acting like humans vs. actually thinking \\\n",
        "embodied cognition- study the whole system, not just the brain.\\ argument from disability-\n",
        "what a machine can never do (e.g. be kind)\"\"\"\n",
        "chapter27_2 = \"\"\" Descartes - dualism (the mind is separate from the body. claimed \n",
        "automata could never properly use language. cogito ergo sum. i think therefore i am\\\n",
        "John Searle says turing test is not a good test of machine intelligence since it is \n",
        "acheivable through symbol manipulation. chinese room argument- computer exceuting a program\n",
        "cant have a mind no matter how human-like a program makes it behave. \\  daniel dennett-\n",
        "idea of brain vs body, can body operate (to diffuse a bomb) if brain is separated and \n",
        "connected via radio links. reproduced computer duplciate of brain. what is difference \n",
        "between brain in a vat processing symbols and computer processing symbols?\"\"\"\n",
        "\n",
        "# Russell and Norvig, AIMA 4th Edition, Chapter 2 “Intelligent Agents” (whole chapter)\n",
        "chapter2_1 = \"\"\" Agent's action can depend on entire percept sequence learned so far\n",
        "and built-in knowedlge, but not anything else/in the future.\"\"\"\n",
        "chapter2_2 = \"\"\" Your summary here \"\"\"\n",
        "chapter2_3 = \"\"\" competitive vs cooperative task environments (e.g. chess vs. taxi\n",
        "swerving obstacles in the road. \\ known vs unknown - agent knows the outcomes\n",
        "(or outcome probabilities) for all possible actions. possible for a known environment \n",
        "to be partially observable, e.g know the rules but not card values in solitaire\n",
        "or an unknown environment can be fully observable e.g can see screen in a new video game, \n",
        "but don’t know what the buttons do until pressed\"\"\"\n",
        "chapter2_4 = \"\"\" agent architecture = physical sensors and actuators. \\ agent =\n",
        "agent program + architecture \\ program takes in current percept and returns an action\n",
        "(it can remember percept history separately but cant take it in) \\ four types of \n",
        "agent programs: simple reflex- selects actions based on current percept (ignores history)\n",
        "usually needs fully observable environment (or might get stuck in loop), model-based reflex-\n",
        "keeps track of part of the world it cant see currently (e.g. transition model to keep\n",
        "track of how the world works, and sensor model to keep track of state of the world), \n",
        "goal based-goal that describes desirable situations (difference from reflex i.e. following\n",
        "a rule vs. trying to acheive a certain state), utility based (defines better paths to take\n",
        "to the goal) \\ learning agent and problem generator (take suggests exploratory paths\n",
        "in order for agent to learn more\"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module1_lecture_notes = \"\"\"Better to design performance measure based on end goal than\n",
        "specific behavior you think the agent should have. \\ task environments or problem \n",
        "specfication (PEAS) = performance measure, actuators, environement, sensors. \\\n",
        "fully observable (perfect information) - task agent sensors can detect all relevant\n",
        "aspects of the environment to choice of action vs partially observable - (e.g autonomous cars), \n",
        "roomba. \\ deterministic vs nondeterministic vs stochastic - det: e.g. chess, when \n",
        "picking an action, we know with certainty what the immediate resulting state of the world will be.\n",
        "nondet: pick an action, outcome is uncertain. multiple possible states. e.g. rolling dice\n",
        "stochastic: type of nondet. probabilistic. can quantify probability of each outcome. \\\n",
        "episodic vs sequential - ep: decision is independent of all past decisions. seq:\n",
        "an action can affect the space of all future decisions. more challenging. \\ static vs dynamic-\n",
        "static- environment is unchanged while decision is being made. dynamic e.g. chess clock \\\n",
        "discrete vs continuous- finite set of actions vs state representation of environment and time\n",
        "(continuous range of values). \\ single vs multiagent (crossword vs chess vs pacman). model \n",
        "something as agent if it has its own performance measure to optimize. \\ the hardest \n",
        "environment is continous, partially observable, stochastic, multiagent.\"\"\"\n",
        "\n",
        "\n",
        "# Definitions of concepts from Module 1.\n",
        "# You can define any bolded term in the textbook, \n",
        "# but you most use your own words for the definitions.\n",
        "# Each definition should be at most 20 words long.\n",
        "module1_definitions = {\n",
        "\"agent\" : \"anything that can perceive (through sensors) and act in an environment\",\n",
        "\"actuators\": \"parts that allows the agent to act\",\n",
        "\"percept\" : \"signal recevied from sensors, perception at an instant of time, can be represented as a vector of inputs\",\n",
        "\"agent function\" : \"maps a sequence of percept vectors to an action (from a set of possible) taken through actuators\",\n",
        "\"agent program\": \"physical implementation of the function. not the same as agent function (which is abstract math)\",\n",
        "\"performance measure\": \"objective metric for how successful an agent's behavior is, depending on result of action\",\n",
        "\"atomic representation\": \"each state of world is indivisible (e.g. paths between cities)\",\n",
        "\"factored representation\" : \"set of variables, each with a value\",\n",
        "\"distributed representation\" : \"representation is spread over many locations of memory\",\n",
        "\"structured representation\": \"describes objects explicitly. expressiveness is how detailed/captures more\"\n",
        "}\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "elCCgY64spuq"
      },
      "source": [
        "## Preview of your notes for Module 1\n",
        "\n",
        "Here's a preview of your how your notes will be displayed.  At the end of this Python notebook, we'll aggregate your notes for all modules together into a single display.\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "gYYeNcdM_maE",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "cellView": "form",
        "outputId": "bbb2c718-903b-4fe6-fdf9-56763978e5fc"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "from IPython.display import display, Markdown, Latex\n",
        "\n",
        "module1_sections = [\n",
        "  (\"AIMA Chapter 1.1 What is AI?\", chapter1_1),\n",
        "  (\"AIMA Chapter 27.1 The Limits of AI\", chapter27_1),\n",
        "  (\"AIMA Chapter 27.1 Can Machines Really Think?\", chapter27_2),\n",
        "  (\"AIMA 2.1 Agents and Environments\", chapter2_1),\n",
        "  (\"AIMA 2.2 Good Behavior: The Concept of Rationality\", chapter2_2),\n",
        "  (\"AIMA 2.3 The Nature of Environments\", chapter2_3),\n",
        "  (\"AIMA 2.4 The Structure of Agents\", chapter2_4),\n",
        "  (\"Module 1 Lecture Notes\", module1_lecture_notes),\n",
        "]\n",
        "\n",
        "\n",
        "def length_check(sections):\n",
        "  warnings = \"\"\n",
        "  for section, summary in sections:\n",
        "    max_word_length = 500\n",
        "    max_character_length = 3000\n",
        "    if \"lecture\" in section.lower():\n",
        "      # It's OK to do longer summaries of the lectures\n",
        "      max_word_length = 2000\n",
        "      max_character_length = 12000  \n",
        "    if (len(summary) > max_character_length or len(summary.split(' ')) > max_word_length):\n",
        "      warnings += \"WARNING: Your summary of '{section}' is too long!\\n\".format(section=section)\n",
        "  return warnings\n",
        "\n",
        "def length_check_definitions(definitions):\n",
        "  warnings = \"\"\n",
        "  for concept, definition in definitions.items():\n",
        "    if(len(definition.split(' ')) > 20):\n",
        "      warnings += \"WARNING: Your definition of '{concept}' is too long!\\n\".format(concept=concept)\n",
        "  return warnings\n",
        "\n",
        "\n",
        "def format_module(module_num, title, sections, definitions, show_placeholder=False):\n",
        "  markdown = \"\"\n",
        "\n",
        "  # Check summary lengths\n",
        "  warnings = length_check(sections)\n",
        "  if warnings != \"\":\n",
        "    markdown += \"## \" + warnings\n",
        "\n",
        "  # Check definition lengths\n",
        "  warnings = length_check_definitions(definitions)\n",
        "  if warnings != \"\":\n",
        "    markdown += \"## \" + warnings\n",
        "\n",
        "  markdown += \"# Module {num}: {title}\\n\".format(num=module_num, title=title)\n",
        "\n",
        "\n",
        "  for section, summary in sections:\n",
        "    if show_placeholder and summary == \" Your summary here \":\n",
        "      summary = placeholder\n",
        "    markdown += \"## {section}\\n{summary}\\n\\n\".format(section=section, summary=summary)\n",
        "  \n",
        "  markdown += \"## Module {num} Definitions\\n\".format(num=module_num)\n",
        "  for concept, definition in definitions.items():\n",
        "    markdown += \"* **{concept}** - {definition}\\n\".format(concept=concept.capitalize(), definition=definition)\n",
        "  return markdown\n",
        "\n",
        "\n",
        "module1_markdown = format_module(1, \"Rational Agents and Task Environments\", module1_sections, module1_definitions)\n",
        "display(Markdown(module1_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 1: Rational Agents and Task Environments\n## AIMA Chapter 1.1 What is AI?\nrationality, or doing the right thing in human terms (we define this as\nfollowing a defined objective in the standard model). rational agent trys to acheive the \nbest outcome or best expected outcome (if uncertainty). selects an action that (is expected to)\nmaximize its performance measure. \\ Turing test- testing human vs machine by having participants check if written\nresponses were front human or computer. The problem of achieving agreement between \nour true preferences and the objective we put into the machine is called the value \nalignment problem \n\n## AIMA Chapter 27.1 The Limits of AI\nwhat is AI? the science of making machines that think/act rationally and think/act \nlike people. \\ strong (general) vs weak AI- acting like humans vs. actually thinking embodied cognition- study the whole system, not just the brain.\\ argument from disability-\nwhat a machine can never do (e.g. be kind)\n\n## AIMA Chapter 27.1 Can Machines Really Think?\n Descartes - dualism (the mind is separate from the body. claimed \nautomata could never properly use language. cogito ergo sum. i think therefore i amJohn Searle says turing test is not a good test of machine intelligence since it is \nacheivable through symbol manipulation. chinese room argument- computer exceuting a program\ncant have a mind no matter how human-like a program makes it behave. \\  daniel dennett-\nidea of brain vs body, can body operate (to diffuse a bomb) if brain is separated and \nconnected via radio links. reproduced computer duplciate of brain. what is difference \nbetween brain in a vat processing symbols and computer processing symbols?\n\n## AIMA 2.1 Agents and Environments\n Agent's action can depend on entire percept sequence learned so far\nand built-in knowedlge, but not anything else/in the future.\n\n## AIMA 2.2 Good Behavior: The Concept of Rationality\n Your summary here \n\n## AIMA 2.3 The Nature of Environments\n competitive vs cooperative task environments (e.g. chess vs. taxi\nswerving obstacles in the road. \\ known vs unknown - agent knows the outcomes\n(or outcome probabilities) for all possible actions. possible for a known environment \nto be partially observable, e.g know the rules but not card values in solitaire\nor an unknown environment can be fully observable e.g can see screen in a new video game, \nbut don’t know what the buttons do until pressed\n\n## AIMA 2.4 The Structure of Agents\n agent architecture = physical sensors and actuators. \\ agent =\nagent program + architecture \\ program takes in current percept and returns an action\n(it can remember percept history separately but cant take it in) \\ four types of \nagent programs: simple reflex- selects actions based on current percept (ignores history)\nusually needs fully observable environment (or might get stuck in loop), model-based reflex-\nkeeps track of part of the world it cant see currently (e.g. transition model to keep\ntrack of how the world works, and sensor model to keep track of state of the world), \ngoal based-goal that describes desirable situations (difference from reflex i.e. following\na rule vs. trying to acheive a certain state), utility based (defines better paths to take\nto the goal) \\ learning agent and problem generator (take suggests exploratory paths\nin order for agent to learn more\n\n## Module 1 Lecture Notes\nBetter to design performance measure based on end goal than\nspecific behavior you think the agent should have. \\ task environments or problem \nspecfication (PEAS) = performance measure, actuators, environement, sensors. fully observable (perfect information) - task agent sensors can detect all relevant\naspects of the environment to choice of action vs partially observable - (e.g autonomous cars), \nroomba. \\ deterministic vs nondeterministic vs stochastic - det: e.g. chess, when \npicking an action, we know with certainty what the immediate resulting state of the world will be.\nnondet: pick an action, outcome is uncertain. multiple possible states. e.g. rolling dice\nstochastic: type of nondet. probabilistic. can quantify probability of each outcome. episodic vs sequential - ep: decision is independent of all past decisions. seq:\nan action can affect the space of all future decisions. more challenging. \\ static vs dynamic-\nstatic- environment is unchanged while decision is being made. dynamic e.g. chess clock discrete vs continuous- finite set of actions vs state representation of environment and time\n(continuous range of values). \\ single vs multiagent (crossword vs chess vs pacman). model \nsomething as agent if it has its own performance measure to optimize. \\ the hardest \nenvironment is continous, partially observable, stochastic, multiagent.\n\n## Module 1 Definitions\n* **Agent** - anything that can perceive (through sensors) and act in an environment\n* **Actuators** - parts that allows the agent to act\n* **Percept** - signal recevied from sensors, perception at an instant of time, can be represented as a vector of inputs\n* **Agent function** - maps a sequence of percept vectors to an action (from a set of possible) taken through actuators\n* **Agent program** - physical implementation of the function. not the same as agent function (which is abstract math)\n* **Performance measure** - objective metric for how successful an agent's behavior is, depending on result of action\n* **Atomic representation** - each state of world is indivisible (e.g. paths between cities)\n* **Factored representation** - set of variables, each with a value\n* **Distributed representation** - representation is spread over many locations of memory\n* **Structured representation** - describes objects explicitly. expressiveness is how detailed/captures more\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9xRbdqDox2zD"
      },
      "source": [
        "#Module 2 - Python"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "DpBvu7EMx7sy"
      },
      "source": [
        "# No readings for this module.  Instead you can summarize the lecture instead.\n",
        "\n",
        "# Lecture notes \n",
        "module2_lecture_notes = \"\"\"Features of python: fast, intuitive syntax. whitespace \n",
        "delimited. garbage collected. portable to different platforms. built in types. collection\n",
        "of support libraries. \\ whitespace is meaningful (indentations), use (\\) to go to a new\n",
        "line prematurely.\\ all data treated as objects \\ strong typing-each obejct has a fixed type, \n",
        "compiler doesnt allow operations incompatible with type. static (java) vs dynamic (python)-\n",
        "variable types must be declared vs variables just assigned (and can be reassigned/updated).\n",
        "type errors detected at compile time vs runtime (python drawback). functions have no signatures.\n",
        "\\ no i++ \\ strings- immutuable (when u use strip or something, creates a new object in its place),\n",
        "e.g. x = x.strip, prefix r means raw, slicing creates a new object/copy \\ compare to \n",
        "list, .append() works on original list, no new object \\ == means same value, is means \n",
        "point to same object in memory \\ regular strings are unicode in python 3 (2 bit in python2) \\\n",
        "slicing [1:-1:2] means start position 1, every second number after, end before last.\\\n",
        "list operationtions: append(), insert(index, val), count(val)- no error for 0, remove(val) \\\n",
        "cant sort tuple, li.sort(), .reverse() changes original, but sorted(li) creates a copy without changing og \\\n",
        "dictionaries: unordered, hashing(immutable), specialized dictionary called Counter() automatically\n",
        "initializes nonexistent values, can +1 (defaultdict also does this) \\ functions no \n",
        "need to declare types of return or arguments, can return multiple things as tuple,\n",
        "cant overload functions (i.e. cant have functions w same name), non-default args (e.g.\n",
        "without default value) should come before default args! or error. can pass in multiple\n",
        "args in the form of a list eg. function(*li), **kwargs\\ dynamic scope of variables\n",
        "means you can use variables outside the scope of the function and will use the most current value\n",
        "\\ default args are only evaluated when the function theyre in is first executed \\\n",
        "fucntions are first class objects (passed and returned like variables) and first \n",
        "class citizens (e.g. assigning functions to variables) \\ to create subclass, pass in \n",
        "superclass as argument in class definition \\ to call parent class method in addition\n",
        "to newly defined method in subclass, explicitly pass in self to the parent class and call\n",
        "function. \\ magic method (double underscore) \\__cmp\\__ defines ==, defining main method--> \n",
        "if \\__name\\__ == \"main\": \\ duck typing- python infers type when calling a method e.g. len(object). \n",
        "\\ iterators: no hasnext function for python iterators, have to catch the exception. use memory \n",
        "more efficiently, e.g. for reading files it only loads one line at a timec \\ benefits\n",
        "of generators: less code than standard iterator, maintains local state, computes values\n",
        "as they are needed, doesnt store entire sequence in memory, good for aggregate (sum/\n",
        "counting items in one pass), bad if inspecting each value. \\ if you do import math\n",
        "then math.sqrt. if from math import sqrt, then only use sqrt. \\ priority queue sorts\n",
        "entrys lowest to highest.(fifo, stack is lifo)\"\"\"\n",
        "\n",
        "# Each definition should be at most 20 words long.\n",
        "module2_definitions = {\n",
        "}"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ydOK__lwWgdp",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 592
        },
        "outputId": "7dc7341c-f626-437e-8d53-5b5136fdf83a"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "\n",
        "module2_sections = [\n",
        "  (\"Module 2 Lecture Notes\", module2_lecture_notes),\n",
        "]\n",
        "\n",
        "module2_markdown = format_module(2, \"Python\", module2_sections, module2_definitions)\n",
        "display(Markdown(module2_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 2: Python\n## Module 2 Lecture Notes\nFeatures of python: fast, intuitive syntax. whitespace \ndelimited. garbage collected. portable to different platforms. built in types. collection\nof support libraries. \\ whitespace is meaningful (indentations), use (\\) to go to a new\nline prematurely.\\ all data treated as objects \\ strong typing-each obejct has a fixed type, \ncompiler doesnt allow operations incompatible with type. static (java) vs dynamic (python)-\nvariable types must be declared vs variables just assigned (and can be reassigned/updated).\ntype errors detected at compile time vs runtime (python drawback). functions have no signatures.\n\\ no i++ \\ strings- immutuable (when u use strip or something, creates a new object in its place),\ne.g. x = x.strip, prefix r means raw, slicing creates a new object/copy \\ compare to \nlist, .append() works on original list, no new object \\ == means same value, is means \npoint to same object in memory \\ regular strings are unicode in python 3 (2 bit in python2) slicing [1:-1:2] means start position 1, every second number after, end before last.list operationtions: append(), insert(index, val), count(val)- no error for 0, remove(val) cant sort tuple, li.sort(), .reverse() changes original, but sorted(li) creates a copy without changing og dictionaries: unordered, hashing(immutable), specialized dictionary called Counter() automatically\ninitializes nonexistent values, can +1 (defaultdict also does this) \\ functions no \nneed to declare types of return or arguments, can return multiple things as tuple,\ncant overload functions (i.e. cant have functions w same name), non-default args (e.g.\nwithout default value) should come before default args! or error. can pass in multiple\nargs in the form of a list eg. function(*li), **kwargs\\ dynamic scope of variables\nmeans you can use variables outside the scope of the function and will use the most current value\n\\ default args are only evaluated when the function theyre in is first executed fucntions are first class objects (passed and returned like variables) and first \nclass citizens (e.g. assigning functions to variables) \\ to create subclass, pass in \nsuperclass as argument in class definition \\ to call parent class method in addition\nto newly defined method in subclass, explicitly pass in self to the parent class and call\nfunction. \\ magic method \\__cmp\\__ defines ==, defining main method--> if \\__name\\__ == \"main\": \n\\ duck typing- python infers type when calling a method e.g. len(object). \\ iterators:\nno hasnext function for python iterators, have to catch the exception. use memory \nmore efficiently, e.g. for reading files it only loads one line at a timec \\ benefits\nof generators: less code than standard iterator, maintains local state, computes values\nas they are needed, doesnt store entire sequence in memory, good for aggregate (sum/\ncounting items in one pass), bad if inspecting each value. \\ if you do import math\nthen math.sqrt. if from math import sqrt, then only use sqrt. \\ priority queue sorts\nentrys lowest to highest.(fifo, stack is lifo)\n\n## Module 2 Definitions\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "46MQLR-Gx8dZ"
      },
      "source": [
        "#Module 3 - Search Problems"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "BN0b1eVYx-nd"
      },
      "source": [
        "# Russell and Norvig, AIMA 4th Edition, AIMA Chapter 3 “Problem Solving by Search” (3.1-3.4)\n",
        "chapter3_1 = \"\"\" open-loop (ignoring percepts, executing planned sequence) vs closed loop (\n",
        "  better for nondeterministic, monitoring percepts) \\ abstraction = removing detail from\n",
        "  a representation. abstraction is valid if you can build off abstract solution into \n",
        "  more detailed solution that achieves the same thing (e.g. taking a road from city A to B)  \"\"\"\n",
        "chapter3_2 = \"\"\" standardized (meant to illustrate) vs real world problems. \\ touring problems-\n",
        "set of locations that must be visted (not just single location). Traveling salesperson (TSP)-\n",
        "youring problem where every city on map must be visited. \"\"\"\n",
        "chapter3_3 = \"\"\" systematic algo - make sure it can reach any state that is reachable \n",
        "from initial state \\ branching factor = # of successors of a node\"\"\"\n",
        "chapter3_4 = \"\"\" early goal test (BFS) = checking goal as soon as node is generated, late \n",
        "goal test (best first search)= test for goal after node is popped off the frontier queue \\\n",
        "generally, memory requirements are a bigger issue than execution time, exponential complexity\n",
        "search problems can generally not be solved by uninformed methods \\ backtracking improves\n",
        "the space complexity of DFS- O(m) instead of O(bm) by modfiying state in place instead of\n",
        "allocating memory for each new state. \\ bi-directional search: search simultaneously from\n",
        "initial states forward and goal states backward and hope they meet O(b^(d/2)) time/space vs.\n",
        "O(b^d). keep track of two frontiers, always expand node with minimal eval function value\n",
        "(in either direction). if eval function= path cost, we have bi-drectional UCS. --> complete \n",
        "if b is finite, state space is finite, optimal if path costs are equal and using BFS/UCS.\"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module3_lecture_notes = \"\"\" rational agents chooses the actiont that maximizes its \n",
        "performance measure given an input percept sequence \\ search - planning ahead and trying\n",
        "to formulate the best possible sequence of actions (i.e. solution) \\ Depends on task environment-\n",
        "for fully observable,deterministic, known, the solution is a fixed sequence. for partially\n",
        "observable or nondeterministic, chosen future actions depend on the percepts it receives \\\n",
        "Formulate a search problem: set of states, initial state, set of possible actions (and \n",
        "function that tells us which possible actions are legal in that state), transition model\n",
        "(map current state + action --> resulting state), path cost (performance measure),\n",
        "goal test/states. \\ failure to check redundant states turns linear problem into exponential \\\n",
        "difference in algos for tree and graph --> graph has an explored set that tracks redundant\n",
        "states/nodes. \\ uninformed search (aka blind search) --> only knows problem definition, all\n",
        "non-goal nodes look equally good. \\ strategy = order of tree expansion (type of queue) \\ BFS- expand \n",
        "shallowest unexpanded node, FIFO queue, new nodes added to end of queue. Algo: node = initial state,\n",
        "frontier = {node}, explored set/came_from, loop: if frontier empty, failure, else pop node and add to \n",
        "explored, expand all possible successors from node, check if sucessor not in explored,\n",
        "if successor is goal state then return, if not then add to frontier --> important note, \n",
        "node is added to frontier only after checking if its goal. --> exponential space complexity is BAD \n",
        "\\ DFS: frontier is LIFO (add to front of list), expand deepest unexpanded node, better than breadth \n",
        "first on space efficieny, and time if solution is dense (bad if d is much shallower than m) --> \n",
        "use DFS if space is restricted, and long-path solutions, use BFS if possible infinite paths \n",
        "or short path solutions. \\ depth-limited search: dont expand nodes after certain depth l, if\n",
        "l = d then optimal, but if l < d, not complete and l > d not optimal. \\ iterative deepening:\n",
        "gradually increase l to find the best one- for l = 0-> inf, depth limiting(l), if solution\n",
        "then return else continue. Compete, and optimal (if step cost=1/same)! \n",
        "\"\"\"\n",
        "\n",
        "# Definitions of concepts from Module 3.\n",
        "# You can define any bolded term in the textbook, \n",
        "# but you most use your own words for the definitions.\n",
        "# Each definition should be at most 20 words long.\n",
        "module3_definitions = {\n",
        "\"problem-solving agent\" : \"an agent that can formulate a plan via search\",\n",
        "\"solution\" : \"sequence of actions that takes us from initial state to goal state\",\n",
        "\"optimal solution\": \"solution that has the lowest path cost\",\n",
        "\"state space\" : \"set of all states reachable through any sequence of actions from the initial state\",\n",
        "\"tree search\": \"does not check for redundant paths. more space efficient but less time efficient than graph search\",\n",
        "\"b, d, m\": \"max branching factor, depth of shallowest goal node (# of actions), maximum length of a path\",\n",
        "\"BFS metrics\": \"time and space complexity-O(b^d), complete if b is finite, optimal if cost same/=1 per step (otherwise not)\",\n",
        "\"DFS metrics\": \"NOT complete in infinite spaces/loops, time: O(b^m), space: O(b*m), NOT optimal\",\n",
        "\"depth limited metrics\": \"time: O(b^l), space: O(b*l), check notes for optimal/complete\",\n",
        "\"iterative deeping metrics\": \"goal always found at shallowest goal node, time: O(b^d), space: O(bd)\",\n",
        "\"informed vs uninformed\": \"agent can estimate how far it is from the goal\",\n",
        "\"diameter\": \"max steps to go from one point to any other point on a graph\"\n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lvtN3p7ET3Tx",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "f8c6dc37-627d-494b-d493-ce53672224a4"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module3_sections = [\n",
        "  (\"AIMA Chapter 3.1 Problem-Solving Agents\", chapter3_1),\n",
        "  (\"AIMA Chapter 3.2 Example Problems\", chapter3_2),\n",
        "  (\"AIMA Chapter 3.3 Search Algorithms\", chapter3_3),\n",
        "  (\"AIMA Chapter 3.4 Uninformed Search Strategies\", chapter3_4),\n",
        "  (\"Module 3 Lecture Notes\", module3_lecture_notes),\n",
        "]\n",
        "\n",
        "module3_markdown = format_module(3, \"Search Problems\", module3_sections, module3_definitions)\n",
        "display(Markdown(module3_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 3: Search Problems\n## AIMA Chapter 3.1 Problem-Solving Agents\n Your summary here \n\n## AIMA Chapter 3.2 Example Problems\n Your summary here \n\n## AIMA Chapter 3.3 Search Algorithms\n Your summary here \n\n## AIMA Chapter 3.4 Uninformed Search Strategies\n Your summary here \n\n## Module 3 Lecture Notes\n Your summary here \n\n## Module 3 Definitions\n* **Problem-solving agent** - an agent that can formulate a plan via search\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WHREsHSSyA-h"
      },
      "source": [
        "#Module 4 - Informed Search"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "tuFC8w7CyCns"
      },
      "source": [
        "# Russell and Norvig, AIMA Chapter 3 “Problem Solving by Search” (3.5-3.6)\n",
        "chapter3_5 = \"\"\" Best first search is a graph-like search (checks redundant paths). UCS\n",
        "complexity similar to BFS for equal path costs. \\ proof of admissable heuristic resulting in cost-optimal A*:\n",
        "suppose the optimal path has cost C*, but algo returns a path with cost C > C*. This\n",
        "means there must be some node n on the optimal path that was not expanded. Then, h*(n),\n",
        "g*(n) for actual cost from n to goal and path cost to n from start, f(n) > C* \n",
        "(or n would have been expanded), f(n) = g(n) + h(n)= g*(n) + h(n) since on optimal path, f(n) \n",
        " <= g*(n) + h*(n) because of admissability h(n)<=h*(n), f(n) <= C* (since C* = g*(n) + h*(n)),\n",
        " which is a contradiction. \\ every consistent heuristic function is admissable (see\n",
        " defintion below, not other way around). \\ search contours- path costs are monotonic\n",
        " (always increasing, since positive). \\ A* prunes uneccessary nodes and expands nodes \n",
        " with f(n) < C* (surely expanded nodes). pruning results in O(b^(d-constant)) since\n",
        " it reduces the effective depth of the tree \\ weighted A* adds a weight to heuristic\n",
        " f(n) = g(n) * W*h(n) \\ bidirectional heuristic search uses separate f(n) for each\n",
        " direction. front-to end measure initial to goal and vice versa, front to front measures\n",
        "  distance between frontiers.\"\"\"\n",
        "chapter3_6 = \"\"\"euclidean and manhattan distance are consistent and admissable heuristics.\n",
        "effective branching factor b* = branching factor that a uniform tree of depth d would have\n",
        "to have N+1 total nodes. N+1 = 1 + b* + ... + b*^d. admissable heuristic with lower branching factor results in more \n",
        "efficient A* search. \\ generate heuristics with relaxed problems (problem with fewer\n",
        "constraints) or subproblems. If you have multiple close admissable heuristics, take the max of them\n",
        "for each node (closest to real val).\"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module4_lecture_notes = \"\"\" Uniform cost search (dijkstras) - expand node with lowest path cost,\n",
        "implement with priority queue, important note- tests for goal state when selected for\n",
        "expansion, not when added to frontier--> enqueues node before checking if its a goal \\\n",
        "heuristics: estimate of distance to goal \\ Greedy best first search = UCS, but f(n) heuristic\n",
        "instead of g(n) path cost until current state (i.e. expands node with lowest estimated\n",
        "distance to the goal. Algo: frontier- priority queue + add initial node, came_from dict,\n",
        "while frontier not empty, pop queue and check if goal, if not, check neighbors and if\n",
        "not in came_from (or path cost is smaller than recorded for reaching that node), \n",
        "then add successor + successor f(n) to queue (ordered by f(n)) and\n",
        "add to came_from (i.e. came_from[successor] = current \\ A*: f(n) = h(n) + g(n), include\n",
        "path cost. heuristic has to be admissable/optimistic (i.e. never overestimate the cost\n",
        "to reach the goal) 0 <= h(n) <= true. --> important note, even when you find the goal, \n",
        "not done until goal is at the top of the frontier queue and popped to be expanded. \n",
        "\\ why admissable important? If unadmissable, it pushes good plans too far back \n",
        "in the queue, and they may never be expanded. admissable ones slow down bad plans. \\\n",
        "proof of optimatilty (i.e. the optimal goal node will exit the frontier before suboptimal\n",
        "ones) - if B (suboptimal) is on the frontier, an ancestor (n) of A is too. Claim: n will\n",
        "be expanded before B. --> f(n) <= (f(A) = g(A)) due to path cost and heuristic = 0 at goal,\n",
        "g(A) <g(B) = f(B) since B is suboptimal and 0 at goal, so f(A) <  f(B). Thus, f(n)\n",
        "< f(B) and will be expanded earlier. So all ancestors of A expanded before B. \\ \n",
        "\"\"\"\n",
        "\n",
        "# Definitions\n",
        "module4_definitions = {\n",
        "\"uniform cost search\" : \"complete and optimal, time/space complexity: O(b^(1+C/e), C= cost of optimal, e is lower bound on path cost\", \n",
        "\"greedy best first search\": \"not optimal! also not complete (depends on bad heuristic + loops? can be complete in finite spaces?)\",\n",
        "\"dominance\": \"if both functions are admissiable but h1 always >= h2, h1 dominates (more accurate)\",\n",
        "\"consistent heuristic\": \"for node n, successor n', h(n) <= cost to go from n to n' + h(n')\",\n",
        "\"A* search\": \"complete and optimal (if admissable heuristic), time (depends on h(n), O(bd)), space O(b^d)\"   \n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "vqtEs0gHs9sO",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "cellView": "form",
        "outputId": "6a33bad1-c16f-44e7-b70a-5755faa0ad38"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module4_sections = [\n",
        "  (\"AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\", chapter3_5),\n",
        "  (\"AIMA Chapter 3.6 Heuristic Functions\", chapter3_6),\n",
        "  (\"Module 4 Lecture Notes\", module4_lecture_notes),\n",
        "]\n",
        "\n",
        "module4_markdown = format_module(4, \"Informed Search\", \n",
        "                         module4_sections, \n",
        "                         module4_definitions)\n",
        "display(Markdown(module4_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 4: Informed Search\n## AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\n Your summary here \n\n## AIMA Chapter 3.6 Heuristic Functions\n Your summary here \n\n## Module 4 Lecture Notes\n Your summary here \n\n## Module 4 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "F3FPMzG9yUls"
      },
      "source": [
        "#Module 5 - Adversarial Search and Games"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "iEIOpL7vyWcc"
      },
      "source": [
        "# Russell and Norvig, AIMA chapter 5 \"Adversarial Search\"”\" (5.1-5.3, and 5.5).\n",
        "chapter5_1 = \"\"\" perfect information = fully observable. minimax solves perfect \n",
        "information, zero-sum games, using depth first search. multiple outcome scores.\"\"\"\n",
        "chapter5_2 = \"\"\" To define game as search problem, you need a set of terminal states,\n",
        "initial state, set of legal actions, and utility function(flashcards). \\ alpha-beta \n",
        "pruning- order of nodes examined affects efficiency. effective pruning becomes O(b^m/2)\n",
        "instead of O(b^m), and effective branching factor is sqrt(b). random ordering results\n",
        "in O(b^3m/4)\"\"\"\n",
        "chapter5_3 = \"\"\" Type A vs B strategy: consider all possibel moves to a certain depth\n",
        "(wide but shallow) vs pursue the most promising lines as deep as possible. \\ to deal \n",
        "with limited computing time, apply evaluation function to middle states and cutoff\n",
        "search early. \\ beam search, method of forward pruning that considers beam of n best\n",
        "moves.\"\"\"\n",
        "chapter5_5 = \"\"\" If the outcome of making a move is deterministic, expectimax and minimax\n",
        "return the same solutions. \"\"\"\n",
        "\n",
        "# Russell and Norvig, AIMA Chapter 16 “Making Simple Decisions” (16.1-16.3)\n",
        "chapter16_1 = \"\"\" Your summary here \"\"\"\n",
        "chapter16_2 = \"\"\" Your summary here \"\"\"\n",
        "chapter16_3 = \"\"\" backtracking search for CSP\"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module5_lecture_notes = \"\"\"so far puzzles- what is a game vs puzzle? multiagent \\\n",
        "simplest game environment- static, discrete, full observable, strategic (next state \n",
        "determined by current state and actions of current agent and one other agent) \\ game \n",
        "as search problem - initial state, successor function (specifies legal moves) = set\n",
        "of legal actions + results/transition model which defines resulting states, terminal\n",
        "test, utility function (value of terminal states), MAX uses search tree to determine\n",
        "next move. --> each move: consider all successors and choose the action that puts \n",
        "us in the best board position. game tree: edge is legal move, node is board state \\\n",
        "evaluation function (for a board position) for zero sum: pos if max in good position, \n",
        "0 if tied, neg if min in good position --> example chess (piece values for A - piece\n",
        "values for B), or positional weighting (more complex). \\ minimax - assume opponent \n",
        "responds with best possible move. perfect information, zero-sum game. Algo (max-value):\n",
        "if terminal state, return value, else for each successor, v = max(v, min-value(successor)),\n",
        "return v after for loop. min value is another function, same structure. if agent is \n",
        "MAX, call max-value function, if MIN call min-value function. \\ alpha-beta pruning-\n",
        "keep track of alpha (lower bound on MAX outcome) and beta during minimax (upper bound\n",
        "on MIN outcome). stop evaluating a branch whenever v > beta for a MAX node or v < alpha\n",
        "when evaluating a MIN node. \\ expectimax - outcomes controlled by chance, not adversary.\n",
        "max nodes and chance nodes. values now (weighted)average case outcomes instead of worst case-\n",
        "MAX node now just takes max value of successors (not max of min-value), MIN node \n",
        "now does expected value of children (e.g. sum(value * probability of that node). cant\n",
        "use alpha-beta pruning for expectimax. \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module5_definitions = {\n",
        "\"adversarial search\" : \"definition\",   \n",
        "\"backed-up value of a node\" : \"determined by values of the children, for MAX, the maximum of its children\",\n",
        "\"ply\": \"one move by one player at each level\",\n",
        "\"minimax metrics\": \"time O(b^m), space O(bm), m is maximum depth of tree, b legal moves at each level\",\n",
        "\"transpositions\": \"different permutations of the same move sequence that end up in the same state\"\n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "KUc_LgzDvWf-",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "39ec8635-89e2-4f2f-99f8-00aecd47f6ca"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module5_sections = [\n",
        "  (\"AIMA Chapter 5.1 Game Theory\", chapter5_1),\n",
        "  (\"AIMA Chapter 5.2 Optimal Decisions in Games\", chapter5_2),\n",
        "  (\"AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\", chapter5_3),\n",
        "  (\"AIMA Chapter 5.5 Stochastic Games\", chapter5_5),\n",
        "  (\"AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\", chapter16_1),\n",
        "  (\"AIMA Chapter 16.2 The Basis of Utility Theory\", chapter16_2),\n",
        "  (\"AIMA Chapter 16.3 Utility Functions\", chapter16_3),\n",
        "  (\"Module 5 Lecture Notes\", module5_lecture_notes),\n",
        "]\n",
        "\n",
        "module5_markdown = format_module(5, \"Adversarial Search and Games\", \n",
        "                         module5_sections, \n",
        "                         module5_definitions)\n",
        "display(Markdown(module5_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 5: Adversarial Search and Games\n## AIMA Chapter 5.1 Game Theory\n Your summary here \n\n## AIMA Chapter 5.2 Optimal Decisions in Games\n Your summary here \n\n## AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\n Your summary here \n\n## AIMA Chapter 5.5 Stochastic Games\n Your summary here \n\n## AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\n Your summary here \n\n## AIMA Chapter 16.2 The Basis of Utility Theory\n Your summary here \n\n## AIMA Chapter 16.3 Utility Functions\n Your summary here \n\n## Module 5 Lecture Notes\n Your summary here \n\n## Module 5 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qVSQhTVSyYYO"
      },
      "source": [
        "#Module 6 - \"Constraint Satisfaction Problems\""
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Wm4mfW82yaRH",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "57751f44-a5ca-449e-e34c-94ffc20e0441"
      },
      "source": [
        "# Russell and Norvig, AIMA, Chapter 6 “Constraint Satisfaction Problems” (6.1-6.5)\n",
        "chapter6_1 = \"\"\" types of contraints: precedent (happens before in time), disjuntive \n",
        "(cant overlap). variables discrete, finite domains, linear constraints are easier than continuous.\n",
        "\\ node/arc/path are types of local consistency. \"\"\"\n",
        "chapter6_2 = \"\"\" AC-3 complexity: CSP with n variables, max domain d, c binary constraints,\n",
        " checking constraints takes O(d^2), insert into queue d times, total worst case O(cd^3). \n",
        " (refer to lecture notes for complexity in n) \\ path: Xi,Xj is consistent with Xm if \n",
        " there is an assignment that satisfies the constraints on Xm, Xj and Xi, Xm. / resource\n",
        " constraint = \"atmost\" constraint.\"\"\"\n",
        "chapter6_3 = \"\"\"backtracking- expands all possible values in domain of an unassigned variable \n",
        "and searches for solution. backtracking search is a form of depth-first search. \\ \n",
        " forward checking establishes arc consistency for a an assigned variable X. removes \n",
        " consistencies from neighboring variables. \\ MAC vs forward checking - MAC recursively \n",
        " propagates constraints when variables are changes. \\ difference between MAC and AC-3 - MAC is a \n",
        " way of interleaving search and inference. AC-3 is pure inference. MAC runs while \n",
        " assigning variables in backtracking search. Instead of queueing all arcs, MAC \n",
        " only queues arcs incident on the assigned variable. Then, it runs identically to AC-3. \\  \"\"\"\n",
        "chapter6_4 = \"\"\" min-conflcits heuristic - make random assignment, go to a variable that\n",
        "violated a constraint and choose a new val that results in least number of conflicts with\n",
        "other variables. \\ constraint weighting to focus search on most commonly violated constraints.\"\"\"\n",
        "chapter6_5 = \"\"\" Tree-structured CSP takes linear time in the number of variables (no \n",
        "need to backtrack) vs. arbitrary CSP takes exponential time \\ cutset conditioning is more space efficient \n",
        "(linear mem vs exp) but less time efficient than tree decomposition. Whenever you have a cycle-cutset of size c, there is \n",
        "also a tree of width w<c+1, and it may be far smaller in some cases. \\ cutset- reducing a \n",
        "constraint graph to a tree. algo: choose a subset of CSP's variables such that the graph\n",
        "becomes a tree after removing those variables. for every consistent assignment to these\n",
        "removed variables, remove inconsistencies in the domains of the other variables in OG \n",
        "graph. if the result has a solution, return the removed set and remaining set assignments.\n",
        " if removed set (cycle cutset) is size c, domain d, O(d^c(n-c)d^2) \\\n",
        "tree decomposition- convert OG graph into a tree of subproblems (each node in tree \n",
        "has a set of variables) --> requirements- every variable from OG graph appears at least once\n",
        " in the tree. If there's a constraint between two variables, they + constraint appear in \n",
        " same node. if variable appears in two nodes of the tree, it should also appear in every node \n",
        " along the path between those nodes. tree width = size of largest node -1. Can solve \n",
        " in O(nd^2). graphs with bounded tree width solved in polynomial time. \\ solve \n",
        " CSP tree with topological sort (pick any variable to be the root, child appears after parent). \n",
        " directional arc consistent \\ value symmetry- reduce search space by removing symmetry of assignments (e.g. map coloring).\"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module6_lecture_notes = \"\"\" When to use search: single agent, deterministic, fully\n",
        "observable, discrete states. CSPs-(constraint satisfaction problems) for assigning\n",
        "values to variables, goal is important not the path (identification vs planning). \n",
        "represent the constraints and use a general purpose search algorithm (doesnt change)\\\n",
        "formal definition of CSP- finite variables X_i, nonempty domain of possible values for \n",
        "each variable, set of constraints. a state = assignment of values to some/all variables.\n",
        " complete when all variables are assigned to a value \\ applications: sudoku, map \n",
        " coloring, scheduling \\ benefits: easy to specify the problem, automatic pruning \n",
        " of variables that violate a constraint/ knows where to focus the search \\ constraint \n",
        " graph representation- nodes are variables, arcs/edges are binary constraints. \\ CSP as \n",
        " search problem - initial state (empty assignment), successor function (assign any\n",
        " unassigned variable that does not have a constraint conflict), goal test (assignment\n",
        " is complete), path cost (constant for every step). Soltuion always found at depth n\n",
        " for n variables, so DEPTH FIRST SEARCH can be used. --> if n variables each with \n",
        " domain size d, branching factor at root = n*d, next level (n-1)*d, tree has n!*d^n\n",
        " leaves. Since assignments are commutative, only tree search needed, not graph search. \n",
        " --> branching factor b = d, and there are d^n leaves. \\ two methods of ruling out \n",
        " variables: search and inference. backtracking search --> depth first search for CSPs\n",
        " with single variable assignments, backtracks when it realizes it has no more legal moves\n",
        " when doing DFS. (basic uninformed algo for CSPs). \\ heuristics to improve backtracking-\n",
        " 1. forward checking - ONE pass through of checking for constraints and updating. --> detects\n",
        " failure early (but not all possible failures) 2. Assigning the most constrained \n",
        " (or -ing to other variables) variable next (aka MRV minimum remaining values) \n",
        " 3. Choose values for a variable that are least constraining. \\ inference- constraint\n",
        " propagation, eliminates possible value if violates contraint. \\ x -> y means for \n",
        " every value in x, theres a value in y that is arc consistent. if not, remove value\n",
        " from x. Given d values each, checking an arc takes O(d^2) worst case \\ waltz algo:\n",
        " treat every intersection in a drawing as a variable, adjacent intersections impose \n",
        " constraints on each other. CSP algo: repeat constraint propagation until no changes\n",
        " to variable domains. \\ AC-3- in each iteration, only examine X_i where a neighbor\n",
        " of X_i has lost a value in the previous iteration. Why? removing a value from X_i\n",
        " can only make the neighbor inconsistent with respect to X_i, so we just have to \n",
        " check the reverse arc (j, i) \\ Ac-3 algo: queue of arcs, while queue not empty \n",
        " pop the arc from queue, remove inconsistent vals, and if there was something removed\n",
        " add reverse arcs back into queue (e.g. if removed from (X, Y), add (Z, X) to queue). \\\n",
        " complexity: total # arcs = 2n(n-1) for n nodes, O(n^2). if there are d values for \n",
        " each node, checking one arc takes O(d^2) time, and each arc can be inserted into queue\n",
        " d times, so worst case O(n^2d^3). \\ for planar constraint graphs (no crossing edges), \n",
        " # arcs is linear in number of variables, so O(nd^3).\n",
        " \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module6_definitions = {\n",
        "\"consistent assignment\" : \"does not violate any constraints\", \n",
        "\"unary vs binary contraints\" : \"X cant be green vs. X cant equal Y\",  \n",
        "\"preference/soft constraints\" : \"red is better than green, represented with cost for each value\",\n",
        "\"commutative\": \"order of application does not affect outcome\",\n",
        "\"constraint propagation\": \"repeatedly enforces contraints locally\",\n",
        "\"node consistency\": \"satisfies unary constraints, arc consistency satisfies binary\",\n",
        "\"arc consistency\": \"two variables are arc-consistent if for every value in one, there's a value in the other that satisfies the constraint\", \n",
        "\"k-consistency\": \"if for a set of k-1 variables with any consistent assignment, there is a consistent assignment to the kth variable\",\n",
        "\"strongly k-consistent\": \"k consistent, k-1 consistent, k-2... only need to search domain so O(n^2*d) for n-consistent\",\n",
        "\"chronological backtracking\": \"goes back to most recent decision point\"\n",
        "}\n"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            " difference between MAC and AC-3 - MAC is a way of interleaving search \n",
            "and inference. AC-3 is pure inference. MAC runs while assigning variables in backtracking \n",
            "search. Instead of queueing all arcs, MAC only queues arcs incident on the assigned variable. \n",
            "Then, it runs identically to AC-3. \\ backtracking search is a form of depth-first search. \n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "kKWbCsbfxL3R",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "5f3d2500-dfb2-42e4-9373-fb3bec356333"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module6_sections = [\n",
        "  (\"AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\", chapter6_1),\n",
        "  (\"AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\", chapter6_2),\n",
        "  (\"AIMA Chapter 6.3 Backtracking Search for CSPs\", chapter6_3),\n",
        "  (\"AIMA Chapter 6.4 Local Search for CSPs\", chapter6_4),\n",
        "  (\"AIMA Chapter 6.5 The Structure of Problems\", chapter6_5),\n",
        "  (\"Module 6 Lecture Notes\", module6_lecture_notes),\n",
        "]\n",
        "\n",
        "module6_markdown = format_module(6, \"Constraint Satisfaction Problems\", \n",
        "                         module6_sections, \n",
        "                         module6_definitions)\n",
        "display(Markdown(module6_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 6: Constraint Satisfaction Problems\n## AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\n Your summary here \n\n## AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\n Your summary here \n\n## AIMA Chapter 6.3 Backtracking Search for CSPs\n Your summary here \n\n## AIMA Chapter 6.4 Local Search for CSPs\n Your summary here \n\n## AIMA Chapter 6.5 The Structure of Problems\n Your summary here \n\n## Module 6 Lecture Notes\n Your summary here \n\n## Module 6 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "RYESi2kMybL8"
      },
      "source": [
        "#Module 7 - Logical Agents"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qIRJ4YYCzNHL"
      },
      "source": [
        "# Russell and Norvig, AIMA Chapter 7 “Logical Agents” (Sections 7.1-7.5)\n",
        "\n",
        "chapter7_1 = \"\"\" Your summary here \"\"\"\n",
        "chapter7_2 = \"\"\" Your summary here \"\"\"\n",
        "chapter7_3 = \"\"\" Your summary here \"\"\"\n",
        "chapter7_4 = \"\"\" Your summary here \"\"\"\n",
        "chapter7_5 = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module7_lecture_notes = \"\"\"previous problem solving agents, states have been atomic. \n",
        "this is limited.\\ two kinds of sentences in knowledge base (KB)- axiom: given as rule/fact,\n",
        "derived: new sent derived from other sentences (through inference). KB can contain \n",
        "background info about the world, and agent can add information to KB through observations.\n",
        "In addition to adding info, can query KB and derive new knowledge to make a decision on\n",
        "what action to take. \\ models- if sent a is true in model m, then m satisfies a or m is \n",
        "a model of a (terminology). M(a) = set of all models of a (i.e. worlds where a is true) \\\n",
        "entailment- a entails b if and only if M(a) is a subset of M(b) (i.e. a is more specific\n",
        "sentence/rule than b). \\ inference algorithm to conclude whether some sentence a is true.\n",
        "is complete if it can derive all sentences that are entailed, and sound if only derives\n",
        "entailed sentences \\ propositional logic- atomic sentences represented by propositional symbols, \n",
        "can be true or false. complex sentences are constructed from simple ones using logical \n",
        "connectives \\ model checking for entailment- B entails A if and only if for every model \n",
        "in which B is true, a is also true M(B) <sub M(a). \\ searching for a proof of inference-\n",
        "initial state (initial knowledge base), actions (all inference rules whose top half matches\n",
        "a sentence, result (add bottom half of applicable inference rule to knowledge base), \n",
        "goal (the sentence we are trying to prove) \\ unit resolution can be used to eliminate literals\n",
        "that are complementary (negative of each other) \\ CNF: every sentence of propositional logic\n",
        "is equal to a conjunction of clauses in CNF form. clauses are disjunctions of literals. \n",
        "4 steps: Replace a <-> b with (a->b) ^ (b->a). replace a-> with -a V b. Move -(not) inwards\n",
        "by eliminating double negation or applying de morgans rules. Apply distributivity law to distribute\n",
        "V and ^ wherever possible. \\ resolution algo: inference based on resolution work under\n",
        "the proof by contradiction. Show KB |= a by showing KB ^ -a is unsatisfiable.--> convert\n",
        "(KB ^ -a) into CNF. apply resolution rule (eliminate complements) to resulting clauses. \n",
        "add resulting clause to KB if not already threre. Repeat until no new clauses are added (ie.\n",
        "KB does not entail a) or two clauses resolve to an empty clause (i.e. KB does entail a). \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module7_definitions = {\n",
        "\"knowledge based agents\" : \"use reasoning over an internal representation of knowledge to make a decision.\",\n",
        "\"Knowledge base\": \"a set of 'sentences' (information) written in a 'knowledge representation language\",\n",
        "\"logic\": \"generalized class of representations for knowledge-based agents, such that KB uses that representation?\",\n",
        "\"semantics\": \"defines whether a sentence is true given a model of a possible world\",\n",
        "\"model\": \"in a model, every sentence is assigned true or false.\",\n",
        "\"logical entailment\": \"when a sentence follows logically from another sentence (|= symbol)\",\n",
        "\"logical inference\": \"applying entailment to derive conclusions |-_i for inference algo i\",\n",
        "\"logical equivalence\": \"two sentences equivalent if and only if A entails B and B entails A\",\n",
        "\"monotonicity\": \"set of entailed sentences can only increase with the addition of new sent/information to KB (doesnt invalidate existing sentences)\",\n",
        "\"resolution\": \"single inference rule that results in a complete inference algorithm (When combined with any search algo)\",\n",
        "\"resolution alg\": \"complete, can run in linear time if formulated in restrictive forms like below\",\n",
        "\"horn clause\": \"disjunctive of literals where at least 1 is positive, apply resolution returns a horn clause (closed)\",\n",
        "\"definite clause\": \"disjuntion of literals where one is positive (exactly)\"\n",
        "}\n",
        "\n"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "lXNcHuKjyNXa",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "2fc31cf5-b9c0-41b0-9a0e-5f7744a61e68"
      },
      "source": [
        "#@title Preview of your summary\n",
        "#@markdown You don't need to modify anything in this cell. Just press play.\n",
        "module7_sections = [\n",
        "  (\"AIMA Chapter 7.1 Knowledge-Based Agents\", chapter7_1),\n",
        "  (\"AIMA Chapter 7.2 The Wumpus World\", chapter7_2),\n",
        "  (\"AIMA Chapter 7.3 Logic\", chapter7_3),\n",
        "  (\"AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\", chapter7_4),\n",
        "  (\"AIMA 7.5 Propositional Theorem Proving\", chapter7_5),\n",
        "  (\"Module 7 Lecture Notes\", module7_lecture_notes),\n",
        "]\n",
        "\n",
        "module7_markdown = format_module(7, \"Logical Agents\", \n",
        "                         module7_sections, \n",
        "                         module7_definitions)\n",
        "display(Markdown(module7_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 7: Logical Agents\n## AIMA Chapter 7.1 Knowledge-Based Agents\n Your summary here \n\n## AIMA Chapter 7.2 The Wumpus World\n Your summary here \n\n## AIMA Chapter 7.3 Logic\n Your summary here \n\n## AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\n Your summary here \n\n## AIMA 7.5 Propositional Theorem Proving\n Your summary here \n\n## Module 7 Lecture Notes\n Your summary here \n\n## Module 7 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "vX7lbnJd4sT5"
      },
      "source": [
        "# Your Exam Notes\n",
        "\n",
        "Here are your full set of exam notes that you can use on your midterm.  Choose **Runtime > Run all**, then your notes will be displayed.\n",
        "\n",
        "If you are taking the exam in person, then you must print a copy of your notes for yourself.   Here's how to print:\n",
        "* Run the cell below. \n",
        "* Click its \"Mirror cell in tab\" button (this is located in the upper right corner of the cell, immediately to the right of the trash can).  This will open the cell.  \n",
        "* In Chrome, you can then print your notes using the **File > Print** option from the browser's menu.  \n",
        "* In the print options, change the layout from Landscape to Portrait. \n",
        "* Clicking the Save, will save a PDF that you can then print.\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "T3cm1WV542_a",
        "outputId": "1e35f8dc-8712-4aad-fced-e8d79768a61b"
      },
      "source": [
        "# This will generate the full set of notes that you can use for your exam.\n",
        "full_markdown = \"\\n\\n\".join([module1_markdown, \n",
        "                             module2_markdown, \n",
        "                             module3_markdown, \n",
        "                             module4_markdown, \n",
        "                             module5_markdown,\n",
        "                             module6_markdown,\n",
        "                             module7_markdown,]\n",
        "                       )\n",
        "display(Markdown(full_markdown))"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 1: Rational Agents and Task Environments\n## AIMA Chapter 1.1 What is AI?\n Chapter 1.1 summary. \n\n## AIMA Chapter 27.1 The Limits of AI\n Your summary here \n\n## AIMA Chapter 27.1 Can Machines Really Think?\n Your summary here \n\n## AIMA 2.1 Agents and Environments\n Your summary here \n\n## AIMA 2.2 Good Behavior: The Concept of Rationality\n Your summary here \n\n## AIMA 2.3 The Nature of Environments\n Your summary here \n\n## AIMA 2.4 The Structure of Agents\n Your summary here \n\n## Module 1 Lecture Notes\n Your summary here \n\n## Module 1 Definitions\n* **Agent** - anything that can perceive and act in an environment\n* **Percept** - your definitions here\n* **Other concept** - your definitions here\n* **Etc.** - your definitions here\n\n\n# Module 2: Python\n## Module 2 Lecture Notes\n Your summary here \n\n## Module 2 Definitions\n* **Mutability** - your definition here\n\n\n# Module 3: Search Problems\n## AIMA Chapter 3.1 Problem-Solving Agents\n Your summary here \n\n## AIMA Chapter 3.2 Example Problems\n Your summary here \n\n## AIMA Chapter 3.3 Search Algorithms\n Your summary here \n\n## AIMA Chapter 3.4 Uninformed Search Strategies\n Your summary here \n\n## Module 3 Lecture Notes\n Your summary here \n\n## Module 3 Definitions\n* **Problem-solving agent** - an agent that can formulate a plan via search\n\n\n# Module 4: Informed Search\n## AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\n Your summary here \n\n## AIMA Chapter 3.6 Heuristic Functions\n Your summary here \n\n## Module 4 Lecture Notes\n Your summary here \n\n## Module 4 Definitions\n* **Concept** - definition\n\n\n# Module 5: Adversarial Search and Games\n## AIMA Chapter 5.1 Game Theory\n Your summary here \n\n## AIMA Chapter 5.2 Optimal Decisions in Games\n Your summary here \n\n## AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\n Your summary here \n\n## AIMA Chapter 5.5 Stochastic Games\n Your summary here \n\n## AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\n Your summary here \n\n## AIMA Chapter 16.2 The Basis of Utility Theory\n Your summary here \n\n## AIMA Chapter 16.3 Utility Functions\n Your summary here \n\n## Module 5 Lecture Notes\n Your summary here \n\n## Module 5 Definitions\n* **Concept** - definition\n\n\n# Module 6: Constraint Satisfaction Problems\n## AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\n Your summary here \n\n## AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\n Your summary here \n\n## AIMA Chapter 6.3 Backtracking Search for CSPs\n Your summary here \n\n## AIMA Chapter 6.4 Local Search for CSPs\n Your summary here \n\n## AIMA Chapter 6.5 The Structure of Problems\n Your summary here \n\n## Module 6 Lecture Notes\n Your summary here \n\n## Module 6 Definitions\n* **Concept** - definition\n\n\n# Module 7: Logical Agents\n## AIMA Chapter 7.1 Knowledge-Based Agents\n Your summary here \n\n## AIMA Chapter 7.2 The Wumpus World\n Your summary here \n\n## AIMA Chapter 7.3 Logic\n Your summary here \n\n## AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\n Your summary here \n\n## AIMA 7.5 Propositional Theorem Proving\n Your summary here \n\n## Module 7 Lecture Notes\n Your summary here \n\n## Module 7 Definitions\n* **Concept** - definition\n",
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ]
          },
          "metadata": {}
        }
      ]
    }
  ]
}