Log in Sign up
Back to Discover
💻

Dynamic programming

technology Maturity 9-11

Some big jobs are hard.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
You can break them down. Make many small jobs instead. This helps you find the best way. It makes big jobs easy. Do you like solving puzzles?

36 words

Some big jobs are very hard.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
You can break them down. Make many small jobs instead. This helps you find the best way. This is a smart way to work.
Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg
It can help computers find paths. It can even help with science. It helps us solve big puzzles. It makes big jobs easy.

60 words

Sometimes a big problem is too hard to solve at once.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg

Richard Bellman created a smart way to fix this. He called it dynamic programming. This method breaks a big job into smaller parts. These parts are called sub-problems.

To use this way, a problem needs two things. First, it needs optimal substructure. This means the best answer to the big problem comes from the best answers to the small parts.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg

Second, it needs overlapping sub-problems. This happens when you see the same small job many times. Instead of doing the same work twice, you save the answer. We call this memoization. It is like writing an answer in a notebook so you can look it up later.

There are two ways to do this. A top-down way starts with the big goal. It breaks it down and saves the small answers. A bottom-up way starts with the smallest parts first. It builds them up to solve the big goal.

Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg

People use this in many fields. It helps in economics to plan saving. It helps in science to study tiny parts of life. It even helps computers find the shortest path on a map.

205 words

Sometimes a huge problem is too hard to solve all at once.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
Dynamic programming is a smart way to handle these hard jobs. It is both a mathematical method and a way to write computer programs. This method works by breaking a big, complicated problem into smaller, easier pieces. These smaller pieces are called sub-problems. By solving these little parts, we can eventually find the best answer to the whole thing. This approach is used in many areas, like economics and aerospace engineering.

To use this method, a problem must have two special features. The first is called optimal substructure. This means the best answer to a big problem is made of the best answers to its small parts.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
For example, the shortest path between two points on a map is made of shorter paths between points in the middle. The second feature is overlapping sub-problems. This happens when the same small job appears many times while you are working. Instead of doing the same work over and over, you solve it once and save the answer.
Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg

A man named Richard Bellman developed this method in the 1950s. He created a way to link the value of a large problem to its smaller parts. In math, this link is called the Bellman equation. He showed that you can solve problems by working backward through time. You start at the end and figure out the best steps to get there. This is called backward induction. It helps people make a sequence of smart decisions over time.

Computer scientists use two main ways to apply these ideas. The top-down approach starts with the big goal and breaks it down. It uses something called memoization, which is like keeping a notebook of answers.

Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg
When the computer sees a problem it has already solved, it just looks up the answer. The bottom-up approach works the opposite way. It starts with the smallest possible parts first. It then uses those small answers to build up to the bigger ones.

This math helps us understand many different parts of our world. In economics, it helps people plan how much to save or spend over a lifetime. In biology, it helps scientists study how tiny parts of life like proteins work.

Tower of Hanoi.jpeg
Tower of Hanoi.jpeg
Scientists even use it to see how DNA and proteins bind together. Some of the first tools for this were made in the 1970s. Researchers like Charles DeLisi in the US worked on these ideas. They helped make modern biology much more powerful.

434 words

Dynamic programming is a powerful mathematical optimization method and an algorithmic paradigm. It is used to solve complex problems by breaking them down into simpler, smaller pieces called sub-problems. This process is done in a recursive manner, meaning the solution to a large problem depends on the solutions to its smaller parts. By solving these smaller parts, we can eventually find the best possible solution for the entire system. This method is essential in many scientific fields, including aerospace engineering, economics, and computer science.

To apply dynamic programming, a problem must possess two specific attributes. The first is optimal substructure. This means the optimal solution to a problem can be found by combining the optimal solutions of its sub-problems.

Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
For instance, if you are finding the shortest path between two points, any segment of that path must also be the shortest path between its own endpoints. The second attribute is overlapping sub-problems. This occurs when a recursive process solves the same small problems repeatedly. Instead of recalculating these same values, dynamic programming ensures each sub-problem is solved only once.

In the context of mathematical optimization, the method simplifies decisions by breaking them into a sequence of steps over time. This involves defining a sequence of value functions, denoted as V1, V2, and so on, to represent the state of a system at different times. To find the best path, mathematicians often use backward induction. They start at the final time, n, and work backward to the initial time, 1. This process uses a recursive relationship known as the Bellman equation. By calculating the value of the system at earlier times based on the values at later times, the optimal solution can be recovered step by step.

Control theory uses these principles to find an optimal control law or policy. This policy helps a system follow a specific path while minimizing a cost function. The mathematical foundation for this is the Hamilton–Jacobi–Bellman equation, which is a partial differential equation. In practical applications, scientists often use numerical techniques to create a discrete approximation of this continuous relationship. This allows them to solve complex movement and stability problems in engineering through manageable, step-by-step calculations.

Economists use dynamic programming to study how people make choices over time, such as in Ramsey's problem of optimal saving. In this model, a planner must choose between consuming resources now or investing them to allow for future consumption. This is known as an intertemporal choice. Because future utility is often discounted by a constant rate, the problem can be broken into a sequence of smaller decisions. Using the Bellman equation, economists can calculate the optimal amount of wealth to consume at different stages of a person's life. This reveals that it is often optimal to consume a larger fraction of wealth as a person gets older.

In computer science, there are two primary ways to implement these ideas: top-down and bottom-up approaches. The top-down approach follows the recursive formulation of the problem directly. It uses a technique called memoization, which involves storing the results of sub-problems in a table, such as an array or a hash table.

Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg
When the computer encounters a sub-problem it has already solved, it simply looks up the answer in the table. The bottom-up approach works in the opposite direction. It starts by solving the smallest, simplest sub-problems first and then uses those results to build toward the larger, more complex solutions.

Dynamic programming has also become a vital tool in the field of bioinformatics. It is used for essential tasks like sequence alignment, protein folding, and predicting RNA structures. These processes help scientists understand the very building blocks of life. The use of these algorithms for studying protein-DNA binding began in the 1970s. Researchers like Charles DeLisi in the United States, along with Georgii Gurskii and Alexander Zasedatelev in the Soviet Union, developed these early methods independently. Today, these techniques are used to study how transcription factors bind to DNA and how nucleosomes are positioned in cells.

671 words
🖼️ Images & Media (4)
File:Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
File:Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg
File:Tower of Hanoi.jpeg
Tower of Hanoi.jpeg
File:Tower of Hanoi 4.gif
Tower of Hanoi 4.gif
Up Next
💻
Divide-and-conquer algorithm
Technology
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.