Problem Recognition, Decomposition and Abstraction

Icodewithben
9 min readDec 2, 2023

--

Video explaining this arcticle: https://youtu.be/xNADeShKZBw

Video discussing how to answer PPQ on this topic: https://youtu.be/pTzqSxqEsrg

What problems can be solved (tractable problems) and which ones cannot be solved (intractable problems)? What are the features of a tractable problem?

Some problems are tractable, solvable, and some are intractable unsolvable

In the realm of problem-solving, especially in the context of computer science, there are several key features that make a problem more amenable to solution by computational methods. These features can be seen as strategies or approaches to problem-solving that allow us to effectively design algorithms and apply computational techniques. Here are four critical features with relatable examples:

Features of a computational problem: Abstraction and Decomposition, Enumeration, Theoretical Approach, Simulation and Automation from https://www.youtube.com/watch?v=r2c_SfdEQ84

1. Abstraction and Decomposition

Abstraction is about identifying the core aspects of a problem while ignoring irrelevant details. Decomposition involves breaking down a complex problem into smaller, more manageable parts.

Abstraction: Consider the London Underground. If you drew a to-scale map to represent the actual distances between station and the orientation of the lines, the map would look messy and be too large. So abstracting the problem, or the map, into one that represents the positions of the stations and rough distance between them is a much better solution.

The famous London Underground map designed by Harry Beck in 1931 is a prime example of Abstraction, where he presented the network as an easily navigable, electrical schematic-inspired design, which has been emulated worldwide by transit systems.

Decomposition can be applied to the example of the London Underground map by breaking down the complex task of creating a user-friendly and informative map into smaller, more manageable components. Here’s how decomposition could be applied in stages:

  1. Identify the Core Components: Decompose the map into its essential elements: stations, lines, and connections between stations.
  2. Simplify Individual Elements: Focus on one line at a time, stripping away the exact geographical data and instead representing it as a straight or gently curving line connecting a series of dots (stations).
  3. Create a Hierarchy of Information: Determine what information is most important for travelers. Major transfer stations might be given prominence, while smaller stations might be simplified or spaced differently to reduce clutter.
  4. Standardize Distances and Angles: Instead of representing true distances, standardize the spacing between stations to make the map more legible. Similarly, use a limited set of angles (such as 45 or 90 degrees) for the lines to make the map visually cleaner.
  5. Overlay a Grid: Use a grid to organize the stations and lines into a coherent structure, ensuring that the relative positions remain consistent.

By decomposing the problem of designing a complex, geographically accurate map into these smaller tasks, the design process becomes more manageable. Each step builds upon the previous one, gradually transforming detailed geographic data into an abstracted map that is useful for travelers.

2. Enumeration

Enumeration is the methodical consideration of all possible solutions until the correct one is found. It’s exhaustive and is often used for problems with a finite set of possible answers.

An example of enumeration could be the process of cracking a numerical padlock. Suppose a padlock uses a 4-digit code, and you’ve forgotten the combination. To open it, you might systematically try every possible combination from 0000 to 9999 until you find the correct one. This method is known as a brute-force attack in computer science.

The enumeration process in this context involves:

1. Starting at 0000.
2. Moving to the next possible combination, 0001.
3. Continuing this incrementation for each digit, rolling over like an odometer when you reach the last digit of a series (for example, after 9999, you would have tried all combinations).
4. Stopping when the padlock opens, which confirms you’ve found the correct combination.

This brute-force method guarantees that you will eventually find the correct combination, assuming you have the time and patience to go through all the possibilities. In the context of computer science, similar methods are used to test all possible inputs to functions or to find solutions to problems with a limited set of possible answers. However, this method is generally inefficient for problems with a large solution space, which is why it’s typically only used when more elegant, efficient methods are not available.

3. Theoretical Approach

If a problem can be modeled using pure theory, such as mathematical equations or logical relationships, it becomes more tractable. Computers excel in handling these theoretical models to produce solutions.

Example: Balancing a checkbook is a simple theoretical problem. Each transaction is an equation affecting the balance. By representing each transaction mathematically, software can quickly calculate your current balance and predict future financial scenarios.

4. Simulation and Automation

Simulation involves creating a model of a real-world system to predict its behavior. Automation takes repetitive, well-defined tasks and uses algorithms to complete them without human intervention.

Example: Weather forecasting involves simulating the Earth’s atmosphere using complex mathematical models. By inputting current data, computers can simulate weather patterns to predict future conditions. In a factory, automation is exemplified by assembly line robots that consistently and precisely perform tasks such as welding or painting, which are repetitive and can be algorithmically defined.

Each of these approaches helps turn a seemingly intractable issue into a series of logical steps that can be addressed one by one. In the digital age, where data and processes can be overwhelming, these strategies are not just useful but essential for making sense of the complex problems we face in various fields — from engineering to finance, from logistics to artificial intelligence.

Problem Recognition

Problem recognition is a critical first step in the problem-solving process. It involves identifying that a problem exists and understanding its nature before attempting to find a solution. Using the example of traffic at a crossroads, let’s delve into how one might recognize and begin to address problems related to traffic lights.

How can you recognise and find the right solution for this problem at the traffic lights? Recognise what the problem is in the first place! Ask the right questions and then you find the right solution. Use a first principles approach.

