Home      Discussion      Topics      Dictionary      Almanac
Signup       Login
Dynamic programming

Dynamic programming

Overview
In mathematics
Mathematics
Mathematics is the science and study of quantity, structure, space, and change. Mathematicians seek out patterns, formulate new conjectures, and establish truth by rigorous deduction from appropriately chosen axioms and definitions....

 and computer science
Computer science
Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems. It is frequently described as the systematic study of algorithmic processes that create, describe and transform...

, dynamic programming is a method of solving complex problems by breaking them down into simpler steps. It is applicable to problems that exhibit the properties of overlapping subproblem
Overlapping subproblem
In computer science, a problem is said to have overlapping subproblems if the problem can be broken down into subproblems which are reused several times.For example, the problem of computing the Fibonacci sequence exhibits overlapping subproblems...

s and optimal substructure
Optimal substructure
In computer science, a problem is said to have optimal substructure if an optimal solution can be constructed efficiently from optimal solutions to its subproblems...

 (described below). When applicable, the method takes much less time than naive methods.

Bottom-up dynamic programming simply means storing the results of certain calculations, which are then re-used later because the same calculation is a sub-problem in a larger calculation.
Discussion
Ask a question about 'Dynamic programming'
Start a new discussion about 'Dynamic programming'
Answer questions from other users
Full Discussion Forum
 
Encyclopedia
In mathematics
Mathematics
Mathematics is the science and study of quantity, structure, space, and change. Mathematicians seek out patterns, formulate new conjectures, and establish truth by rigorous deduction from appropriately chosen axioms and definitions....

 and computer science
Computer science
Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems. It is frequently described as the systematic study of algorithmic processes that create, describe and transform...

, dynamic programming is a method of solving complex problems by breaking them down into simpler steps. It is applicable to problems that exhibit the properties of overlapping subproblem
Overlapping subproblem
In computer science, a problem is said to have overlapping subproblems if the problem can be broken down into subproblems which are reused several times.For example, the problem of computing the Fibonacci sequence exhibits overlapping subproblems...

s and optimal substructure
Optimal substructure
In computer science, a problem is said to have optimal substructure if an optimal solution can be constructed efficiently from optimal solutions to its subproblems...

 (described below). When applicable, the method takes much less time than naive methods.

Bottom-up dynamic programming simply means storing the results of certain calculations, which are then re-used later because the same calculation is a sub-problem in a larger calculation. Bottom-up dynamic programming involves formulating a complex calculation as a recursive
Recursion
Recursion, in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition. The term is also used more generally to describe a process of repeating objects in a self-similar way...

 series of simpler calculations.

History


The term was originally used in the 1940s by Richard Bellman
Richard Bellman
Richard Ernest Bellman was an applied mathematician, celebrated for his invention of dynamic programming in 1953, and important contributions in other fields of mathematics.-Biography:...

 to describe the process of solving problems where one needs to find the best decisions one after another. By 1953, he had refined this to the modern meaning, which refers specifically to nesting smaller decision problems inside larger decisions,http://www.wu-wien.ac.at/usr/h99c/h9951826/bellman_dynprog.pdf and the field was thereafter recognized by the IEEE as a systems analysis
Systems analysis
Systems analysis is the interdisciplinary part of science, dealing with analysis of sets of interacting entities, the systems, often prior to their automation as computer systems, and the interactions within those systems. This field is closely related to operations research...

 and engineering
Engineering
Engineering is the discipline, art and profession of acquiring and applying technical, scientific and mathematical knowledge to design and implement materials, structures, machines, devices, systems, and processes that safely realize a desired objective or inventions.The American Engineers' Council...

 topic. Bellman's contribution is remembered in the name of the Bellman equation
Bellman equation
A Bellman equation , named after its discoverer, Richard Bellman, is a necessary condition for optimality associated with the mathematical optimization method known as dynamic programming...

, a central result of dynamic programming which restates an optimization problem in recursive
Recursion (computer science)
Recursion in computer science is a way of thinking about and solving many types of problems. In fact, recursion is one of the central ideas of computer science...

 form.

Originally the word "programming" in "dynamic programming" had no connection to computer programming
Computer programming
Computer programming is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs. This source code is written in a programming language. The code may be a modification of an existing source or something completely new...

