{
  "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": "74979134-9405-44f0-feca-ccc83e59a379"
      },
      "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": 66,
      "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": "f3ecc44d-0eaa-4d98-fd2b-58fe7dd02175"
      },
      "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": 67,
      "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": 68,
      "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 = \"\"\" Differnent people have different definition to AI. Some cliams that AI means rational action, others thinks AI is a human modeling. \\\n",
        "Turing test is an experiment designed for checking 'can a machine think'. For checking if a machine models human, scientists have to think about 'thinking humanly'. That is: introspection, psychological experiments, and brain imaging. \\\n",
        "To check rationality, two concepts are considered: thinking rationally(the laws of thought approach), acting rationally(the rational agent approach). Think rationally equals to logic, give correct conclusion given correct premises. \n",
        "\"\"\" \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 = \"\"\" LImits of AI has different angles. 1.The argument from informality. Turing argued that human behavior is far too complex to be captured by any formal set of rules. Hubert Dreyfus produced a series of influential critiques of artificial intelligence. The technology they criticize came to be called Good Old-Fashioned AI (GOFAI). \\ \n",
        "Computers can be beautiful, kind, resourceful, beautiful, friendly, have initiative, have a sense of humor, tell right from wrong, make mistakes, fall in love, enjoy strawberries and cream, use words properly. The one thing that they can't do is be exactly human. \\\n",
        "Gödel's incompleteness is the idea that certain mathematical questions are in principle unanswerable by particular formal systems. For any formal axiomatic framework powerful enough to do arithmetic, it is possible to construct a so-called Gödel sentence. \\\n",
        "Alan Turing suggested that we should ask whether machines can pass a behavioral test. The test requires a program to have a conversation (via typed messages) with an interrogator for five minutes. It passes the test if it fools the interrogator 30% of the time.\n",
        "\"\"\"\n",
        "chapter27_2 = \"\"\"Some philosophers claim that a machine that acts intelligently would not be actually thinking, but would be only a simulation of thinking. Turing argues that we would extend the polite convention that everyone thinks to machines if only we had experience with ones that act intelligently. \\\n",
        "John Searle's argument could equally well be used by robots to argue that a human cannot have true understanding. Searle argues that mental states are emergent features that are caused by low-level physical processes in the neurons,and it is the properties of the neurons that matter. \\\n",
        "Alan Turing concedes that consciousness is a difficult one, but deniesthat it has much relevance to the practice of AI.\n",
        "\"\"\"\n",
        "\n",
        "# Russell and Norvig, AIMA 4th Edition, Chapter 2 “Intelligent Agents” (whole chapter)\n",
        "chapter2_1 = \"\"\" An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators. A human agent has eyes, ears, and other organs for sensors and hands, legs, vocaltract, and so on for actuators; a robotic agent might have cameras and infrared range finders for sensors. \\\n",
        " An agent's choice of action at any given instant can depend on its built-in knowledge and the entire percept sequence observed to date, but not on anything it hasn't yet. Mathematically speaking, an agent's behavior is described by the agent function that maps any given perceptsequence to an action. \\\n",
        " We can imagine tabulating the agent function that describes any given agent. This would be a very large table, unless we place a bound on the length of the sequences we want to consider. The agent function is an abstract mathematical description; the agent program is a concrete implementation. \"\"\"\n",
        "chapter2_2 = \"\"\" A rational agent is one that does the right thing. \\\n",
        "Moral philosophy has developed several different notions of the \"right thing,\" but AI has stuck to one notion called consequentialism. When an agent is plunked down in an environment, it generates a sequence of actions according to the percepts it receives. If the sequence is desirable, then the agent performed well. \\\n",
        "What is rational at any given time depends on four things: 1.The performance measure that defines the criterion of success. 2.The agent’s prior knowledge of the environment. 3.The actions that the agent can perform. 4.The agent’s percept sequence to date. \\\n",
        "So rational agent is For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in knowledge the agent has. \\\n",
        "An omniscient agent knows the actual outcome of its actions and can act accordingly, but omniscience is impossible in reality. In Paris, a cargo door falls off an airliner and flattens a pedestrian; was it irrational to cross the street? It is unlikely that my obituary would read \"Idiot attempts to cross street\".\\\n",
        "An agent is an agent that perceives its environment in a particular way and learns as much as possible from what it perceives. The agent's initial configuration could reflect some prior knowledge of the environment, but as the agent gains experience this may be modified or augmented.\\\n",
        "If an agent relies on the prior knowledge of its designer rather than on its percepts and learning processes, we say that the agent lacks autonomy. For example, a vacuum-cleaning agent that learns to predictwhere and when additional dirt will appear will do better than one that does not.\n",
        "\"\"\"\n",
        "chapter2_3 = \"\"\" We show how to specify a task environment, which is the \"problems\" to which rational agents are \"solutions\". The nature of the task environment determines the appropriate design for an agent program. \\\n",
        "In designing an agent, the first step is to specify the task environment as fully as possible. We call this the PEAS (Performance, Environment, Actuators, Sensors) description. It includes the performance measure, the environment, and the agent's actuators and sensors. \\\n",
        "If an agent's sensors give it access to the complete state of the environment at each point in time, then we say that the task environment is fully observable. An environment might be partially observable because of noisy and inaccurate sensors or parts of the state are simply missing from the sensor data. \\\n",
        "An agent solving a crossword puzzle is clearly in a single-agent environment, but an agent playing chess is in a twoagent environment. Does an agent have to treat an object as an agent, or can it be treated merely as an object behaving according to the law of physics? \\\n",
        "If the next state of the environment is completely determined by the current state and the action executed by the agent(s), then we say the environment is deterministic. In principle, an agent neednot worry about uncertainty in a fully observable, deterministic environment; if theenvironment is partially observable, however, then it could appear to be nondeterministrative.\\\n",
        "In an episodic task environment, the agent receives a percept and then performs a single action. Crucially, the next episode does not depend on the actions taken in previous episodes. Episodic environments are much simpler than sequential environments because the agent does not need to think ahead.\\\n",
        "If the environment can change while an agent is deliberating, then the environment is dynamic for that agent; otherwise, it is static. If the environment itself does not change with the passage of time but the agent's performance score does, then we say the environment  is semidynamic.\\\n",
        "\n",
        "\"\"\"\n",
        "chapter2_4 = \"\"\" The job of AI is to design an agent program that implements the agent function. We assume this program will run on some sort of computing device with physical sensors and actuators. The architecture might be just a PC, or it might be a car with onboard computers, cameras, and other sensors. \"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module1_lecture_notes = \"\"\" Your summary here \"\"\"\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 and act in an environment\",\n",
        "\"NLP\": \"a task helps to communicate successfullly in a human language\",\n",
        "\"knowledge representation\": \"to store what it knows or hears\",\n",
        "\"automated reasoning\": \"to answer questions and to draw new conclusions\",\n",
        "\"machine learning\": \"to adapt to new circumstances and to detect and extrapolate patterns\",\n",
        "\"rational agent\": \"is one that acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome.\",\n",
        "\n",
        "}\n",
        "\n"
      ],
      "execution_count": 69,
      "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": "2624df57-b319-4475-c6c7-428882b822b7"
      },
      "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": 70,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 1: Rational Agents and Task Environments\n## AIMA Chapter 1.1 What is AI?\n Differnent people have different definition to AI. Some cliams that AI means rational action, others thinks AI is a human modeling. Turing test is an experiment designed for checking 'can a machine think'. For checking if a machine models human, scientists have to think about 'thinking humanly'. That is: introspection, psychological experiments, and brain imaging. To check rationality, two concepts are considered: thinking rationally(the laws of thought approach), acting rationally(the rational agent approach). Think rationally equals to logic, give correct conclusion given correct premises. \n\n\n## AIMA Chapter 27.1 The Limits of AI\n LImits of AI has different angles. 1.The argument from informality. Turing argued that human behavior is far too complex to be captured by any formal set of rules. Hubert Dreyfus produced a series of influential critiques of artificial intelligence. The technology they criticize came to be called Good Old-Fashioned AI (GOFAI). \\ \nComputers can be beautiful, kind, resourceful, beautiful, friendly, have initiative, have a sense of humor, tell right from wrong, make mistakes, fall in love, enjoy strawberries and cream, use words properly. The one thing that they can't do is be exactly human. Gödel's incompleteness is the idea that certain mathematical questions are in principle unanswerable by particular formal systems. For any formal axiomatic framework powerful enough to do arithmetic, it is possible to construct a so-called Gödel sentence. Alan Turing suggested that we should ask whether machines can pass a behavioral test. The test requires a program to have a conversation (via typed messages) with an interrogator for five minutes. It passes the test if it fools the interrogator 30% of the time.\n\n\n## AIMA Chapter 27.1 Can Machines Really Think?\nSome philosophers claim that a machine that acts intelligently would not be actually thinking, but would be only a simulation of thinking. Turing argues that we would extend the polite convention that everyone thinks to machines if only we had experience with ones that act intelligently. John Searle's argument could equally well be used by robots to argue that a human cannot have true understanding. Searle argues that mental states are emergent features that are caused by low-level physical processes in the neurons,and it is the properties of the neurons that matter. Alan Turing concedes that consciousness is a difficult one, but deniesthat it has much relevance to the practice of AI.\n\n\n## AIMA 2.1 Agents and Environments\n An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators. A human agent has eyes, ears, and other organs for sensors and hands, legs, vocaltract, and so on for actuators; a robotic agent might have cameras and infrared range finders for sensors.  An agent's choice of action at any given instant can depend on its built-in knowledge and the entire percept sequence observed to date, but not on anything it hasn't yet. Mathematically speaking, an agent's behavior is described by the agent function that maps any given perceptsequence to an action.  We can imagine tabulating the agent function that describes any given agent. This would be a very large table, unless we place a bound on the length of the sequences we want to consider. The agent function is an abstract mathematical description; the agent program is a concrete implementation. \n\n## AIMA 2.2 Good Behavior: The Concept of Rationality\n A rational agent is one that does the right thing. Moral philosophy has developed several different notions of the \"right thing,\" but AI has stuck to one notion called consequentialism. When an agent is plunked down in an environment, it generates a sequence of actions according to the percepts it receives. If the sequence is desirable, then the agent performed well. What is rational at any given time depends on four things: 1.The performance measure that defines the criterion of success. 2.The agent’s prior knowledge of the environment. 3.The actions that the agent can perform. 4.The agent’s percept sequence to date. So rational agent is For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in knowledge the agent has. An omniscient agent knows the actual outcome of its actions and can act accordingly, but omniscience is impossible in reality. In Paris, a cargo door falls off an airliner and flattens a pedestrian; was it irrational to cross the street? It is unlikely that my obituary would read \"Idiot attempts to cross street\".An agent is an agent that perceives its environment in a particular way and learns as much as possible from what it perceives. The agent's initial configuration could reflect some prior knowledge of the environment, but as the agent gains experience this may be modified or augmented.If an agent relies on the prior knowledge of its designer rather than on its percepts and learning processes, we say that the agent lacks autonomy. For example, a vacuum-cleaning agent that learns to predictwhere and when additional dirt will appear will do better than one that does not.\n\n\n## AIMA 2.3 The Nature of Environments\n We show how to specify a task environment, which is the \"problems\" to which rational agents are \"solutions\". The nature of the task environment determines the appropriate design for an agent program. In designing an agent, the first step is to specify the task environment as fully as possible. We call this the PEAS (Performance, Environment, Actuators, Sensors) description. It includes the performance measure, the environment, and the agent's actuators and sensors. If an agent's sensors give it access to the complete state of the environment at each point in time, then we say that the task environment is fully observable. An environment might be partially observable because of noisy and inaccurate sensors or parts of the state are simply missing from the sensor data. An agent solving a crossword puzzle is clearly in a single-agent environment, but an agent playing chess is in a twoagent environment. Does an agent have to treat an object as an agent, or can it be treated merely as an object behaving according to the law of physics? If the next state of the environment is completely determined by the current state and the action executed by the agent(s), then we say the environment is deterministic. In principle, an agent neednot worry about uncertainty in a fully observable, deterministic environment; if theenvironment is partially observable, however, then it could appear to be nondeterministrative.In an episodic task environment, the agent receives a percept and then performs a single action. Crucially, the next episode does not depend on the actions taken in previous episodes. Episodic environments are much simpler than sequential environments because the agent does not need to think ahead.If the environment can change while an agent is deliberating, then the environment is dynamic for that agent; otherwise, it is static. If the environment itself does not change with the passage of time but the agent's performance score does, then we say the environment  is semidynamic.\n\n\n## AIMA 2.4 The Structure of Agents\n The job of AI is to design an agent program that implements the agent function. We assume this program will run on some sort of computing device with physical sensors and actuators. The architecture might be just a PC, or it might be a car with onboard computers, cameras, and other sensors. \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* **Nlp** - a task helps to communicate successfullly in a human language\n* **Knowledge representation** - to store what it knows or hears\n* **Automated reasoning** - to answer questions and to draw new conclusions\n* **Machine learning** - to adapt to new circumstances and to detect and extrapolate patterns\n* **Rational agent** - is one that acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome.\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 = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Each definition should be at most 20 words long.\n",
        "module2_definitions = {\n",
        "\"mutability\" : \"your definition here\",\n",
        "}"
      ],
      "execution_count": 71,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ydOK__lwWgdp",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 208
        },
        "outputId": "e1c7c949-4114-4e83-ca69-3af284115323"
      },
      "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": 72,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 2: Python\n## Module 2 Lecture Notes\n Your summary here \n\n## Module 2 Definitions\n* **Mutability** - your definition here\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 = \"\"\" GOAL FORMULATION: The agent adopts the goal of reaching Bucharest. Goals organize behavior by limiting the objectives and hence the actions to be considered. \\\n",
        "PROBLEM FORMULATION: To work out how to get there, the agent devises a description of the states and actions necessary to reach the goal. The only fact about the world that will change due to an action is the current city. \\\n",
        "SEARCH: It searches until it finds a sequence of actions that reaches its goal. Such a solution is called a solution; an agent might have to simulate multiples of equences that do not reach the goal.\\\n",
        "EXECUTION: The agent can now execute the actions in the solution, one at a time.\n",
        "\"\"\"\n",
        "chapter3_2 = \"\"\" The problem-solving approach has been applied to a vast array of human androbotological problems. A standardized problem is intended to illustrate or exercise various problemsolving methods. A real-worldproblem, such as robot navigation, is one whose solutions people actually use, and whose formulation is idiosyncratic. \"\"\"\n",
        "chapter3_3 = \"\"\" A search algorithm takes a search problem as input and returns a solution, or an indication of failure. In this chapter we consider algorithms that superimpose a search tree over the state-space graph. Each node in the search tree corresponds to a state in the state space. \\\n",
        " It is important to understand the difference between the state space and the search tree. The state space describes the (possibly infinite) set of states in the world, and the actionsthat allow transitions from one state to another. The search tree describes paths betweenthese states, reaching towards the goal.\\\n",
        " \"\"\"\n",
        "chapter3_4 = \"\"\" An uninformed search algorithm is given no clue about how close a state is to the goal. An informed agent who knows the location of each city knows that Sibiu is much closer to Bucharest and thus more likely to be on the shortest path. \"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module3_lecture_notes = \"\"\" Your summary here \"\"\"\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",
        "}\n",
        "\n"
      ],
      "execution_count": 73,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lvtN3p7ET3Tx",
        "cellView": "form",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 639
        },
        "outputId": "133032a5-9c3e-4e72-d3db-a5b0b7b8a08b"
      },
      "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": 74,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 3: Search Problems\n## AIMA Chapter 3.1 Problem-Solving Agents\n GOAL FORMULATION: The agent adopts the goal of reaching Bucharest. Goals organize behavior by limiting the objectives and hence the actions to be considered. PROBLEM FORMULATION: To work out how to get there, the agent devises a description of the states and actions necessary to reach the goal. The only fact about the world that will change due to an action is the current city. SEARCH: It searches until it finds a sequence of actions that reaches its goal. Such a solution is called a solution; an agent might have to simulate multiples of equences that do not reach the goal.EXECUTION: The agent can now execute the actions in the solution, one at a time.\n\n\n## AIMA Chapter 3.2 Example Problems\n The problem-solving approach has been applied to a vast array of human androbotological problems. A standardized problem is intended to illustrate or exercise various problemsolving methods. A real-worldproblem, such as robot navigation, is one whose solutions people actually use, and whose formulation is idiosyncratic. \n\n## AIMA Chapter 3.3 Search Algorithms\n A search algorithm takes a search problem as input and returns a solution, or an indication of failure. In this chapter we consider algorithms that superimpose a search tree over the state-space graph. Each node in the search tree corresponds to a state in the state space.  It is important to understand the difference between the state space and the search tree. The state space describes the (possibly infinite) set of states in the world, and the actionsthat allow transitions from one state to another. The search tree describes paths betweenthese states, reaching towards the goal. \n\n## AIMA Chapter 3.4 Uninformed Search Strategies\n An uninformed search algorithm is given no clue about how close a state is to the goal. An informed agent who knows the location of each city knows that Sibiu is much closer to Bucharest and thus more likely to be on the shortest path. \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 = \"\"\" An informed search strategy that uses domain-specific hints about the location of goals can find solutions to problems more efficiently than an uninformed strategy. \"\"\"\n",
        "chapter3_6 = \"\"\" The performance of heuristic search algorithms depends on the quality of the heuristic function. One can sometimes construct good heuristics by relaxing the problem definition, by storing precomputed solution costs for subproblems in a pattern database, by defining landmarks, or by learning from experience with the problem class. \"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module4_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module4_definitions = {\n",
        "\"concept\" : \"definition\",    \n",
        "}\n",
        "\n"
      ],
      "execution_count": 75,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "vqtEs0gHs9sO",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 390
        },
        "cellView": "form",
        "outputId": "f137d1be-d68e-4ad9-dbb5-a4842ffcbf78"
      },
      "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": 76,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 4: Informed Search\n## AIMA Chapter 3.5 Informed (Heuristic) Search Strategies\n An informed search strategy that uses domain-specific hints about the location of goals can find solutions to problems more efficiently than an uninformed strategy. \n\n## AIMA Chapter 3.6 Heuristic Functions\n The performance of heuristic search algorithms depends on the quality of the heuristic function. One can sometimes construct good heuristics by relaxing the problem definition, by storing precomputed solution costs for subproblems in a pattern database, by defining landmarks, or by learning from experience with the problem class. \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 = \"\"\" There are at least three stances we can take towards multi-agent environments. 1. aggregate as an economy. 2. consider agents as just a part of the environment. 3. model with adversarial game-tree search. \"\"\"\n",
        "chapter5_2 = \"\"\" MAX wants to find a sequence of actions leading to a win, but MIN has something to say about these actions. In games that have a binary outcome, we could use AND–OR search. For games with multiple outcome scores, we need a slightly more general algorithm called minimax search. \"\"\"\n",
        "chapter5_3 = \"\"\" Heuristic Alpha–Beta Tree Search: To make use of our limited computation time, we can cut off the search early and apply a  heuristic evaluation function to states. This means that we no longer treat nonterminal nodes as if they were terminal. \"\"\"\n",
        "chapter5_5 = \"\"\" Stochastic games bring us a little closer to the unpredictability of real life by including a random element, such as the throwing of dice. Expected value of a position: The average over all possible outcomes of the chance nodes. \"\"\"\n",
        "\n",
        "# Russell and Norvig, AIMA Chapter 16 “Making Simple Decisions” (16.1-16.3)\n",
        "chapter16_1 = \"\"\" In decision theory, an agent chooses among actions based on the desirability of their immediate outcomes; that is, the environment is assumed to be episodic. The agent'spreferences are captured by a utility function, which assigns a single number to each state. \\\n",
        "The principle of maximum expected utility (MEU) says that a rational agent should choose the action that maximizes the agent’s expected utility. \n",
        " \"\"\"\n",
        "chapter16_2 = \"\"\" ORDERABILITY: Given any two lotteries, a rational agent must either prefer one or else rate them as equally preferable. \\\n",
        "TRANSITIVITY: Given any three lotteries, if an agent prefers A to B and prefers B to C, then the agent must prefer A to C. \\  \n",
        "CONTINUITY: If some lottery B is between A and C in preference, then there is some probability p for which the rational agent will be indifferent between getting B for sure and the lottery that yields A with probability p and C with probability 1 - p. \\\n",
        "SUBSTITUTABILITY: If an agent is indifferent between two lotteries A and B, then the agent is indifferent between two more complex lotteries that are the same except that B is substituted for A in one of them. This holds regardless of the probabilities and the other outcome(s) in the lotteries \\\n",
        "MONOTONICITY: Suppose two lotteries have the same two possible outcomes, A and B. If an agent prefers A to B, then the agent must prefer the lottery that has a higher probability for A (and vice versa). \\\n",
        "DECOMPOSABILITY: Compound lotteries can be reduced to simpler ones using the laws of probability. This has been called the “no fun in gambling” rule: it compresses two consecutive lotteries into a single equivalent lottery. \\\n",
        "\n",
        "\"\"\"\n",
        "chapter16_3 = \"\"\" People use the value of a statistical life to determine the costs and benefits of regulations and interventions. One common “currency” used in medical and safety analysis is the micromort, a one in a million chance of death.\\\n",
        "Another measure is the QALY, or quality-adjusted life year. \\\n",
        "We say that the agent exhibits a monotonic preference for more money. \\\n",
        "Decision theory is a normative theory: it describes how a rational agent should act. A descriptive theory, on the other hand, describes how actual agents—for example, humans really do act.\\\n",
        "\"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module5_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module5_definitions = {\n",
        "\"concept\" : \"definition\",    \n",
        "}\n",
        "\n"
      ],
      "execution_count": 77,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "KUc_LgzDvWf-",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 954
        },
        "outputId": "a8140c8f-8cf7-46b4-b40b-bde471e5a44f"
      },
      "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": 78,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 5: Adversarial Search and Games\n## AIMA Chapter 5.1 Game Theory\n There are at least three stances we can take towards multi-agent environments. 1. aggregate as an economy. 2. consider agents as just a part of the environment. 3. model with adversarial game-tree search. \n\n## AIMA Chapter 5.2 Optimal Decisions in Games\n MAX wants to find a sequence of actions leading to a win, but MIN has something to say about these actions. In games that have a binary outcome, we could use AND–OR search. For games with multiple outcome scores, we need a slightly more general algorithm called minimax search. \n\n## AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\n Heuristic Alpha–Beta Tree Search: To make use of our limited computation time, we can cut off the search early and apply a  heuristic evaluation function to states. This means that we no longer treat nonterminal nodes as if they were terminal. \n\n## AIMA Chapter 5.5 Stochastic Games\n Stochastic games bring us a little closer to the unpredictability of real life by including a random element, such as the throwing of dice. Expected value of a position: The average over all possible outcomes of the chance nodes. \n\n## AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\n In decision theory, an agent chooses among actions based on the desirability of their immediate outcomes; that is, the environment is assumed to be episodic. The agent'spreferences are captured by a utility function, which assigns a single number to each state. The principle of maximum expected utility (MEU) says that a rational agent should choose the action that maximizes the agent’s expected utility. \n \n\n## AIMA Chapter 16.2 The Basis of Utility Theory\n ORDERABILITY: Given any two lotteries, a rational agent must either prefer one or else rate them as equally preferable. TRANSITIVITY: Given any three lotteries, if an agent prefers A to B and prefers B to C, then the agent must prefer A to C. \\  \nCONTINUITY: If some lottery B is between A and C in preference, then there is some probability p for which the rational agent will be indifferent between getting B for sure and the lottery that yields A with probability p and C with probability 1 - p. SUBSTITUTABILITY: If an agent is indifferent between two lotteries A and B, then the agent is indifferent between two more complex lotteries that are the same except that B is substituted for A in one of them. This holds regardless of the probabilities and the other outcome(s) in the lotteries MONOTONICITY: Suppose two lotteries have the same two possible outcomes, A and B. If an agent prefers A to B, then the agent must prefer the lottery that has a higher probability for A (and vice versa). DECOMPOSABILITY: Compound lotteries can be reduced to simpler ones using the laws of probability. This has been called the “no fun in gambling” rule: it compresses two consecutive lotteries into a single equivalent lottery. \n\n\n## AIMA Chapter 16.3 Utility Functions\n People use the value of a statistical life to determine the costs and benefits of regulations and interventions. One common “currency” used in medical and safety analysis is the micromort, a one in a million chance of death.Another measure is the QALY, or quality-adjusted life year. We say that the agent exhibits a monotonic preference for more money. Decision theory is a normative theory: it describes how a rational agent should act. A descriptive theory, on the other hand, describes how actual agents—for example, humans really do act.\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"
      },
      "source": [
        "# Russell and Norvig, AIMA, Chapter 6 “Constraint Satisfaction Problems” (6.1-6.5)\n",
        "chapter6_1 = \"\"\" A constraint satisfaction problem consists of three components, X D and C: X is a set of variables. D is a set of domains, one for each variable. C is a set of constraints that specify allowable combinations of values. \\\n",
        "CSPs deal with assignments of values to variables. An assignment that does not violate any constraints is called a consistent or legal assignment. A complete assignment is one in which every variable is assigned a value, and a solution \\\n",
        "to a CSP is a consistent, complete assignment. A partial assignment is one that leaves some variables unassigned, and a partial solution is a partial assignment that is consistent.\"\"\"\n",
        "chapter6_2 = \"\"\" An atomic state-space search algorithm makes progress by expanding a node to visit its successors. A CSP algorithm has choices. It can generate successors by choosing a new variable assignment, or it can do a specific type of inference called constraint propagation. \\\n",
        "If we treat each variable as a node in a graph and each binary constraint as an edge, then the process of enforcing local consistency in each part of the graph causes inconsistent values to be eliminated. There are different types of local consistency, which we now cover in turn.\"\"\"\n",
        "chapter6_3 = \"\"\" Backtracking search for CSPs: It repeatedly chooses an unassigned variable, and then tries all values in the domain of that variable in turn, trying to extend each one into a solution via a recursive call. If the call succeeds, the solution is returned, and if it fails, the assignment is restored to the previous state, and we try the next value. If no value works then we return failure.\n",
        " \"\"\"\n",
        "chapter6_4 = \"\"\" Local search algorithms are very effective in solving many CSPs. They use a complete-state formulation where each variable is assigned a value, and the search changes the value of one variable at a time. The most obvious approach is to select the value that results in the minimum number of conflicts with other variables. \"\"\"\n",
        "chapter6_5 = \"\"\" The only way we can possibly hope to deal with the vast real world is to decompose it into subproblems. In this section, we examine ways in which the structure of the problem, as represented by the constraint graph, can be used to find solutions quickly. \\\n",
        "Independence can be ascertained simply by finding connected components of the constraint graph. Each component corresponds to a subproblem. Dividing aBoolean CSP with 100 variables into four subproblems reduces the worst-case solution time down to less than a second.\\\n",
        "A CSP is defined to be directional arc-consistent an ordering of variables. The key is a new notion of consistency, called directional arc consistency or DAC. We will show that any tree-structured CSP can be solved in time linear in the number of variables.\\\n",
        "To solve a tree-structured CSP, first pick any variable to be the root of the tree. Since each edge from a parent to its child is arc-consistent, we know that for any value we choosefor the parent there will be a valid value left to choose for the child.\n",
        "\"\"\"\n",
        "\n",
        "\n",
        "# Lecture notes \n",
        "module6_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module6_definitions = {\n",
        "\"concept\" : \"definition\",    \n",
        "}\n"
      ],
      "execution_count": 79,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "kKWbCsbfxL3R",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 822
        },
        "outputId": "2bffc0d0-112b-4422-f40e-44cfee48752f"
      },
      "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": 80,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 6: Constraint Satisfaction Problems\n## AIMA Chapter 6.1 Defining Constraint Satisfaction Problems\n A constraint satisfaction problem consists of three components, X D and C: X is a set of variables. D is a set of domains, one for each variable. C is a set of constraints that specify allowable combinations of values. CSPs deal with assignments of values to variables. An assignment that does not violate any constraints is called a consistent or legal assignment. A complete assignment is one in which every variable is assigned a value, and a solution to a CSP is a consistent, complete assignment. A partial assignment is one that leaves some variables unassigned, and a partial solution is a partial assignment that is consistent.\n\n## AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\n An atomic state-space search algorithm makes progress by expanding a node to visit its successors. A CSP algorithm has choices. It can generate successors by choosing a new variable assignment, or it can do a specific type of inference called constraint propagation. If we treat each variable as a node in a graph and each binary constraint as an edge, then the process of enforcing local consistency in each part of the graph causes inconsistent values to be eliminated. There are different types of local consistency, which we now cover in turn.\n\n## AIMA Chapter 6.3 Backtracking Search for CSPs\n Backtracking search for CSPs: It repeatedly chooses an unassigned variable, and then tries all values in the domain of that variable in turn, trying to extend each one into a solution via a recursive call. If the call succeeds, the solution is returned, and if it fails, the assignment is restored to the previous state, and we try the next value. If no value works then we return failure.\n \n\n## AIMA Chapter 6.4 Local Search for CSPs\n Local search algorithms are very effective in solving many CSPs. They use a complete-state formulation where each variable is assigned a value, and the search changes the value of one variable at a time. The most obvious approach is to select the value that results in the minimum number of conflicts with other variables. \n\n## AIMA Chapter 6.5 The Structure of Problems\n The only way we can possibly hope to deal with the vast real world is to decompose it into subproblems. In this section, we examine ways in which the structure of the problem, as represented by the constraint graph, can be used to find solutions quickly. Independence can be ascertained simply by finding connected components of the constraint graph. Each component corresponds to a subproblem. Dividing aBoolean CSP with 100 variables into four subproblems reduces the worst-case solution time down to less than a second.A CSP is defined to be directional arc-consistent an ordering of variables. The key is a new notion of consistency, called directional arc consistency or DAC. We will show that any tree-structured CSP can be solved in time linear in the number of variables.To solve a tree-structured CSP, first pick any variable to be the root of the tree. Since each edge from a parent to its child is arc-consistent, we know that for any value we choosefor the parent there will be a valid value left to choose for the child.\n\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 = \"\"\" A knowledge-based agent is an agent with a knowledge base, or KB. A knowledge base is a set of sentences that represent some assertion about the world. When the sentence is taken as being given without being derived from other sentences, we call it an axiom. \\\n",
        "There must be a way to add new sentences to the knowledge base, and another way to query what is already known. The operations TELL and ASK may involve inference, which means deriving new sentences from old ones. Inference must ensure that the answer to an ASK does not \"make things up as it goes along\".\\\n",
        "\"\"\"\n",
        "chapter7_2 = \"\"\" The wumpus world is a cave consisting of rooms connected by passageways. Some rooms contain bottomless pits that will trap anyone who enters. The only redeeming feature is the possibility of finding a heap of gold. It illustrates some important points about intelligence in computer games. \"\"\"\n",
        "chapter7_3 = \"\"\" A logic must also define the semantics, or meaning, of sentences. The semantics defines the truth of each sentence with respect to each possible world. When we need to be precise, we use the term model in place of “possible world.” Whereas possible worlds might be thought of as (potentially) real environments that the agent might or might not be in, models are mathematical abstractions, each of which has a fixed truth value (true or false) for every relevant sentence.  \"\"\"\n",
        "chapter7_4 = \"\"\" We now present propositional logic. We describe its syntax (the structure of sentences) and its semantics (the way in which the truth of sentences is determined). From these, we derive a simple, syntactic algorithm for logical inference that implements the semantic notion of entailment. \"\"\"\n",
        "chapter7_5 = \"\"\" Theory proving can be more efficient than model checking because it allows us to construct a proof of the desired sentence without consulting models. If the number of models is large but the length of the proof is short, thentheorem proving can provide an efficient way to prove that a given sentence is correct. \"\"\"\n",
        "\n",
        "# Lecture notes \n",
        "module7_lecture_notes = \"\"\" Your summary here \"\"\"\n",
        "\n",
        "# Definitions\n",
        "module7_definitions = {\n",
        "\"concept\" : \"definition\",    \n",
        "}\n",
        "\n"
      ],
      "execution_count": 81,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "lXNcHuKjyNXa",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 688
        },
        "outputId": "59cbb313-e81c-4cc5-a369-bd3ad8306856"
      },
      "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": 82,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 7: Logical Agents\n## AIMA Chapter 7.1 Knowledge-Based Agents\n A knowledge-based agent is an agent with a knowledge base, or KB. A knowledge base is a set of sentences that represent some assertion about the world. When the sentence is taken as being given without being derived from other sentences, we call it an axiom. There must be a way to add new sentences to the knowledge base, and another way to query what is already known. The operations TELL and ASK may involve inference, which means deriving new sentences from old ones. Inference must ensure that the answer to an ASK does not \"make things up as it goes along\".\n\n## AIMA Chapter 7.2 The Wumpus World\n The wumpus world is a cave consisting of rooms connected by passageways. Some rooms contain bottomless pits that will trap anyone who enters. The only redeeming feature is the possibility of finding a heap of gold. It illustrates some important points about intelligence in computer games. \n\n## AIMA Chapter 7.3 Logic\n A logic must also define the semantics, or meaning, of sentences. The semantics defines the truth of each sentence with respect to each possible world. When we need to be precise, we use the term model in place of “possible world.” Whereas possible worlds might be thought of as (potentially) real environments that the agent might or might not be in, models are mathematical abstractions, each of which has a fixed truth value (true or false) for every relevant sentence.  \n\n## AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\n We now present propositional logic. We describe its syntax (the structure of sentences) and its semantics (the way in which the truth of sentences is determined). From these, we derive a simple, syntactic algorithm for logical inference that implements the semantic notion of entailment. \n\n## AIMA 7.5 Propositional Theorem Proving\n Theory proving can be more efficient than model checking because it allows us to construct a proof of the desired sentence without consulting models. If the number of models is large but the length of the proof is short, thentheorem proving can provide an efficient way to prove that a given sentence is correct. \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/",
          "height": 1000
        },
        "id": "T3cm1WV542_a",
        "outputId": "b19151fc-6b4b-48fa-c082-2638e7333465"
      },
      "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": 83,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/markdown": "# Module 1: Rational Agents and Task Environments\n## AIMA Chapter 1.1 What is AI?\n Differnent people have different definition to AI. Some cliams that AI means rational action, others thinks AI is a human modeling. Turing test is an experiment designed for checking 'can a machine think'. For checking if a machine models human, scientists have to think about 'thinking humanly'. That is: introspection, psychological experiments, and brain imaging. To check rationality, two concepts are considered: thinking rationally(the laws of thought approach), acting rationally(the rational agent approach). Think rationally equals to logic, give correct conclusion given correct premises. \n\n\n## AIMA Chapter 27.1 The Limits of AI\n LImits of AI has different angles. 1.The argument from informality. Turing argued that human behavior is far too complex to be captured by any formal set of rules. Hubert Dreyfus produced a series of influential critiques of artificial intelligence. The technology they criticize came to be called Good Old-Fashioned AI (GOFAI). \\ \nComputers can be beautiful, kind, resourceful, beautiful, friendly, have initiative, have a sense of humor, tell right from wrong, make mistakes, fall in love, enjoy strawberries and cream, use words properly. The one thing that they can't do is be exactly human. Gödel's incompleteness is the idea that certain mathematical questions are in principle unanswerable by particular formal systems. For any formal axiomatic framework powerful enough to do arithmetic, it is possible to construct a so-called Gödel sentence. Alan Turing suggested that we should ask whether machines can pass a behavioral test. The test requires a program to have a conversation (via typed messages) with an interrogator for five minutes. It passes the test if it fools the interrogator 30% of the time.\n\n\n## AIMA Chapter 27.1 Can Machines Really Think?\nSome philosophers claim that a machine that acts intelligently would not be actually thinking, but would be only a simulation of thinking. Turing argues that we would extend the polite convention that everyone thinks to machines if only we had experience with ones that act intelligently. John Searle's argument could equally well be used by robots to argue that a human cannot have true understanding. Searle argues that mental states are emergent features that are caused by low-level physical processes in the neurons,and it is the properties of the neurons that matter. Alan Turing concedes that consciousness is a difficult one, but deniesthat it has much relevance to the practice of AI.\n\n\n## AIMA 2.1 Agents and Environments\n An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators. A human agent has eyes, ears, and other organs for sensors and hands, legs, vocaltract, and so on for actuators; a robotic agent might have cameras and infrared range finders for sensors.  An agent's choice of action at any given instant can depend on its built-in knowledge and the entire percept sequence observed to date, but not on anything it hasn't yet. Mathematically speaking, an agent's behavior is described by the agent function that maps any given perceptsequence to an action.  We can imagine tabulating the agent function that describes any given agent. This would be a very large table, unless we place a bound on the length of the sequences we want to consider. The agent function is an abstract mathematical description; the agent program is a concrete implementation. \n\n## AIMA 2.2 Good Behavior: The Concept of Rationality\n A rational agent is one that does the right thing. Moral philosophy has developed several different notions of the \"right thing,\" but AI has stuck to one notion called consequentialism. When an agent is plunked down in an environment, it generates a sequence of actions according to the percepts it receives. If the sequence is desirable, then the agent performed well. What is rational at any given time depends on four things: 1.The performance measure that defines the criterion of success. 2.The agent’s prior knowledge of the environment. 3.The actions that the agent can perform. 4.The agent’s percept sequence to date. So rational agent is For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in knowledge the agent has. An omniscient agent knows the actual outcome of its actions and can act accordingly, but omniscience is impossible in reality. In Paris, a cargo door falls off an airliner and flattens a pedestrian; was it irrational to cross the street? It is unlikely that my obituary would read \"Idiot attempts to cross street\".An agent is an agent that perceives its environment in a particular way and learns as much as possible from what it perceives. The agent's initial configuration could reflect some prior knowledge of the environment, but as the agent gains experience this may be modified or augmented.If an agent relies on the prior knowledge of its designer rather than on its percepts and learning processes, we say that the agent lacks autonomy. For example, a vacuum-cleaning agent that learns to predictwhere and when additional dirt will appear will do better than one that does not.\n\n\n## AIMA 2.3 The Nature of Environments\n We show how to specify a task environment, which is the \"problems\" to which rational agents are \"solutions\". The nature of the task environment determines the appropriate design for an agent program. In designing an agent, the first step is to specify the task environment as fully as possible. We call this the PEAS (Performance, Environment, Actuators, Sensors) description. It includes the performance measure, the environment, and the agent's actuators and sensors. If an agent's sensors give it access to the complete state of the environment at each point in time, then we say that the task environment is fully observable. An environment might be partially observable because of noisy and inaccurate sensors or parts of the state are simply missing from the sensor data. An agent solving a crossword puzzle is clearly in a single-agent environment, but an agent playing chess is in a twoagent environment. Does an agent have to treat an object as an agent, or can it be treated merely as an object behaving according to the law of physics? If the next state of the environment is completely determined by the current state and the action executed by the agent(s), then we say the environment is deterministic. In principle, an agent neednot worry about uncertainty in a fully observable, deterministic environment; if theenvironment is partially observable, however, then it could appear to be nondeterministrative.In an episodic task environment, the agent receives a percept and then performs a single action. Crucially, the next episode does not depend on the actions taken in previous episodes. Episodic environments are much simpler than sequential environments because the agent does not need to think ahead.If the environment can change while an agent is deliberating, then the environment is dynamic for that agent; otherwise, it is static. If the environment itself does not change with the passage of time but the agent's performance score does, then we say the environment  is semidynamic.\n\n\n## AIMA 2.4 The Structure of Agents\n The job of AI is to design an agent program that implements the agent function. We assume this program will run on some sort of computing device with physical sensors and actuators. The architecture might be just a PC, or it might be a car with onboard computers, cameras, and other sensors. \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* **Nlp** - a task helps to communicate successfullly in a human language\n* **Knowledge representation** - to store what it knows or hears\n* **Automated reasoning** - to answer questions and to draw new conclusions\n* **Machine learning** - to adapt to new circumstances and to detect and extrapolate patterns\n* **Rational agent** - is one that acts so as to achieve the best outcome or, when there is uncertainty, the best expected outcome.\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 GOAL FORMULATION: The agent adopts the goal of reaching Bucharest. Goals organize behavior by limiting the objectives and hence the actions to be considered. PROBLEM FORMULATION: To work out how to get there, the agent devises a description of the states and actions necessary to reach the goal. The only fact about the world that will change due to an action is the current city. SEARCH: It searches until it finds a sequence of actions that reaches its goal. Such a solution is called a solution; an agent might have to simulate multiples of equences that do not reach the goal.EXECUTION: The agent can now execute the actions in the solution, one at a time.\n\n\n## AIMA Chapter 3.2 Example Problems\n The problem-solving approach has been applied to a vast array of human androbotological problems. A standardized problem is intended to illustrate or exercise various problemsolving methods. A real-worldproblem, such as robot navigation, is one whose solutions people actually use, and whose formulation is idiosyncratic. \n\n## AIMA Chapter 3.3 Search Algorithms\n A search algorithm takes a search problem as input and returns a solution, or an indication of failure. In this chapter we consider algorithms that superimpose a search tree over the state-space graph. Each node in the search tree corresponds to a state in the state space.  It is important to understand the difference between the state space and the search tree. The state space describes the (possibly infinite) set of states in the world, and the actionsthat allow transitions from one state to another. The search tree describes paths betweenthese states, reaching towards the goal. \n\n## AIMA Chapter 3.4 Uninformed Search Strategies\n An uninformed search algorithm is given no clue about how close a state is to the goal. An informed agent who knows the location of each city knows that Sibiu is much closer to Bucharest and thus more likely to be on the shortest path. \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 An informed search strategy that uses domain-specific hints about the location of goals can find solutions to problems more efficiently than an uninformed strategy. \n\n## AIMA Chapter 3.6 Heuristic Functions\n The performance of heuristic search algorithms depends on the quality of the heuristic function. One can sometimes construct good heuristics by relaxing the problem definition, by storing precomputed solution costs for subproblems in a pattern database, by defining landmarks, or by learning from experience with the problem class. \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 There are at least three stances we can take towards multi-agent environments. 1. aggregate as an economy. 2. consider agents as just a part of the environment. 3. model with adversarial game-tree search. \n\n## AIMA Chapter 5.2 Optimal Decisions in Games\n MAX wants to find a sequence of actions leading to a win, but MIN has something to say about these actions. In games that have a binary outcome, we could use AND–OR search. For games with multiple outcome scores, we need a slightly more general algorithm called minimax search. \n\n## AIMA Chapter 5.3 Heuristic Alpha–Beta Tree Search\n Heuristic Alpha–Beta Tree Search: To make use of our limited computation time, we can cut off the search early and apply a  heuristic evaluation function to states. This means that we no longer treat nonterminal nodes as if they were terminal. \n\n## AIMA Chapter 5.5 Stochastic Games\n Stochastic games bring us a little closer to the unpredictability of real life by including a random element, such as the throwing of dice. Expected value of a position: The average over all possible outcomes of the chance nodes. \n\n## AIMA Chapter 16.1 Combining Beliefs and Desires under Uncertainty\n In decision theory, an agent chooses among actions based on the desirability of their immediate outcomes; that is, the environment is assumed to be episodic. The agent'spreferences are captured by a utility function, which assigns a single number to each state. The principle of maximum expected utility (MEU) says that a rational agent should choose the action that maximizes the agent’s expected utility. \n \n\n## AIMA Chapter 16.2 The Basis of Utility Theory\n ORDERABILITY: Given any two lotteries, a rational agent must either prefer one or else rate them as equally preferable. TRANSITIVITY: Given any three lotteries, if an agent prefers A to B and prefers B to C, then the agent must prefer A to C. \\  \nCONTINUITY: If some lottery B is between A and C in preference, then there is some probability p for which the rational agent will be indifferent between getting B for sure and the lottery that yields A with probability p and C with probability 1 - p. SUBSTITUTABILITY: If an agent is indifferent between two lotteries A and B, then the agent is indifferent between two more complex lotteries that are the same except that B is substituted for A in one of them. This holds regardless of the probabilities and the other outcome(s) in the lotteries MONOTONICITY: Suppose two lotteries have the same two possible outcomes, A and B. If an agent prefers A to B, then the agent must prefer the lottery that has a higher probability for A (and vice versa). DECOMPOSABILITY: Compound lotteries can be reduced to simpler ones using the laws of probability. This has been called the “no fun in gambling” rule: it compresses two consecutive lotteries into a single equivalent lottery. \n\n\n## AIMA Chapter 16.3 Utility Functions\n People use the value of a statistical life to determine the costs and benefits of regulations and interventions. One common “currency” used in medical and safety analysis is the micromort, a one in a million chance of death.Another measure is the QALY, or quality-adjusted life year. We say that the agent exhibits a monotonic preference for more money. Decision theory is a normative theory: it describes how a rational agent should act. A descriptive theory, on the other hand, describes how actual agents—for example, humans really do act.\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 A constraint satisfaction problem consists of three components, X D and C: X is a set of variables. D is a set of domains, one for each variable. C is a set of constraints that specify allowable combinations of values. CSPs deal with assignments of values to variables. An assignment that does not violate any constraints is called a consistent or legal assignment. A complete assignment is one in which every variable is assigned a value, and a solution to a CSP is a consistent, complete assignment. A partial assignment is one that leaves some variables unassigned, and a partial solution is a partial assignment that is consistent.\n\n## AIMA Chapter 6.2 Constraint Propagation: Inference in CSPs\n An atomic state-space search algorithm makes progress by expanding a node to visit its successors. A CSP algorithm has choices. It can generate successors by choosing a new variable assignment, or it can do a specific type of inference called constraint propagation. If we treat each variable as a node in a graph and each binary constraint as an edge, then the process of enforcing local consistency in each part of the graph causes inconsistent values to be eliminated. There are different types of local consistency, which we now cover in turn.\n\n## AIMA Chapter 6.3 Backtracking Search for CSPs\n Backtracking search for CSPs: It repeatedly chooses an unassigned variable, and then tries all values in the domain of that variable in turn, trying to extend each one into a solution via a recursive call. If the call succeeds, the solution is returned, and if it fails, the assignment is restored to the previous state, and we try the next value. If no value works then we return failure.\n \n\n## AIMA Chapter 6.4 Local Search for CSPs\n Local search algorithms are very effective in solving many CSPs. They use a complete-state formulation where each variable is assigned a value, and the search changes the value of one variable at a time. The most obvious approach is to select the value that results in the minimum number of conflicts with other variables. \n\n## AIMA Chapter 6.5 The Structure of Problems\n The only way we can possibly hope to deal with the vast real world is to decompose it into subproblems. In this section, we examine ways in which the structure of the problem, as represented by the constraint graph, can be used to find solutions quickly. Independence can be ascertained simply by finding connected components of the constraint graph. Each component corresponds to a subproblem. Dividing aBoolean CSP with 100 variables into four subproblems reduces the worst-case solution time down to less than a second.A CSP is defined to be directional arc-consistent an ordering of variables. The key is a new notion of consistency, called directional arc consistency or DAC. We will show that any tree-structured CSP can be solved in time linear in the number of variables.To solve a tree-structured CSP, first pick any variable to be the root of the tree. Since each edge from a parent to its child is arc-consistent, we know that for any value we choosefor the parent there will be a valid value left to choose for the child.\n\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 A knowledge-based agent is an agent with a knowledge base, or KB. A knowledge base is a set of sentences that represent some assertion about the world. When the sentence is taken as being given without being derived from other sentences, we call it an axiom. There must be a way to add new sentences to the knowledge base, and another way to query what is already known. The operations TELL and ASK may involve inference, which means deriving new sentences from old ones. Inference must ensure that the answer to an ASK does not \"make things up as it goes along\".\n\n## AIMA Chapter 7.2 The Wumpus World\n The wumpus world is a cave consisting of rooms connected by passageways. Some rooms contain bottomless pits that will trap anyone who enters. The only redeeming feature is the possibility of finding a heap of gold. It illustrates some important points about intelligence in computer games. \n\n## AIMA Chapter 7.3 Logic\n A logic must also define the semantics, or meaning, of sentences. The semantics defines the truth of each sentence with respect to each possible world. When we need to be precise, we use the term model in place of “possible world.” Whereas possible worlds might be thought of as (potentially) real environments that the agent might or might not be in, models are mathematical abstractions, each of which has a fixed truth value (true or false) for every relevant sentence.  \n\n## AIMA Chapter 7.4 Propositional Logic: A Very Simple Logic\n We now present propositional logic. We describe its syntax (the structure of sentences) and its semantics (the way in which the truth of sentences is determined). From these, we derive a simple, syntactic algorithm for logical inference that implements the semantic notion of entailment. \n\n## AIMA 7.5 Propositional Theorem Proving\n Theory proving can be more efficient than model checking because it allows us to construct a proof of the desired sentence without consulting models. If the number of models is large but the length of the proof is short, thentheorem proving can provide an efficient way to prove that a given sentence is correct. \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": {}
        }
      ]
    }
  ]
}