Imagine you are observing a crossroads with traffic lights, and you notice significant congestion. The first step is to acknowledge that there is a problem: the traffic is not flowing as smoothly as it should. This recognition leads to a series of questions aimed at understanding the issue:

1. Is there a problem that needs to be solved?
Yes, there is congestion at the crossroads.

2. What is the exact nature of the problem?
The traffic lights may not be timed optimally, causing unnecessary delays.

3. What data do you need to acquire to fully understand the problem?
You would need traffic flow data, the current timing of the lights, accident reports, and perhaps feedback from commuters.

4. What variables are in play that could alter the current state of the problem?
Variables include the timing of lights, the volume of traffic at different times of the day, the presence of pedestrians, and the impact of nearby intersections.

5. What processes and techniques could solve the current problem should you take into consideration?
Consider traffic engineering principles, such as adjusting the timing of lights, implementing smart traffic control systems that adapt to real-time conditions, or redesigning the intersection.

By approaching the problem at the crossroads from a first principles perspective, you strip it down to its fundamental elements: the flow of traffic and the control mechanism, which is the traffic light system. This approach allows you to formulate hypotheses about why the problem exists and how it might be solved, such as hypothesizing that adjusting the timing of the lights could reduce congestion. Testing these hypotheses with real-world data and observations would lead to a practical solution that alleviates the problem, ultimately improving the flow of traffic at the crossroads.

Extra, the halting problem:

Alan Turing’s Halting Problem is a fundamental concept in computer science that asserts there is no general algorithm that can determine for every possible program-input pair whether the program will eventually stop running or continue forever. This undecidability proof has profound implications, indicating that there are limits to what can be computed.

The Halting Problem is the question of determining, from a description of an arbitrary computer program and an input, whether the program will finish running (halt) or continue to run forever.

The undecidability characteristic of the Halting Problem implies that there is no single algorithm that can solve the Halting Problem for all possible program-input pairs. Here are some traits or scenarios that illustrate undecidability:

  1. Arbitrary Programs: An algorithm must handle every possible program, including the algorithm itself as an input, which leads to paradoxical situations similar to the “liar paradox.”
  2. Self-reference: A program that asks about its own behavior creates a self-referential loop, which is a hallmark of undecidable problems.
  3. All Possible Inputs: The algorithm must determine the outcome for every possible input, which is an infinite set and therefore not computable in a finite amount of time.
  4. Infinite Loops: Detecting whether a program will enter an infinite loop for a given input is a common form of the Halting Problem.
  5. Complexity Beyond Deterministic Computation: Some problems are so complex that they require more than a deterministic step-by-step procedure to resolve for all possible cases.

For example, consider a program P that takes another program Q and an input i as its inputs and determines whether Q halts when run with i. Turing's proof shows that there cannot exist a general-purpose program P that correctly decides whether Q halts for every possible Q and i.

The Halting Problem’s undecidability is a fundamental result that has profound implications for the limits of computation and has led to the identification of other undecidable problems across various domains of computer science and mathematics.

Halting Problem example:

The behavior of Rule 30 is similar to the Halting Problem in that there is no known way to predict the state of an arbitrary cell on the nth line without running the simulation up to that point. The evolution of the pattern appears to be chaotic and does not settle into a repeating or stable state. This unpredictability means that, for large values of n, calculating the state of a particular cell can be computationally intensive as it requires computing all previous states.

By following a simple set of rules about state of adjacent squares you can generate the next line, producing complex patterns. However, it is impossible to generate the nth line without running the simulation. Therefore it is not possible to write a program to determine the outcome of a pattern at a certain line, will halt? Will it start repeating? It is computationally irreducible.

The comparison to the Halting Problem lies in this unpredictability and computational irreducibility. Just as we cannot determine whether an arbitrary program will halt without running it (the Halting Problem), we cannot determine the state of a cell in Rule 30’s evolution without performing the iterative computation from the beginning. This characteristic is a hallmark of what Wolfram calls “computational irreducibility,” where the only way to determine the outcome is to perform the computation.

Past Paper Question 2023:

2023 Algorithms

2021 Past paper question:

H44602 –2021 Algorithms

Question 2020:

November 2020 Algorithms

ANSWER 2023:

Problem Recognition:

  • Description: This is the process of identifying the problem that needs to be solved. It involves understanding the requirements, the constraints, and the goals of the system. For the delivery system, this would mean recognizing the need for efficient route planning, timely deliveries, and minimal overlaps or conflicts in driver schedules.
  • Application: In designing the solution, problem recognition would help programmers define clear objectives for the schedule system, such as reducing travel time, maximizing the number of deliveries, and ensuring customer satisfaction.
  • Benefits: Recognizing the problem ensures that the solution is focused and relevant. It also helps in setting benchmarks for the performance of the system and provides a clear direction for development.

Problem Decomposition:

  • Description: This involves breaking down the complex problem into smaller, more manageable parts. For the delivery schedule, this could involve segmenting the problem into route optimization, delivery prioritization, and driver availability.
  • Application: Each component of the problem can be tackled independently, allowing for specialized algorithms to be used for each part. For example, route optimization can use graph theory, while delivery prioritization may use queueing theory.
  • Benefits: Decomposing the problem makes it easier to manage, allows for parallel development, and facilitates easier testing and debugging. It also enables the use of specialized algorithms that are more efficient for each sub-problem.

Answers 2021:

Answer 2020:

--

--