, and instead came from the term "mathematical programming" - a synonym for optimization
Optimization (mathematics)
In mathematics, optimization, or mathematical programming, refers to choosing the best element from some set of available alternatives.In the simplest case, this means solving problems in which one seeks to minimize or maximize a real function by systematically choosing the values of real or...

. However, nowadays many optimization problems are best solved by writing a computer program that implements a dynamic programming algorithm, rather than carrying out hundreds of tedious calculations by hand. Some of the examples given below are illustrated using computer programs.

Overview



Dynamic programming is both a mathematical optimization method, and a computer programming method. In both contexts, it refers to simplifying a complicated problem by breaking it down into simpler subproblems in a recursive
Recursion
Recursion, in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition. The term is also used more generally to describe a process of repeating objects in a self-similar way...

 manner. While some decision problems cannot be taken apart this way, decisions that span several points in time do often break apart recursively; Bellman called this the "Principle of Optimality". Likewise, in computer science, a problem which can be broken down recursively is said to have optimal substructure
Optimal substructure
In computer science, a problem is said to have optimal substructure if an optimal solution can be constructed efficiently from optimal solutions to its subproblems...

.

If subproblems can be nested recursively inside larger problems, so that dynamic programming methods are applicable, then there is a relation between the value of the larger problem and the values of the subproblems (Cormen et al., 2001, pp. 327–8). In the optimization literature this relationship is called the Bellman equation
Bellman equation
A Bellman equation , named after its discoverer, Richard Bellman, is a necessary condition for optimality associated with the mathematical optimization method known as dynamic programming...

.

Dynamic programming in mathematical optimization


In terms of mathematical optimization
Optimization
Optimization or optimality may refer to:Relating to improving performance:* Optimization , the process of finding function extrema to solve problems...

, dynamic programming usually refers to a simplification of a decision by breaking it down into a sequence of decision steps over time. This is done by defining a sequence of value functions V1 , V2 , ... Vn , with an argument y representing the state
State variable
A state variable is one of the set of variables that describe the "state" of a dynamical system. Intuitively, the state of a system describes enough about the system to determine its future behaviour....

of the system at times i from 1 to n. The definition of Vn(y) is the value obtained in state y at the last time n. The values Vi at earlier times i=n-1,n-2,...,2,1 can be found by working backwards, using a recursive
Recursion
Recursion, in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition. The term is also used more generally to describe a process of repeating objects in a self-similar way...

 relationship called the Bellman equation
Bellman equation
A Bellman equation , named after its discoverer, Richard Bellman, is a necessary condition for optimality associated with the mathematical optimization method known as dynamic programming...

. For i=2,...n, Vi -1 at any state y is calculated from Vi by maximizing a simple function (usually the sum) of the gain from decision i-1 and the function Vi at the new state of the system if this decision is made. Since Vi has already been calculated, for the needed states, the above operation yields Vi -1 for all the needed states. Finally, V1 at the initial state of the system is the value of the optimal solution. The optimal values of the decision variables can be recovered, one by one, by tracking back the calculations already performed.

Dynamic programming in computer programming


As a computer programming method, dynamic programming is mainly used to tackle problems that are solvable in polynomial time. There are two key attributes that a problem must have in order for dynamic programming to be applicable: optimal substructure
Optimal substructure
In computer science, a problem is said to have optimal substructure if an optimal solution can be constructed efficiently from optimal solutions to its subproblems...

 and overlapping subproblem
Overlapping subproblem
In computer science, a problem is said to have overlapping subproblems if the problem can be broken down into subproblems which are reused several times.For example, the problem of computing the Fibonacci sequence exhibits overlapping subproblems...

s.

Optimal substructure means that the solution to a given optimization problem can be obtained by the combination of optimal solutions to its subproblems. Consequently, the first step towards devising a dynamic programming solution is to check whether the problem exhibits such optimal substructure. Such optimal substructures are usually described by means of recursion
Recursion
Recursion, in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition. The term is also used more generally to describe a process of repeating objects in a self-similar way...

