Optimal Substructure Property

The first step in solving an optimization problem by using a greedy approach is to characterize the structure of an optimal solution. A problem exhibits the optimal substructure property if an optimal solution to the problem within it contains optimal solutions to subproblems.

Intuitively, we can think that the activity selection problem exhibits the optimal substructure property in the sense that, if we suppose that a given activity belongs to a maximum size set of mutually compatible activities, then we are left to choose the maximum size set of mutually compatible activities from the ones that finish before this activity starts and that start after this activity finishes. Those two sets must also be maximum sets for the compatible activities, so that they can showcase the optimal substructure of this problem.

Formally, it is possible to prove that the activity selection problem exhibits optimal substructure. Let's assume we have the set of activities sorted in monotonically increasing order of finish time so that the following can be true for activities i and j:

fi ≤ fj if i ≤ j

Whereas fi is denoting the finish time of activity i.

Suppose we denote by Sij; the set of activities that start after activity ai finish, and they finish before activity aj starts. Thus, we wish to find a maximum set of mutually compatible activities in Sij.

Let's say that the set is Aij, and includes activity ak. By including ak in an optimal solution, we are left with two subproblems that are finding the maximum subset of mutually compatible activities in the set Sik and set Skj, which can be represented as follows:

Aij = Aik ∪ {ak} ∪ Akj

Thus, the size of the maximum size set of mutually compatible activities in Sij is given by the following:

|Aij| = |Aik| + |Akj| + 1

If we could find a set A'kj of mutually compatible activities in Skj where |A'kj| > |Akj|, then we could use A'kj instead of Akj in the optimal solution to the subproblem for Sij. But that way, we would have something that contradicts the assumption that Aij is an optimal solution:

|Aik| + |A'kj| + 1 > |Aik| + |Akj| + 1 = |Aij|
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.120.136