Title: Area : Computer Science
1- Area Computer Science
- Subject Algorithms
- Matrix Chain Multiplication
- Report submitted by- Akash Singhal (07005016)
21. 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
sub-problems and optimal substructure. 2. A
problem is said to have optimal substructure if
an optimal solution can be constructed
efficiently from optimal solutions to its
sub-problems.3. Matrix Chain Multiplication is
an optimization problem which finds the most
efficient way of multiplying a given set of
matrices.
Fig. showing the minimum number of steps required
for multiplying each subset of matrices
3AIM PROCEDUREThe aim of this animation is to
clarify the concepts of dynamic programming by
illustrating the problem of Matrix Chain
Multiplication.
- This animation will use a sample set of matrices
however user can also give a set of matrices as
input. - The animation will display a pyramid showing the
no. of steps required for multiplication of
suitable subsets of matrices. - The animation will finally display the minimum
no. of steps required and the optimum way of
multiplying the matrices.
4Problem Statement
- Given a set of matrices which can be multiplied,
find the best possible way of multiplying the
matrices such that the whole multiplication takes
least number of possible steps. - The problem of matrix chain multiplication can be
broken down into sub-chains to find the number of
steps required. This is a top-down approach and
can be solved using recursion. - Another solution to this problem uses dynamic
programming which is a bottom-up approach and
uses iteration instead of recursion.
51575
2625
1000
750
0
0
0
0
0
A B C
D E
1800
4375
2500
1575
2625
1000
750
0
0
0
0
0
A B C
D E
61800
4375
2500
1575
2625
1000
750
0
0
0
0
0
A B C
D E
2500
1950
2175
1800
4375
2500
1575
2625
1000
750
0
0
0
0
0
A B C
D E
Construction of a matrix chain multiplication
pyramid
7Review Questions
- Matrix Chain Multiplication is an example of
_____.( Ans- Dynamic Programming). - Matrix Chain Multiplication using Dynamic
Programming is a _______approach. - a) Right-Left
- b) Left-Right
- c) Top-down
- d) Bottom-up (Ans- Bottom-up)
- Dynamic Programming uses recursion. True or
False. (Ans- False) - The running time of the algorithm is_______.
- a) O(n)
- b) O(n log n)
- c) O(n3)
- d) O(n2)
- ______________ means that the solution to a given
optimization problem can be obtained by the
combination of optimal solutions to its
subproblems. - (Ans- Optimal substructure)
8Further Interactivity
- The user can himself give a set of matrices as
input. The animation will then construct a
pyramid for that particular set of matrices and
tell the user, the minimum number of steps
required for the multiplication. - Apart from just showing the minimum no. of steps,
the optimal break-up of the set of matrices can
be shown to give the user a better idea of matrix
chain multiplication problem.
9Further Reading Links
- http//en.wikipedia.org/wiki/Dynamic_Programming
- http//en.wikipedia.org/wiki/Chain_matrix_multipli
cation - http//www.brian-borowski.com/Software/Matrix/
- http//www.columbia.edu/cs2035/courses/csor4231.F
07/matrix-chain.pdf
10CREDITS