. For example, given a graph G=(V,E), the shortest path p from a vertex u to a vertex v exhibits optimal substructure: take any intermediate vertex w on this shortest path p. If p is truly the shortest path, then the path p1 from u to w and p2 from w to v are indeed the shortest paths between the corresponding vertices (by the simple cut-and-paste argument described in CLRS). Hence, one can easily formulate the solution for finding shortest paths in a recursive manner, which is what the Bellman-Ford algorithm
Bellman-Ford algorithm
The Bellman–Ford algorithm, a label correcting algorithm, computes single-source shortest paths in a weighted digraph . Dijkstra's algorithm solves the same problem with a lower running time, but requires edge weights to be non-negative. Thus, Bellman–Ford is usually used only when there are...

 does.

Overlapping subproblems means that the space of subproblems must be small, that is, any recursive algorithm solving the problem should solve the same subproblems over and over, rather than generating new subproblems. For example, consider the recursive formulation for generating the Fibonacci series: Fi = Fi-1 + Fi-2, with base case F1=F2=1. Then F43 = F42 + F41, and F42 = F41 + F40. Now F41 is being solved in the recursive subtrees of both F43 as well as F42. Even though the total number of subproblems is actually small (only 43 of them), we end up solving the same problems over and over if we adopt a naive recursive solution such as this. Dynamic programming takes account of this fact and solves each subproblem only once.

This can be achieved in either of two ways:
  • Top-down approach: This is the direct fall-out of the recursive formulation of any problem. If the solution to any problem can be formulated recursively using the solution to its subproblems, and if its subproblems are overlapping, then one can easily memoize
    Memoization
    In computing, memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously-processed inputs...

     or store the solutions to the subproblems in a table. Whenever we attempt to solve a new subproblem, we first check the table to see if it is already solved. If a solution has been recorded, we can use it directly, otherwise we solve the subproblem and add its solution to the table.

  • Bottom-up approach
    Bottom-up
    Bottom-up may refer to:* In business development, a bottom-up approach means that the adviser takes the needs and wishes of the would-be entrepreneur as the starting point, rather than a market opportunity ....

    : This is the more interesting case. Once we formulate the solution to a problem recursively as in terms of its subproblems, we can try reformulating the problem in a bottom-up fashion: try solving the subproblems first and use their solutions to build-on and arrive at solutions to bigger subproblems. This is also usually done in a tabular form by iteratively generating solutions to bigger and bigger subproblems by using the solutions to small subproblems. For example, if we already know the values of F41 and F40, we can directly calculate the value of F42.


Some programming language
Programming language
A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human...

