DP: What's a subproblem space? Why have varying indices for a subproblem?

  • Thread starter Thread starter CGandC
  • Start date Start date
  • Tags Tags
    Indices Space
Click For Summary

Discussion Overview

The discussion revolves around the concept of subproblem spaces in dynamic programming, specifically focusing on their definitions and the necessity of varying indices for subproblems. Participants explore the implications of these concepts in the context of matrix-chain multiplication.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant questions the mathematical definition of the space of subproblems in dynamic programming and its necessity for varying indices.
  • Another participant distinguishes between applying an algorithm to the first k elements versus elements k+1 to j, emphasizing the need to track both left and right indices for the latter.
  • There is a discussion about the implications of defining subproblems, where one participant suggests that "A_1 A_2 ... A_j" can be specified by a single index j, while "A_{k+1} A_{k+2} ... A_j" requires two indices, leading to confusion about their forms.
  • Participants express that the distinction between contiguous sequences and the need for multiple indices is crucial for understanding the structure of subproblems.
  • A later reply indicates that one participant has gained clarity on the topic after the discussion.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and implications of varying indices for subproblems, indicating that the discussion remains unresolved with multiple competing perspectives.

Contextual Notes

Participants mention the potential costs associated with creating new lists in algorithm applications, which may not be relevant in abstract mathematics but are significant in computer science. There is also an acknowledgment of the need to prove substructure for arbitrary indices, though the relationship to the specific examples discussed remains unclear.

CGandC
Messages
326
Reaction score
34
In dynamic programming:
1. what is the definition of the space of subproblems? does it have a mathematical definition?

2. why is it necessary to have an arbitrary index for the subproblem to vary?

To elaborate on question 2, I've taken the following paragraph from chapter 15.3 in CLRS:Conversely, suppose that we had tried to constrain our subproblem space for
matrix-chain multiplication to matrix products of the form ## A_1A_2... A_j ## . As before,
an optimal parenthesization must split this product between ## A_k ## and ## A_{k+1} ## for some
## 1 \leq k < j ##. Unless we could guarantee that ## k ## always equals ## j - 1 ##, we would find that we had subproblems of the form ## A_1 A_2 ... A_k ## and ## A_{k+1} A_{k+2} ... A_j ##, and that the latter subproblem is not of the form ## A_1 A_2 ... A_j ## . For this problem, we needed to allow our subproblems to vary at “both ends,” that is, to allow both ##i## and ##j## to
vary in the subproblem ## A_i A_{i+1} ... A_j ## .
2.a. I don't understand why the subproblem ## A_{k+1} A_{k+2} ... A_j ## is not of the form ## A_1 A_2 ... A_j ## ( ## k+1 ## is considered to be the first index in the problem of finding the optimal parenthization for ## A_{k+1} A_{k+2} ... A_j ## ) whilst ## A_1 A_2 ... A_k ## is considered a correct form ?
2.b. is there some sort of universal instantiation I'm missing in-terms of logic? what do variable indexes have to do with the issue In question 2.a. ?
( I'm think the issue relates to the fact that when we prove a problem has a substructure, we need to prove it for arbitrary indexes, but I'm unable to see the relation between this proof and why ## A_{k+1} A_{k+2} ... A_j ## is not of the form ## A_1 A_2 ... A_j ## if we consider ##k+1## as the first index in the subproblem ## A_{k+1} A_{k+2} ... A_j ## )
 
Technology news on Phys.org
I think there is a distinction between "apply this algorithm to the first k elements of this list" and "apply this algorithm to elements k+1 to j of this list". The first only requires passing and tracking one index (the right index) but the second requires passing and tracking both left and right indices.

I think you aren't allowed to conflate these by creating a new list consisting only of elements k+1 to j of the original list and applying the algorithm to the first j-k elements of this new list. The exact semantics of "create a new list" will vary, and may have costs (in terms of memory and processor cycles) associated with them which are real in computer science but non-existent in abstract mathematics.
 
  • Like
Likes   Reactions: CGandC
So "## A_1 A_2 \cdots A_j ##" stands for a contiguous sequence of elements in the matrix chain that start from ##A_1##, a fixed element, which implies that it is enough for one number, the value of ## j##, to completely specify those elements given the matrix chain?
and in this sense, "## A_{k+1} A_{k+2} \cdots A_j ##" is not of the form of "## A_1 A_2 \cdots A_j ##", since two numbers are needed to specify them?
 
CGandC said:
So "## A_1 A_2 \cdots A_j ##" stands for a contiguous sequence of elements in the matrix chain that start from ##A_1##, a fixed element, which implies that it is enough for one number, the value of ## j##, to completely specify those elements given the matrix chain?
and in this sense, "## A_{k+1} A_{k+2} \cdots A_j ##" is not of the form of "## A_1 A_2 \cdots A_j ##", since two numbers are needed to specify them?
Right
 
Ok, I understand now, thanks for the help!
 
  • Like
Likes   Reactions: berkeman

Similar threads

Replies
17
Views
2K
  • · Replies 27 ·
Replies
27
Views
6K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 28 ·
Replies
28
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K