Considering Algorithm Design
25
Modeling real-world problems
Real-world problems differ from those found in textbooks. When creating a text-
book, the author often creates a simple example to help the reader understand the
basic principles at work. The example models just one aspect of a more complex
problem. A real-world problem may require that you combine several techniques
to create a complete solution. For example, to locate the best answer to a problem,
you may:
1.
Need to sort the answer set by a specific criterion.
2.
Perform some sort of filtering and transformation.
3.
Search the result.
Without this sequence of steps, comparing each of the answers adequately may
prove impossible, and you end up with a less-than-optimal result. A series of algo-
rithms used together to create a desired result is an ensemble. You can read about
their use in machine learning in Machine Learning For Dummies, by John Paul Muel-
ler and Luca Massaron (Wiley). The article at
https://www.toptal.com/machine-
learning/ensemble-methods-machine-learning
gives you a quick overview of
how ensembles work.
However, real-world problems are even more complex than simply looking at
static data or iterating that data only once. For example, anything that moves,
such as a car, airplane, or robot, receives constant input. Each updated input
includes error information that a real-world solution will need to incorporate into
the result in order to keep these machines working properly. In addition to other
algorithms, the constant calculations require the proportional integral derivative
(PID) algorithm (see
http://www.ni.com/white-paper/3782/en/
for a detailed
explanation of this algorithm) to control the machine using a feedback loop. Every
calculation brings the solution used to control the machine into better focus,
which is why machines often go through a settling stage when you first turn them
on. (If you work with computers regularly, you might be used to the idea of itera-
tions. PIDs are for continuous systems; therefore, there are no iterations.) Finding
the right solution is called settling time — the time during which the algorithm
controlling the machine hasn’t yet found the right answer.
When modeling a real-world problem, you must also consider non-obvious issues
that crop up. An obvious solution, even one based on significant mathematical
input and solid theory, may not work. For example, during WWII, the allies had a
serious problem with bomber losses. Therefore, the engineers analyzed every bul-
let hole in every plane that came back. After the analysis, the engineers used their
solution to armor the allied planes more heavily to ensure that more of them
would come back. It didn’t work. Enter Abraham Wald. This mathematician sug-
gested a non-obvious solution: Put armor plating in all the places that lacked
bullet holes (because the areas with bullet holes are already strong enough;
26
Do'stlaringiz bilan baham: |