s can automatically memoize
Memoization
In computing, memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously-processed inputs...

 the result of a function call with a particular set of arguments, in order to speed up call-by-name evaluation (this mechanism is referred to as call-by-need). Some languages make it possible portably (e.g. Scheme, Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in ANSI standard document ANSI INCITS 226-1994 , . Developed to standardize the divergent variants of Lisp which predated it, it is not an implementation but rather a language specification...

 or Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall, a linguist working as a systems administrator for NASA, in 1987, as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone...

), some need special extensions (e.g. C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features...

, see http://www.apl.jhu.edu/~paulmac/c++-memoization.html). Some languages have automatic memoization built in. In any case, this is only possible for a referentially transparent function.

Optimal consumption and saving


A mathematical optimization problem that is often used in teaching dynamic programming to economists (because it can be solved by hand: see Stokey et al., 1989, Chap. 1) concerns a consumer who lives over the periods and must decide how much to consume and how much to save in each period.

Let be consumption in period , and assume consumption yields utility
Utility
In economics, utility is a measure of the relative satisfaction from, or desirability of, consumption of various goods and services. Given this measure, one may speak meaningfully of increasing or decreasing utility, and thereby explain economic behavior in terms of attempts to increase one's utility...

  as long as the consumer lives. Assume the consumer is impatient, so that he discounts future utility by a factor each period, where . Let be capital
Capital (economics)
In economics, capital or capital goods or real capital are factors of production used to create goods or services that are not themselves significantly consumed in the production process. Capital goods may be acquired with money or financial capital...

 in period . Assume initial capital is a given amount , and suppose that this period's capital and consumption determine next period's capital as , where is a positive constant and . Assume capital cannot be negative. Then the consumer's decision problem can be written as follows:
subject to for all


Written this way, the problem looks complicated, because it involves solving for all the choice variables and simultaneously. (Note that is not a choice variable—the consumer's initial capital is taken as given.)

The dynamic programming approach to solving this problem involves breaking it apart into a sequence of smaller decisions. To do so, we define a sequence of value functions , for which represent the value of having any amount of capital at each time . Note that , that is, there is (by assumption) no utility from having capital after death.

The value of any quantity of capital at any previous time can be calculated by backward induction
Backward induction
Backward induction is the process of reasoning backwards in time, from the end of a problem or situation, to determine a sequence of optimal actions. It proceeds by first considering the last time a decision might be made and choosing what to do in any situation at that time. Using this...

 using the Bellman equation
Bellman equation
A Bellman equation , named after its discoverer, Richard Bellman, is a necessary condition for optimality associated with the mathematical optimization method known as dynamic programming...

. In this problem, for each , the Bellman equation is
subject to


This problem is much simpler than the one we wrote down before, because it involves only two decision variables, and . Intuitively, instead of choosing his whole lifetime plan at birth, the consumer can take things one step at a time. At time , his current capital is given, and he only needs to choose current consumption and saving .

To actually solve this problem, we work backwards. is already known, so using the Bellman equation once we can calculate , and so on until we get to , which is the value of the initial decision problem for the whole lifetime. Calculating backwards, it can be shown that the value function at time is
where each is a constant. In order to calculate the value functions, one also calculates the policy functions that describe the optimal choice at each time, given the current level of capital. The optimal amount to consume at time is
which can be simplified to
, and , and , etcetera.


We see that it is optimal to consume a larger fraction of current wealth as one gets older, finally consuming all current wealth in period , the last period of life.

Fibonacci sequence


Here is a naive implementation of a function finding the nth member of the Fibonacci sequence, based directly on the mathematical definition:

function fib(n)
if n = 0 return 0
if n = 1 return 1
return fib(n − 1) + fib(n − 2)

Notice that if we call, say, fib(5), we produce a call tree that calls the function on the same value many different times:
  1. fib(5)
  2. fib(4) + fib(3)
  3. (fib(3) + fib(2)) + (fib(2) + fib(1))
  4. ((fib(2) + fib(1)) + (fib(1) + fib(0))) + ((fib(1) + fib(0)) + fib(1))
  5. (((fib(1) + fib(0)) + fib(1)) + (fib(1) + fib(0))) + ((fib(1) + fib(0)) + fib(1))


In particular, fib(2) was calculated three times from scratch. In larger examples, many more values of fib, or subproblems, are recalculated, leading to an exponential time algorithm.

Now, suppose we have a simple map
Associative array
An associative array is an abstract data type composed of a collection of unique keys and a collection of values, where each key is associated with one value...

 object, m, which maps each value of fib that has already been calculated to its result, and we modify our function to use it and update it. The resulting function requires only O(n) time instead of exponential time:

var m := map(0 → 0, 1 → 1)
function fib(n)
if map m does not contain key n
m[n] := fib(n − 1) + fib(n − 2)
return m[n]

This technique of saving values that have already been calculated is called memoization
Memoization
In computing, memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously-processed inputs...

; this is the top-down approach, since we first break the problem into subproblems and then calculate and store values.

In the bottom-up approach we calculate the smaller values of fib first, then build larger values from them. This method also uses O(n) time since it contains a loop that repeats n − 1 times, however it only takes constant (O(1)) space, in contrast to the top-down approach which requires O(n) space to store the map.

function fib(n)
var previousFib := 0, currentFib := 1
if n = 0
return 0
else if n = 1
return 1
repeat n − 1 times
var newFib := previousFib + currentFib
previousFib := currentFib
currentFib := newFib
return currentFib

In both these examples, we only calculate fib(2) one time, and then use it to calculate both fib(4) and fib(3), instead of computing it every time either of them is evaluated.

A type of balanced 0-1 matrix


Consider the problem of assigning values, either zero or one, to the positions of an n x n matrix, even, so that each row and each column contains exactly zeros and ones. For example, when , three possible solutions are:


+ - - - - + + - - - - + + - - - - +
| 0 1 0 1 | | 0 0 1 1 | | 1 1 0 0 |
| 1 0 1 0 | and | 0 0 1 1 | and | 0 0 1 1 |
| 0 1 0 1 | | 1 1 0 0 | | 1 1 0 0 |
| 1 0 1 0 | | 1 1 0 0 | | 0 0 1 1 |
+ - - - - + + - - - - + + - - - - +


We ask how many different assignments there are for a given . There are at least three possible approaches: brute force
Brute force
Brute force may refer to:* Brute-force search, a trivial computer problem-solving technique* Brute force attack, a method of defeating a cryptographic scheme by trying a large number of possibilities...

, backtracking
Backtracking
Backtracking is a general algorithm for finding all solutions to some computational problem, that incrementally builds candidates to the solutions, and abandons each partial candidate c as soon as it determines that c cannot possibly be completed to a valid solution .The classic textbook...

, and dynamic programming. Brute force consists of checking all assignments of zeros and ones and counting those that have balanced rows and columns ( zeros and ones). As there are possible assignments, this strategy is not practical except maybe up to . Backtracking for this problem consists of choosing some order of the matrix elements and recursively placing ones or zeros, while checking that in every row and column the number of elements that have not been assigned plus the number of ones or zeros are both at least n / 2. While more sophisticated than brute force, this approach will visit every solution once, making it impractical for n larger than six, since the number of solutions is already 116963796250 for n = 8, as we shall see. Dynamic programming makes it possible to count the number of solutions without visiting them all.

We consider boards, where whose rows contain zeros and ones. The function f to which memoization is applied maps vectors of n pairs of integers to the number of admissible boards (solutions). There is one pair for each column and its two components indicate respectively the number of ones and zeros that have yet to be placed in that column. We seek the value of ( arguments or one vector of elements). The process of subproblem creation involves iterating over every one of possible assignments for the top row of the board, and going through every column, subtracting one from the appropriate element of the pair for that column, depending on whether the assignment for the top row contained a zero or a one at that position. If any one of the results is negative, then the assignment is invalid and does not contribute to the set of solutions (recursion stops). Otherwise, we have an assignment for the top row of the board and recursively compute the number of solutions to the remaining board, adding the numbers of solutions for every admissible assignment of the top row and returning the sum, which is being memoized. The base case is the trivial subproblem, which occurs for a board. The number of solutions for this board is either zero or one, depending on whether the vector is a permutation of and pairs or not.

For example, in the two boards shown above the sequences of vectors would be

((2, 2) (2, 2) (2, 2) (2, 2)) ((2, 2) (2, 2) (2, 2) (2, 2)) k = 4
0 1 0 1 0 0 1 1

((1, 2) (2, 1) (1, 2) (2, 1)) ((1, 2) (1, 2) (2, 1) (2, 1)) k = 3
1 0 1 0 0 0 1 1

((1, 1) (1, 1) (1, 1) (1, 1)) ((0, 2) (0, 2) (2, 0) (2, 0)) k = 2
0 1 0 1 1 1 0 0

((0, 1) (1, 0) (0, 1) (1, 0)) ((0, 1) (0, 1) (1, 0) (1, 0)) k = 1
1 0 1 0 1 1 0 0

((0, 0) (0, 0) (0, 0) (0, 0)) ((0, 0) (0, 0), (0, 0) (0, 0))


The number of solutions is

Links to the Perl source of the backtracking approach, as well as a MAPLE and a C implementation of the dynamic programming approach may be found among the external links.

Checkerboard


Consider a checkerboard
Checkerboard
A checkerboard is a board on which English draughts is played. It is an 8×8 board and the 64 squares are of alternating dark and light color, often red and black....

 with n × n squares and a cost-function c(i, j) which returns a cost associated with square i,j (i being the row, j being the column). For instance (on a 5 × 5 checkerboard),
5 6 7 4 7 8
4 7 6 1 1 4
3 3 5 7 8 2
2 - 6 7 0 -
1 - - 5* - -
|2 |4
5
4
3
2 x x x
1 o
|2 |4
5
4 A
3 B C D
2
1
|2 |4 if y = 2
print(x + p[y, x])
else
printPath(y-1, x + p[y, x])

Sequence alignment


In genetics
Genetics
Genetics, , a discipline of biology, is the science of heredity and variation in living organisms. The fact that living things inherit traits from their parents has been used since prehistoric times to improve crop plants and animals through selective breeding...

, sequence alignment
Sequence alignment
In bioinformatics, a sequence alignment is a way of arranging the sequences of DNA, RNA, or protein to identify regions of similarity that may be a consequence of functional, structural, or evolutionary relationships between the sequences. Aligned sequences of nucleotide or amino acid residues are...

 is an important application where dynamic programming is essential. Typically, the problem consists of transforming one sequence into another using edit operations that replace, insert, or remove an element. Each operation has an associated cost, and the goal is to find the sequence of edits with the lowest total cost.

The problem can be stated naturally as a recursion, a sequence A is optimally edited into a sequence B by either:
  1. inserting the first character of B, and performing an optimal alignment of A and the tail of B
  2. deleting the first character of A, and performing the optimal alignment of the tail of A and B
  3. replacing the first character of A with the first character of B, and performing optimal alignments of the tails of A and B.


The partial alignments can be tabulated in a matrix, where cell (i,j) contains the cost of the optimal alignment of A[1..i] to B[1..j]. The cost in cell (i,j) can be calculated by adding the cost of the relevant operations to the cost of its neighboring cells, and selecting the optimum.

Different variants exist, see Smith-Waterman and Needleman-Wunsch.

Algorithms that use dynamic programming

  • Backward induction
    Backward induction
    Backward induction is the process of reasoning backwards in time, from the end of a problem or situation, to determine a sequence of optimal actions. It proceeds by first considering the last time a decision might be made and choosing what to do in any situation at that time. Using this...

     as a solution method for finite-horizon discrete-time dynamic optimization problems
  • Method of undetermined coefficients
    Method of undetermined coefficients
    In mathematics, the method of undetermined coefficients is an approach to finding a particular solution to certain inhomogeneous ordinary differential equations and recurrence relations...

     can be used to solve the Bellman equation
    Bellman equation
    A Bellman equation , named after its discoverer, Richard Bellman, is a necessary condition for optimality associated with the mathematical optimization method known as dynamic programming...

     in infinite-horizon, discrete-time, discounted, time-invariant
    Time-invariant system
    A time-invariant system is one whose output does not depend explicitly on time. That is, treating time as the independent variable, it is an autonomous system.Formally, if is the shifting operator ,then the operator is called time-invariant, if...

     dynamic optimization problems
  • Many string
    String (computer science)
    In mathematics, a string is an sequence of symbols that are chosen from a set or alphabet.In computer programming, a string is, essentially, a sequence of characters...

     algorithms including longest common subsequence
    Longest common subsequence problem
    The longest common subsequence problem is to find the longest subsequence common to all sequences in a set of sequences...

    , longest increasing subsequence, longest common substring
    Longest common substring problem
    The longest common substring problem is to find the longest string that is a substring of two or more strings. It should not be confused with the longest common subsequence problem. The longest common substring problem is to find the longest string (or strings) that is a substring (or are...

    , Levenshtein distance
    Levenshtein distance
    In information theory and computer science, the Levenshtein distance is a metric for measuring the amount of difference between two sequences...

     (edit distance).
  • Many algorithmic problems on graphs can be solved efficiently for graphs of bounded treewidth or bounded clique-width
    Clique-width
    In graph theory, the clique-width of a graph is the minimum number of labels needed to construct by means of the following 4 operations :#Creation of a new vertex v with label i...

     by using dynamic programming on a tree decomposition
    Tree decomposition
    In graph theory, a tree decomposition is a mapping of a graph into a tree that can be used to speed up solving certain problems on the original graph...

     of the graph.
  • The Cocke-Younger-Kasami (CYK) algorithm
    CYK algorithm
    The Cocke-Younger-Kasami algorithm determines whether astring can be generated by a given context-free grammar and, if so, how it can be generated. This is known as parsing the string. The algorithm employs bottom-up parsing and dynamic programming.The standard version of CYK operates on...

     which determines whether and how a given string can be generated by a given context-free grammar
    Context-free grammar
    In formal language theory, a context-free grammar is a grammar in which every production rule is of the formwhere V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals ....

  • The use of transposition table
    Transposition table
    In computer chess and other computer games, transposition tables are used to speed up the search of the game tree. Transposition tables are primarily useful in perfect information games, meaning the entire state of the game is known to all players at all times....

    s and refutation tables in computer chess
    Computer chess
    Computer chess is computer architecture encompassing hardware and software capable of playing chess autonomously without human guidance. Computer chess occurs as solo entertainment , as aids to chess analysis, for computer chess competitions, and as research to provide insights into human...

  • The Viterbi algorithm
    Viterbi algorithm
    The Viterbi algorithm is a dynamic programming algorithm for finding the most likely sequence of hidden states – called the Viterbi path – that results in a sequence of observed events, especially in the context of Markov information sources, and more generally, hidden Markov models...

     (used for hidden Markov model
    Hidden Markov model
    A hidden Markov model is a statistical model in which the system being modeled is assumed to be a Markov process with unobserved state. An HMM can be considered as the simplest dynamic Bayesian network....

    s)
  • The Earley algorithm (a type of chart parser
    Chart parser
    A chart parser is a type of parser suitable for ambiguous grammars . It uses dynamic programming approach -- partial hypothesized results are stored in a structure called a chart and can be re-used...

    )
  • The Needleman-Wunsch
    Needleman-Wunsch algorithm
    The Needleman–Wunsch algorithm performs a global alignment on two sequences . It is commonly used in bioinformatics to align protein or nucleotide sequences...

     and other algorithms used in bioinformatics
    Bioinformatics
    Bioinformatics is the application of information technology to the field of molecular biology. The term bioinformatics was coined by Paulien Hogeweg in 1979 for the study of informatic processes in biotic systems...

    , including sequence alignment
    Sequence alignment
    In bioinformatics, a sequence alignment is a way of arranging the sequences of DNA, RNA, or protein to identify regions of similarity that may be a consequence of functional, structural, or evolutionary relationships between the sequences. Aligned sequences of nucleotide or amino acid residues are...

    , structural alignment
    Structural alignment
    Structural alignment attempts to establish equivalences between two or more polymer structures based on their shape and three-dimensional conformation. This process is usually applied to protein tertiary structures but can also be used for large RNA molecules...

    , RNA structure prediction
    RNA structure
    The functional form of single stranded RNA molecules frequently requires a specific tertiary structure. The scaffold for this structure is provided by secondary structural elements which are hydrogen bonds within the molecule. This leads to several recognizable "domains" of secondary structure like...

    .
  • Floyd's All-Pairs shortest path algorithm
    Floyd-Warshall algorithm
    In computer science, the Floyd–Warshall algorithm is a graph analysis algorithm for finding shortest paths in a weighted, directed graph. A single execution of the algorithm will find the shortest paths between all pairs of vertices...

  • Optimizing the order for chain matrix multiplication
  • Pseudopolynomial time algorithms for the Subset Sum
    Subset sum problem
    In computer science, the subset sum problem is an important problem in complexity theory and cryptography. The problem is this: given a set of integers, does the sum of some non-empty subset equal exactly zero? For example, given the set { −7, −3, −2, 5, 8}, the answer is yes...

     and Knapsack
    Knapsack problem
    The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than a given limit and the total value is as large as possible...

     and Partition problem
    Partition problem
    In computer science, the partition problem is an NP-complete problem. The problem is to decide whether a given multiset of integers can be partitioned into two "halves" that have the same sum...

     Problems
  • The dynamic time warping
    Dynamic time warping
    Dynamic time warping is an algorithm for measuring similarity between two sequences which may vary in time or speed. For instance, similarities in walking patterns would be detected, even if in one video the person was walking slowly and if in another he or she were walking more quickly, or even...

     algorithm for computing the global distance between two time series
  • The Selinger
    Patricia Selinger
    Patricia Selinger is an American computer scientist and IBM Fellow, best known for her work on relational database management systems. She played a fundamental role in the development of System R, a pioneering relational database implementation, and wrote the canonical paper on relational query...

     (a.k.a. System R) algorithm for relational database query optimization
  • De Boor algorithm for evaluating B-spline curves
  • Duckworth-Lewis method
    Duckworth-Lewis method
    In the sport of cricket, the Duckworth–Lewis method is a mathematical way to calculate the target score for the team batting second in a one-day cricket or Twenty20 cricket match interrupted by weather or other circumstance...

     for resolving the problem when games of cricket are interrupted
  • The Value Iteration method for solving Markov decision process
    Markov decision process
    Markov decision processes , named after Andrey Markov, provide a mathematical framework for modeling decision-making in situations where outcomes are partly random and partly under the control of a decision maker. MDPs are useful for studying a wide range of optimization problems solved via...

    es
  • Some graphic image edge following selection methods such as the "magnet" selection tool in Photoshop
  • Some methods for solving interval scheduling
    Interval scheduling
    Interval scheduling is a class of problems in computer science, particularly in the area of algorithm design. A list of tasks is given as a set of time intervals; for instance, one task might run from 2:00 to 5:00 and another task might run from 6:00 to 8:00. Posed as an optimization problem, the...

     problems
  • Some methods for solving word wrap
    Word wrap
    In text display, line wrap is the feature of continuing on a new line when a line is full, such that each line fits in the viewable window, allowing text to be read from top to bottom without any horizontal scrolling....

     problems
  • Some methods for solving the travelling salesman problem
    Travelling salesman problem
    The Travelling Salesman Problem is a problem in combinatorial optimization studied in operations research and theoretical computer science...

  • Recursive least squares method
  • Beat
    Beat (music)
    The beat is the basic time unit of music, the pulse of the mensural level, also known as the beat level. However, since the term is in popular use, it often connotes the tempo of a piece or a particular sequence of individual beats, the meter, rhythm or groove...

     tracking in Music Information Retrieval
    Music information retrieval
    Music information retrieval or MIR is the interdisciplinary science of retrieving information from music.This includes:*Computational methods for classification, clustering, and modelling — musical feature extraction for mono- and polyphonic music, similarity and pattern matching, retrieval* Formal...

    .
  • Adaptive Critic training strategy for artificial neural networks
  • Stereo algorithms for solving the Correspondence problem
    Correspondence problem
    Given two or more images of the same 3D scene, taken from different points of view, the correspondence problem is to find a set of points in one image which can be identified as the same points in another image. A human can normally solve this problem quickly and easily, even when the images...

     used in stereo vision.
  • Seam carving
    Seam carving
    Seam carving or Content-Aware Image Resizing is an algorithm developed by Shai Avidan of Mitsubishi Electric Research Labs and Ariel Shamir for image resizing that establishes the number of seams, connected paths of low energy pixels that are determined by magnitude of gradient, in an image and...

     (content aware image resizing)
  • The Bellman-Ford algorithm
    Bellman-Ford algorithm
    The Bellman–Ford algorithm, a label correcting algorithm, computes single-source shortest paths in a weighted digraph . Dijkstra's algorithm solves the same problem with a lower running time, but requires edge weights to be non-negative. Thus, Bellman–Ford is usually used only when there are...

     for finding the shortest distance in a graph.
  • Some approximate solution methods for the linear search problem
    Linear search problem
    In computational complexity theory, the Linear search problem is an optimal search problem introduced by Richard E. Bellman. .- The problem :...

    .

See also


  • Bellman equation
    Bellman equation
    A Bellman equation , named after its discoverer, Richard Bellman, is a necessary condition for optimality associated with the mathematical optimization method known as dynamic programming...

  • Divide and conquer algorithm
    Divide and conquer algorithm
    In computer science, divide and conquer is an important algorithm design paradigm based on multi-branched recursion. A divide and conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same type, until these become simple enough to be solved directly...

  • Greedy algorithm
    Greedy algorithm
    thumb|280px|right|The greedy algorithm determines the minimum number of US coins to give while [[Change-making problem|making change]]. These are the steps a human would take to emulate a greedy algorithm. The coin of the highest value, less than the remaining change owed, is the local optimum...

  • Markov Decision Process
    Markov decision process
    Markov decision processes , named after Andrey Markov, provide a mathematical framework for modeling decision-making in situations where outcomes are partly random and partly under the control of a decision maker. MDPs are useful for studying a wide range of optimization problems solved via...

  • Stochastic programming
    Stochastic programming
    Stochastic programming is a framework for modeling optimization problems that involve uncertainty. Whereas deterministic optimization problems are formulated with known parameters, real world problems almost invariably include some unknown parameters. When the parameters are known only within...


External links