Skip to content

Latest commit

 

History

History
 
 

Job_sequencing_problem

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Problem

Given an array of jobs where every job has a deadline and associated profit if the job is finished before the deadline. It is also given that every job takes single unit of time, so the minimum possible deadline for any job is 1. How to maximize total profit if only one job can be scheduled at a time.

Solution

A Simple Solution is to generate all subsets of given set of jobs and check individual subset for feasibility of jobs in that subset. Keep track of maximum profit among all feasible subsets. The time complexity of this solution is exponential.

This is a standard Greedy Algorithm problem. Following is the Algorithm:

  1. Sort all jobs in decreasing order of profit.
  2. Initialize the result sequence as first job in sorted jobs.
  3. Do following for remaining n-1 jobs
    • If the current job can fit in the current result sequence without missing the deadline, add current job to the result. Else ignore the current job.