Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

344 lines
9.6 KiB

  1. CSCI-331 Intro to Artificial Intelligence exam 1 review.
  2. # Chapter 1 What is AI
  3. ## Thinking vs Acting
  4. ## Rational Vs. Human like
  5. Acting rational is doing the right thing given what you know.
  6. Thinking rationality:
  7. - Law of though approach -- thinking is all logic driven
  8. - Neuroscience -- how brains process information
  9. - Cognitive Science -- information-processing psychology prevailing orthodoxy of hehaviorism
  10. # Chapter 2 Intelligent Agents
  11. An agent is anything that can view environment through sensors and act with actuators.
  12. A rational agent is one that does the right thing.
  13. ![Simple Agent](media/exam1/agent.png)
  14. ## PEAS
  15. PEAS is an acronym for defining a task environment
  16. ### Performance Measure
  17. Measure of how well agent is performing.
  18. Ex: safe, fast, legal, profits, time, etc.
  19. ### Environment
  20. Place in which the agent is acting.
  21. Ex: Roads, pedestrians, online, etc.
  22. ### Actuators
  23. Way in which agent acts.
  24. Ex: steering, signal, jump, walk, turn, etc.
  25. ### Sensors
  26. Way which the agent can see the environment.
  27. Ex: Cameras, speedometer, GPS, sonar, etc.
  28. ## Environment Properties (y/n)
  29. ### Observable
  30. Full observable if agent has access to complete state of environment at any given time.
  31. Partially observable if agent can only see part of environment.
  32. ### Deterministic
  33. If the next state of environment is completely determined by current state it is **deterministic**, otherwise it is **stochastic**.
  34. ### Episodic
  35. If agents current actions does not affect the next problem/performance then it is **episodic**, otherwise it is **sequential**
  36. ### Static
  37. If environment changes while agent is deliberating it is **dynamic** otherwise it is **static**.
  38. ### Discrete
  39. If there are a finite number of states in the environment it is **discrete** otherwise it is **continuous**.
  40. ### Single-Agent
  41. Only one agent in environment like solving a crossword puzzle. A game of chess would be **multi-agent.
  42. ## Agent Types
  43. ### Simple Reflex
  44. Simply responds to a given input based on a action rule set.
  45. ![Reflex agent](media/exam1/reflexAgent.png)
  46. ### Reflex with state
  47. Understands to some extend how the world evolves.
  48. ![Reflex with State](media/exam1/reflexWithState.png)
  49. ### Goal-based
  50. ![Goal Based](media/exam1/goalBased.png)
  51. ### Utility-based
  52. ![Goal Based](media/exam1/utilityBased.png)
  53. ### Learning
  54. ![Goal Based](media/exam1/learningAgent.png)
  55. # Chapter 3 Problem Solving Agents
  56. ## Problem Formulation
  57. Process of deciding what actions and states to consider, given a goal.
  58. ### Initial State
  59. The state that the agent starts in.
  60. ### Successor Function
  61. A description of the actions available to the agent.
  62. ### Goal Test
  63. Determines whether a given state is the goal.
  64. ### Path Cost (Additive)
  65. A function that assigns a numerical cost to each path. The step cost is the number of actions required.
  66. ## Problem Types
  67. ### Deterministic, fully observable => single-state problem
  68. Agent knows exactly which state it will be in; solution is a sequence.
  69. ### Non-observable => conformant problem
  70. Agent may have no idea where it is; solution (if any) is a sequence
  71. ### Non-deterministic and/or partially observable => Contingency problem
  72. - Percepts provide new information about current state
  73. - solution is a contingent plan or a policy
  74. - often interleave search, execution
  75. ### Unknown state space => exploration problem
  76. Exploration problem
  77. # Chapter 3 Graph and tree search for single-state problems
  78. ## Uniformed
  79. AKA blind search.
  80. All they can do is generate successors and distinguish a goal state from a non-goal state;
  81. they have no knowledge of what paths are more likely to bring them to a solution.
  82. ![Criterion summary table](media/exam1/uninformedSearches.png)
  83. ### Breadth-first
  84. General graph-search algo where shallowest unexpanded node is chosen first for expansion.
  85. This is implemented by using a FIFO queue for the frontier.
  86. The solution will be ideal if the path cost between each node is equal.
  87. ![Breadth first algo](media/exam1/breadthFirstAlgo.png)
  88. ### Depth-first
  89. You expand the deepest unexpanded node first.
  90. Implementation: the fringe is a LIFO queue.
  91. #### Depth Limited Search
  92. To avoid an infinite search space, depth limited search provides a max depth that the search algo is willing to traverse.
  93. ![Depth limited search](media/exam1/depthLimited.png)
  94. ### Uniform-cost
  95. Instead of expanding shallowest nodes, **uniform-cost search** expands the node *n* with lowest path cost: g(n).
  96. Implementation: priority queue ordered by *g*.
  97. ![Uniform cost search](media/exam1/uniformCostSearch.png)
  98. ## Informed
  99. Using problem-specific knowledge, applies an informed search strategy which is often more efficient than uninformed strategies.
  100. ### Greed best-fit
  101. Tries to expand node that is closest to goal. It evaluates each node by the heuristic function:
  102. $$
  103. f(n) = h(n)
  104. $$
  105. A common heuristic used is the euclidean distance (straight line distance) to the solution.
  106. Note: this search method can be incomplete since it can still get caught in infinite loops if you don't use a graph search method or implement an max depth.
  107. ### A*
  108. Regarded as the best best-first search algo.
  109. Combines heuristic distance estimate with actual cost.
  110. $$
  111. f(n) = g(n) + h(n)
  112. $$
  113. *g* gives the cost of getting from the start node to the current node.
  114. In order for this to give optimal cost, *h* must be an **admissible heuristic**: an heuristic which never overestimates the cost to reach the goal.
  115. - Complete?? no
  116. - Time?? $O(b^{d + 1})$ same as breadth first search but usually faster
  117. - Space?? $O(b^{d + 1})$ keeps every node in memory
  118. - Optimal?? Only if the heuristic is admissible.
  119. ## Evaluation
  120. ### Branching factor
  121. ### Depth of least-cost solution
  122. ### Maximum depth of tree
  123. ### Completeness
  124. Is the algo guaranteed to fina a solution if there is one.
  125. ### Optimality
  126. Will the strategy find the optimal solution.
  127. ### Space complexity
  128. How much memory is required to perform the search.
  129. ### Time complexity
  130. How long does it take to find the solution.
  131. ## Heuristics
  132. A heuristic function *h(n)* estimates the cost of a solution beginning from the state at node *n*.
  133. ### Admissibility
  134. These heuristics can be derived from a relaxed version of a problem.
  135. Heuristic must never overestimate the cost to reach the goal.
  136. ### Dominance
  137. If one heuristic is greater than another for all states *n*, then it dominates the other.
  138. Typically dominating heuristics are better for the search.
  139. You can form a new dominating admissible heuristic by taking the max of two other admissible heuristics.
  140. # Chapter 4 Iterative Improvement
  141. Optimization problem where the path is irrelevant, the goal state is the solution.
  142. Rather than searching through all possible solutions, iterative improvement takes the current state and tries to improve it.
  143. Since the solution space is super large, it is often not possible to try every possible combination.
  144. ## Hill Climbing
  145. Basic algorithm which continually moves in the direction of increasing value.
  146. ![Hill Climbing Graph](media/exam1/hillClimbing.png)
  147. ![Hill Climbing Algo](media/exam1/hillClimbingAlgo.png)
  148. To avoid finding a local maximum several methods can be employed:
  149. - Random-restart hill climbing
  150. - Random sideways move -- escapes from shoulders loop on flat maxima.
  151. ## Simulated annealing
  152. Idea: escape local maxima by allowing some bad moves but gradually decrease their size and frequency.
  153. This is similar to gradient descent.
  154. Idea comes from making glass where you start very hot and then slowely cool down the temperature.
  155. ## Beam Search
  156. Idea: keep k states instead of 1; choose top k of their successors.
  157. Problem: quite often all k states end up on same local hill. This can somewhat be overcome by randomly choosing k states but, favoring the good ones.
  158. ## Genetic Algorithms
  159. Inspired by Charles Darwin's theory of evolution.
  160. The algorithm is an extension of local beam search with cuccessors generated from pairs of individuals rather than a successor function.
  161. ![GA overview](media/exam1/gaOverview.png)
  162. ![Genetic Algorithm Pseudo Code](media/exam1/gaAlgo.png)
  163. # Chapter 5 Game Theory
  164. ## Minimax
  165. Algorithm to determine perfect play for deterministic, perfect information games.
  166. Idea: assume opponent is also a rational agent, you choose to make the choice which is the best achievable payoff against the opponents best play.
  167. ![Minimax](media/exam1/miniMax.png)
  168. ![Minimax algo](media/exam1/miniMaxAlgo.png)
  169. ### Properties
  170. - complete: yes if tree is finite
  171. - optimal: yes, against an optimal opponent
  172. - Time complexity: $O(B^m)$
  173. - Space Complexity: $O(bm)$ depth-first exploration
  174. This makes a game of chess with a branch factor of 35 and estimated moves around 100 totally infeasible: 35^100!
  175. ## α-β pruning
  176. Idea: prune paths which will not yield a better solution that one already found.
  177. The pruning does not affect the final result.
  178. Good move exploration ordering will improve the effectiveness of pruning.
  179. With perfect ordering, time complexity is: $O^{\frac{m}{2}}$.
  180. This doubles our solvable depth, but, still infeasible for chess.
  181. ![Alpha Beta Search Tree](media/exam1/alphaBetaTree.png)
  182. ![Alpha Beta Algo](media/exam1/alphaBetaAlgo.png)
  183. ## Resource limits
  184. Due to constraint, we typically use the **Cutoff-test** rather than the **terminal-test**.
  185. The terminal test requires us to explore all nodes in the mini-max search.
  186. The cutoff test branches out to a certain depth and then applies a evaluation function to determine the desirability of a position.
  187. ## Randomness/ Nondeterministic games
  188. Often times games involve chance such as a coin flip or a dice roll.
  189. You can modify the mini-max tree to branch with each probability and take the average of evaluating each branch.
  190. ![Non Deterministic game](media/exam1/nonDeterministicTree.png)