AQA 7517, section 4.4.1.11
Computer science is about building clean, abstract models (abstractions) of messy, noisy, real-world objects and events. Computer scientists must choose what to include in a model and what to discard, deciding the minimum amount of detail needed to solve a problem to the required degree of accuracy.
Automation is about putting those models into action to solve problems. A model sitting on paper solves nothing, so it has to be made to run.
The four steps of automation
Automation is achieved by:
- Creating algorithms that perform actions on, and with, the modelled data.
- Implementing the algorithms in program code (instructions).
- Implementing the models in data structures.
- Executing the code.
| Step | What happens | Example (bus timetable) |
|---|---|---|
| Model | Simplify the real world | Stops as nodes, journeys as weighted edges |
| 1. Algorithm | Design the method | Dijkstra's shortest path |
| 2. Program code | Write the instructions | Python subroutines |
| 3. Data structures | Store the model | A dictionary holding the graph |
| 4. Execute | Run it | The program finds the quickest route |
Example: a route planner
The messy real world: roads with traffic, weather, bends and speed limits.
The model (abstraction): a weighted graph. Junctions are nodes, roads are edges, and the weight is the journey time. Everything else is discarded.
Automating it:
# 3. The model, held in a data structure
roads = {
"A": [("B", 4), ("C", 2)],
"B": [("A", 4), ("D", 5)],
"C": [("A", 2), ("D", 8)],
"D": [("B", 5), ("C", 8)],
}
# 1 and 2. The algorithm, written as code
def quickest(graph, start, end):
dist = {v: float("inf") for v in graph}
dist[start] = 0
todo = set(graph)
while todo:
v = min(todo, key=lambda x: dist[x])
todo.remove(v)
for nbr, w in graph[v]:
dist[nbr] = min(dist[nbr], dist[v] + w)
return dist[end]
# 4. Execute
print(quickest(roads, "A", "D")) # 9
The result, 9, is the quickest journey time from A to D. It's found by A to B (4) then B to D (5), which beats A to C to D (10).
Why automate?
- A computer carries out the steps quickly and without mistakes from tiredness.
- It can handle huge amounts of data that humans couldn't.
- Once written, the program can be run again and again with different inputs.
The accuracy of a model
A model is only as good as the choices made about what to include and what to discard. If the route planner ignored one-way streets, the answers would be wrong. If it modelled every pothole, it would be far too slow. The art is to include just enough detail for the required accuracy.
Worked example
Task: describe how a weather forecasting system is an example of automation.
- Model: the atmosphere is represented as a grid of cells, each with temperature, pressure, humidity and wind speed. Many real-world details are discarded.
- Algorithms: rules from physics describe how each cell's values change over time and affect its neighbours.
- Data structures: the grid is stored as a large multi-dimensional array.
- Program code: the algorithms are written as a program.
- Execution: supercomputers run the program for each time step, producing the forecast.
Exam tip: learn the four steps (algorithms, program code, data structures, execution) and apply them to the scenario in the question. Mention that the model is an abstraction, and that automation is what makes it work.
Check yourself
What is automation?
Putting models (abstractions of real-world objects or phenomena) into action to solve problems.
Give the four things that automation involves
Creating algorithms, implementing the algorithms in program code, implementing the models in data structures, and executing the code.
What choice must a computer scientist make when building a model?
What to include and what to discard, so the model has the minimum detail needed to solve the problem to the required degree of accuracy.