9618/31/M/J/21 question 5: worked solution (May/June 2021, paper 31)

Show as plain text

Cambridge A2 Level Computer Science 9618 · 18.1 Artificial Intelligence (AI) Worked solution from the Artificial Intelligence (AI) Paper 3 Advanced Theory booklet, Part 1 of 1. Q1 9618/31/M/J/21 original Q5 Structured · 8 marks Worked solution (a) Dijkstra's algorithm: give the start town (Base) a distance of 0 and every other town a distance of ∞. Then repeatedly visit the unvisited town with the smallest distance and update its neighbours. Working: Base = 0; Town 1 = ∞, Town 2 = ∞, Town 3 = ∞, Town 4 = ∞, Town 5 = ∞, Town 6 = ∞. Write: Base set to 0 and all other towns set to ∞ [1] Visit Base. Update: Town 1 = 4, Town 2 = 5, Town 3 = 2. Visit Town 3 (smallest, 2). Update: Town 1 = 2 + 1 = 3 (better than 4), Town 5 = 2 + 1 = 3. Visit Town 1 (3): Town 4 = 3 + 7 = 10. Visit Town 5 (3): Town 2 = 3 + 3 = 6 (worse than 5, keep 5), Town 4 = 3 + 6 = 9 (better than 10), Town 6 = 3 + 5 = 8. Visit Town 2 (5): Town 6 = 5 + 8 = 13 (worse than 8, keep 8). Write: values at the nodes updated and visited nodes shown [1] Write: more than one route worked out for at least one town , for example Town 4 = 10 or 9, Town 6 = 13 or 8, Town 1 = 4 or 3 [1] Town 1 Town 2 Town 3 Town 4 Town 5 Town 6 3 5 2 9 3 8 Four of the six values correct [1] All six values correct [1] (b) Write any three of these points: Graphs give a structure that shows relationships between nodes (for example places and the links between them). [1] An AI problem can be defined or solved as finding a path in a graph . [1] Graphs can be used by algorithms such as A * or Dijkstra's algorithm , which are used in machine learning. [1] Also accepted: artificial neural networks can be shown as graphs, and methods such as back propagation of errors or regression work on them. KEY IDEA Dijkstra starts at 0, always visits the nearest unvisited node and keeps only the shorter route each time a node is reached again. TOTAL 8 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by The CS Classroom. Tap the picture to open it on YouTube.