The document discusses various algorithms that use dynamic programming. It begins by defining dynamic programming as an approach that breaks problems down into optimal subproblems. It provides examples like knapsack and shortest path problems. It describes the characteristics of problems solved with dynamic programming as having optimal subproblems and overlapping subproblems. The document then discusses specific dynamic programming algorithms like matrix chain multiplication, string editing, longest common subsequence, shortest paths (Bellman-Ford and Floyd-Warshall). It provides explanations, recurrence relations, pseudocode and examples for these algorithms.
This file contains the contents about dynamic programming, greedy approach, graph algorithm, spanning tree concepts, backtracking and branch and bound approach.
This file contains the contents about dynamic programming, greedy approach, graph algorithm, spanning tree concepts, backtracking and branch and bound approach.
it contains the detail information about Dynamic programming, Knapsack problem, Forward / backward knapsack, Optimal Binary Search Tree (OBST), Traveling sales person problem(TSP) using dynamic programming
Paper Study: Melding the data decision pipelineChenYiHuang5
Melding the data decision pipeline: Decision-Focused Learning for Combinatorial Optimization from AAAI2019.
Derive the math equation from myself and match the same result as two mentioned CMU papers [Donti et. al. 2017, Amos et. al. 2017] while applying the same derivation procedure.
Least Square Optimization and Sparse-Linear SolverJi-yong Kwon
Short slide that explains about the least square problem and its practical solution, including Poisson Image editing example and brief introduction of sparse linear solver.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
More Related Content
Similar to AAC ch 3 Advance strategies (Dynamic Programming).pptx
it contains the detail information about Dynamic programming, Knapsack problem, Forward / backward knapsack, Optimal Binary Search Tree (OBST), Traveling sales person problem(TSP) using dynamic programming
Paper Study: Melding the data decision pipelineChenYiHuang5
Melding the data decision pipeline: Decision-Focused Learning for Combinatorial Optimization from AAAI2019.
Derive the math equation from myself and match the same result as two mentioned CMU papers [Donti et. al. 2017, Amos et. al. 2017] while applying the same derivation procedure.
Least Square Optimization and Sparse-Linear SolverJi-yong Kwon
Short slide that explains about the least square problem and its practical solution, including Poisson Image editing example and brief introduction of sparse linear solver.
Similar to AAC ch 3 Advance strategies (Dynamic Programming).pptx (20)
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSveerababupersonal22
It consists of cw radar and fmcw radar ,range measurement,if amplifier and fmcw altimeterThe CW radar operates using continuous wave transmission, while the FMCW radar employs frequency-modulated continuous wave technology. Range measurement is a crucial aspect of radar systems, providing information about the distance to a target. The IF amplifier plays a key role in signal processing, amplifying intermediate frequency signals for further analysis. The FMCW altimeter utilizes frequency-modulated continuous wave technology to accurately measure altitude above a reference point.
3. Dynamic Programming
• Basic approach behind dynamic programming:
Approach the problem in a sequential manner.
• The solution is found out in multi-stages.
• DP is used when the solution to the problem can be viewed as
the result of a sequence of decisions.
• E.g.1- Knapsack: Decide the values of xi, 1≤i ≤ n in the
order x1, x2, x3,… such that an optimal sequence of decisions
maximizes Σpixi
• E.g.2- Shortest Path: Decide on the 2nd , 3rd etc vertices
between i and j such that an optimal sequence results in a path
of least length.
3
4. • Dynamic programming is a method for
efficiently solving problems that at first seems to
require a lot of time (possibly exponential), provided we
have:
• Subproblem optimality: the global optimum value can be
defined in terms of optimal subproblems
• Subproblem overlap: the subproblems are not independent,
but instead they overlap (hence, should be constructed bottom-
up).
4
Dynamic Programming
5. Optimal Substructure
• A problem is said to have optimal sub-structure
if the globally optimal solution can be
constructed from locally optimal solutions to
sub problems.
• If it is not possible to make a stepwise optimal
decisions then one approach is to find all
possible decision sequences and find the best
one. This is called Brute Force.
• DP drastically reduces the no. of operations by
avoiding decision sequences that cannot be
optimal.
6. Principle of Optimality
Bellman (1957) stated the principle of optimality
which explains the process of suboptimality as:
• “An optimal policy (or a set of decisions) has
the property that whatever the initial state
and initial decision are, the remaining
decisions must constitute an optimal decision
sequence with regard to the state resulting
from the first decision.”
7. How is it Different from Others?
• Divide and Conquer: the sub-problems are
over-lapping unlike the ones solved using
Divide and Conquer that need to be
independent.
• Greedy Method: In DP, multiple decision
sequences are generated in contrast to GM
where only one decision sequence is
generated.
8. 8
Typical steps of DP
Steps in framing the solution using DP:
• Characterize the structure of an optimal
solution.
• Recursively define the value of an optimal
solution.
• Compute the value of an optimal solution in
a bottom-up fashion.
• Compute an optimal solution from
computed/stored information.
9. Matrix Chain Multiplication
• Problem: given A1, A2, …,An, compute the
product: A1A2…An , find the fastest way (i.e.,
minimum number of multiplications) to compute
it.
• Suppose two matrices A(p,q) and B(q,r), compute
their product C(p,r) in p q r multiplications.
• Matrix Multiplication is associative, so the
multiplication A1xA2xA3xA4 can be done in
several different orders.
– For example, M1M2M3 can be calculated as (M1M2)M3
or M1(M2M3).
– The order of multiplication, i.e. the placement of
parenthesis, will determine the number of scalar
multiplications.
10. 10
Matrix-chain multiplication –MCM DP
Intuitive brute-force solution:
• Counting the number of parenthesizations by
exhaustively checking all possible
parenthesizations.
• Let P(n) denote the number of alternative
parenthesizations of a sequence of n matrices:
• P(n) = 1 if n=1
k=1
n-1 P(k)P(n-k) if n2
• The solution to the recursion is (2n).
• So brute-force will not work.
11. 11
MCP DP Steps
• Step 1: structure of an optimal parenthesization
• Let Ai..j (ij) denote the matrix resulting from
AiAi+1…Aj
• Any parenthesization of AiAi+1…Aj must split the
product between Ak and Ak+1 for some k, (ik<j). The
cost = cost of computing Ai..k + cost of computing Ak+1..j
+ # Ai..k Ak+1..j.
• If k is the position for an optimal parenthesization, the
parenthesization of “prefix” subchain AiAi+1…Ak
within this optimal parenthesization of AiAi+1…Aj
must be an optimal parenthesization.
• AiAi+1…Ak Ak+1…Aj
12. 12
MCP DP Steps
• Step 2: a recursive relation
• Let m[i,j] be the minimum number of
multiplications for AiAi+1…Aj
• m[1,n] will be the answer
If the final multiplication for Aij is Aij= AikAk+1,j
then
• m[i,j] = 0 if i = j
min {m[i,k] + m[k+1,j] +pi-1pkpj } if i<j
ik<j
13. Step 3: Computing the Optimal
Cost
• If by recursive algorithm, exponential time (2n) no
better than brute-force.
• Total number of subproblems: +n = (n2)
• Recursive algorithm will encounter the same
subproblem many times.
• If tabling the answers for subproblems, each
subproblem is only solved once.
• The second hallmark of DP: overlapping subproblems
and solve every subproblem just once.
( )
2
n
14. Step 3: Algorithm
• Array m[1..n,1..n], with m[i,j] records the
optimal cost for AiAi+1…Aj .
• Array s[1..n,1..n], s[i,j] records index k
which achieved the optimal cost when
computing m[i,j].
• Suppose the input to the algorithm is p=<
p0 , p1 ,…, pn >.
18. MCM DP Steps
• Step 4, constructing a parenthesization
order for the optimal solution.
• Since s[1..n,1..n] is computed, and s[i,j] is
the split position for AiAi+1…Aj , i.e, Ai…As[i,j]
and As[i,j] +1…Aj , thus, the parenthesization
order can be obtained from s[1..n,1..n]
recursively, beginning from s[1,n].
20. String Editing
• Two string are given: X= x₁, x₂, x₃,…,xn and
Y=y₁, y₂, …, ym.
– xi, 1<i<n and yj, 1<j<m are members of Alphabet, a
finite set of symbols.
• Transform X into Y using a sequence of edit
operations on X.
• Set of Edit operations available: Insert[I(xi)],
Delete[D(xi)] and Change[C(xi, yj)].
• Cost associated with each operation.
• Total cost of the sequence of operations is the
sum of cost of each edit operation in sequence.
• Problem: Identify a minimum-cost edit sequence
that transforms X into Y.
22. • The problem holds Principle of Optimality.
• Define cost(i, j) to be the minimum cost edit
sequence for transforming x₁ to xi to y₁ to yj
for all values of i and j.
• The cost(n,m) is the cost of an optimal edit
sequence.
24. 24
Longest Common Subsequence (LCS)
• DNA analysis, two DNA string comparison.
• DNA string: a sequence of symbols A,C,G,T.
• S=ACCGGTCGAGCTTCGAAT
• Subsequence (of X): is X with some symbols left out.
• Z=CGTC is a subsequence of X=ACGCTAC.
• Common subsequence Z (of X and Y): a subsequence of X and also
a subsequence of Y.
• Z=CGA is a common subsequence of both X=ACGCTAC and
Y=CTGACA.
• Longest Common Subsequence (LCS): the longest one of common
subsequences.
• Z' =CGCA is the LCS of the above X and Y.
• LCS problem: given X=<x1, x2,…, xm> and Y=<y1, y2,…, yn>, find
their LCS.
25. 25
LCS DP –step 1: Optimal Substructure
• Characterize optimal substructure of LCS.
• Theorem 15.1: Let X=<x1, x2,…, xm> (= Xm)
and Y=<y1, y2,…,yn> (= Yn) and Z=<z1, z2,…,
zk> (= Zk) be any LCS of X and Y,
• 1. if xm= yn, then zk= xm= yn, and Zk-1 is the LCS of
Xm-1 and Yn-1.
• 2. if xm yn, then zk xm implies Z is the LCS of
Xm-1 and Yn.
• 3. if xm yn, then zk yn implies Z is the LCS of Xm
and Yn-1.
26. 26
LCS DP –step 2:Recursive Solution
• What the theorem says:
• If xm= yn, find LCS of Xm-1 and Yn-1, then append xm.
• If xm yn, find LCS of Xm-1 and Yn and LCS of Xm and Yn-
1, take which one is longer.
• Overlapping substructure:
• Both LCS of Xm-1 and Yn and LCS of Xm and Yn-1 will
need to solve LCS of Xm-1 and Yn-1.
• c[i,j] is the length of LCS of Xi and Yj .
27. 27
LCS DP-- step 3:Computing the Length of LCS
• c[0..m,0..n], where c[i,j] is defined as
above.
• c[m,n] is the answer (length of LCS).
• b[1..m,1..n], where b[i,j] points to the
table entry corresponding to the optimal
subproblem solution chosen when
computing c[i,j].
• From b[m,n] backward to find the LCS.
34. Recall Greedy Method for
Shortest Paths on a Multi-stage Graph
• Problem
• Find a shortest path from v0 to v3
Is the greedy solution optimal?
35. Recall Greedy Method for
Shortest Paths on a Multi-stage Graph
• Problem
• Find a shortest path from v0 to v3
Is the greedy solution optimal?
The optimal path
36. Example Dynamic Programming
min 1,1 3
min 1,2 3
min 0 3
min 1,3 3
min 1,4 3
( , )
( , )
3
1
min
5
7
( , )
( , )
( , )
d v v
d v v
d v v
d v v
d v v
37. Dijikstra’s Shortest Path Algorithm
DIJKSTRA (G, w, s)
{
INITIALIZE SINGLE-SOURCE (G, s)
S ← { } // S will ultimately contains vertices of final
shortest-path weights from s
Initialize priority queue Q i.e., Q ← V[G]
while priority queue Q is not empty do
u ← MIN(Q) // Pull out new vertex
S ← S + {u}
// Perform relaxation for each vertex v adjacent to u
for each vertex v in Adj[u] do
Relax (u, v, w)
}
37
41. z u v x y
1 2 3 4 5
0 0
1 0 6 7
Example
42. Example
z u v x y
1 2 3 4 5
0 0
1 0 6 7
2 0 6 4 7 2
43. Example
z u v x y
1 2 3 4 5
0 0
1 0 6 7
2 0 6 4 7 2
3 0 2 4 7 2
44. Example
z u v x y
1 2 3 4 5
0 0
1 0 6 7
2 0 6 4 7 2
3 0 2 4 7 2
4 0 2 4 7 -2
45. Conclusion
• I f Bellman-Ford has not converged after V (G)-
1 iterations, then there cannot be a shortest path
tree, so there must be a negative weight cycle.
• Complexity is O(n³) if Adjacency matrices are
used and O(ne) if lists are used.
46. The All-Pairs Shortest Path Problem:
Floyd-Marshall Algorithm
• Input: A weighted graph, represented by its
weight matrix W.
• Problem: Find the distance between every pair of
nodes.
• Dynamic programming Design:
– Notation: A(k)(i,j) = length of the shortest path from
node i to node j where the label of every intermediary
node is <= k.
• A(0)(i,j) = W[i,j].
47. • Principle of Optimality: We already saw that
any sub-path of a shortest path is a shortest path
between its end nodes.
• Recurrence relation:
• Divide the paths from i to j where every
intermediary node is of label <=k into two groups:
– Those paths that do go through node k
– Those paths that do not go through node k.
• The shortest path in the first group is the shortest
path from i to j where the label of every
intermediary node is <= k-1.
• The length of the shortest path of group 1 is
A(k-1)(i,j)
48. • The length of the shortest path in group 2 is
A(k-1)(i,k) + A(k-1)(k,j)
49. • The shortest path in the two groups is the
shorter of the shortest paths of the two groups,
we get
• The algorithm follows:
A(k)(i,j)=min(A(k-1)(i,j), A(k-1)(i,k) + A(k-1)(k,j))
Algorithm AllPaths(cost, a, n)
{
for i=1 to n do
for j=1 to n do
A(0)(i,j) := cost[i,j];
for k=1 to n do
for i=1 to n do
for j=1 to n do
A(k)(i,j)=min(A(k-1)(i,j),A(k-1)(i,k) + A(k-1)(k,j))
}
66. Complexity
• Complexity of TSP = Θ(n²2ⁿ)
• Since computation of g(I,S) with |S|=k requires
k-1 comparisons.
• Better than solving all n! different tours to find
the best one.
• Space Complexity = O(n2ⁿ)