Activity Selection Problem
Md. Muktar Hossain
Lecturer (Provisional), CSE, VU
Activity Selection Problem
❖ The Activity Selection Problem is an optimization problem which deals
with the selection of non-conflicting activities that needs to be executed
by a single person or machine in a given time frame.
❖ Let's consider that you have n activities with their start and finish times,
the objective is to find solution set having maximum number of
non-conflicting activities that can be executed in a single time frame,
assuming that only one person or machine is available for execution.
Activity Selection Problem
Each Activity "i" has start time si and a finish time fi, where si ≤fi. If selected activity
"i" take place meanwhile the half-open time interval [si,fi). Activities i and j are
compatible if the intervals (si, fi) and [si, fi) do not overlap (i.e. i and j are
compatible if si ≥fi or si ≥fi). The activity-selection problem chosen the maximum-
size set of mutually consistent activities.
Algorithm Of Greedy- Activity Selector
Activity-Selection(Activity, start, finish)
Sort Activity by finish times stored in finish
Selected = {Activity[1]}
n = Activity.length
j = 1
for i = 2 to n:
if start[i] ≥ finish[j]:
Selected = Selected U {Activity[i]}
j = i
return Selected
Example
Example

Activity Selection Problem

  • 1.
    Activity Selection Problem Md.Muktar Hossain Lecturer (Provisional), CSE, VU
  • 2.
    Activity Selection Problem ❖The Activity Selection Problem is an optimization problem which deals with the selection of non-conflicting activities that needs to be executed by a single person or machine in a given time frame. ❖ Let's consider that you have n activities with their start and finish times, the objective is to find solution set having maximum number of non-conflicting activities that can be executed in a single time frame, assuming that only one person or machine is available for execution.
  • 13.
    Activity Selection Problem EachActivity "i" has start time si and a finish time fi, where si ≤fi. If selected activity "i" take place meanwhile the half-open time interval [si,fi). Activities i and j are compatible if the intervals (si, fi) and [si, fi) do not overlap (i.e. i and j are compatible if si ≥fi or si ≥fi). The activity-selection problem chosen the maximum- size set of mutually consistent activities.
  • 14.
    Algorithm Of Greedy-Activity Selector Activity-Selection(Activity, start, finish) Sort Activity by finish times stored in finish Selected = {Activity[1]} n = Activity.length j = 1 for i = 2 to n: if start[i] ≥ finish[j]: Selected = Selected U {Activity[i]} j = i return Selected
  • 15.
  • 16.