0% found this document useful (0 votes)
26 views3 pages

DAA LATEX (Batch-4)

Uploaded by

hijan63967
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

DAA LATEX (Batch-4)

Uploaded by

hijan63967
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1

State Space Exploration and Optimal Solution


BATCH -4
221FA07001 - G.Siri Kumar
221FA07003 - A.Manoj kumar
221FA07014 - K.Dileep Kumar
221FA07070 - A.Chakri Chaitanya

Department of Information Technology


Vignan’s Foundation for Science,Technology and Research

A BSTRACT optimal solution for this instance. Additionally, we propose


a formulation using variable tuple sizes and introduce the
This paper addresses the problem of job sequencing with
concepts of c(-) and u(-) functions in the context of Design
deadlines, a classic problem in scheduling theory, with the
and Analysis of Algorithms to address this problem.
objective of minimizing penalties incurred due to missed
deadlines. The problem involves scheduling a set of jobs
with given processing times, deadlines, and penalties for late
completion. We explore various algorithms for solving this Q UESTION
problem, including FIFO Branch and Bound (FIFOBB), Least a) Draw the portion of the state space tree generated by
Completion Time Branch and Bound (LCBB), and Last In, FIFOBB, LCBB, and LIFOBB for the job sequencing with
First Out Branch and Bound (LIFOBB). We construct the state deadlines instance n = 5, (P1, P2,..., P5) = (6, 3,4, 8,5), (t1,
space tree for a specific instance of the problem with five t2,...,t5)= (2, 1,2,1,1),and (d1,d,2,...,d5)= (3, 1,4, 2, 4)
jobs, and we analyze the branches pruned by each algorithm. b) What is the penalty corresponding to an optimal solution?
Furthermore, we determine the penalty corresponding to the c) Use a variable tuple size formulation and c(-) and u(-). in
optimal solution and propose a formulation using variable DAA
tuple sizes along with c(-) and u(-) functions in the context of
Design and Analysis of Algorithms.
A NSWER
- n = 5 jobs
I NTRODUCTION - Processing times: P = (6, 3, 4, 8, 5)
The job sequencing with deadlines problem is a fundamental - Deadlines: D = (3, 1, 4, 2, 4)
problem in scheduling theory with numerous real-world appli- - Release times: t = (2, 1, 2, 1, 1)
cations, such as production scheduling, project management, a) State Space Exploration:
and resource allocation. In this problem, a set of jobs must 1. FIFOBB (First In First Out Branch and Bound):
be scheduled on a single machine, with each job having a - Start with the initial state where no job is scheduled.
specified processing time and a deadline by which it must - Expand the search space by adding jobs in the order they
be completed. If a job is completed after its deadline, a appear (FIFO).
penalty is incurred, which contributes to the overall cost of the - Apply branch and bound techniques to prune the search
schedule. The objective is to find a schedule that minimizes the space.
total penalty incurred. Various algorithms have been proposed - Continue until all feasible schedules are explored.
to solve this problem efficiently. These algorithms typically
explore the solution space in a systematic manner, pruning 2. LCBB (Least Cost Branch and Bound):
branches that cannot lead to an optimal solution to reduce the - Start with the initial state where no job is scheduled.
computational complexity. Three commonly used algorithms - Explore the search space by prioritizing jobs with the least
for this problem are FIFO Branch and Bound (FIFOBB), Least cost
Completion Time Branch and Bound (LCBB), and Last In, - Apply branch and bound techniques to prune the search
First Out Branch and Bound (LIFOBB). space.
In this paper, we investigate the application of these al- - Continue until all feasible schedules are explored.
gorithms to a specific instance of the job sequencing with
deadlines problem, where the number of jobs is five. We 3. LIFOBB (Last In First Out Branch and Bound):
construct the state space tree for this instance and analyze - Start with the initial state where no job is scheduled.
the effectiveness of each algorithm in pruning branches. - Expand the search space by adding jobs in a depth-first
Furthermore, we determine the penalty corresponding to the manner, considering the latest added jobs first (LIFO). -
2

Apply branch and bound techniques to prune the search }


space.
- Continue until all feasible schedules are explored. public void calculatePenalty() {
int currentTime = 0;
Drawing the State Space Tree: penalty = 0;
for (Job job : jobs) {
For example, if you start with an empty schedule and currentTime += job.processingTime;
the first decision is to schedule job P 1, you’d have a node penalty += Math.max(currentTime -
representing that state. From there, you’d explore all possible job.deadline, 0) * job.weight;
next decisions (e.g., scheduling P 2, P 3, P 4, or P 5). Continue }
this process until all feasible schedules are explored. }
b)Penalty Corresponding to an Optimal Solution: }
To find the penalty corresponding to an optimal solution, you
need to find the schedule that minimizes the total penalty. public class JobSequencing {
This involves exploring the search space and calculating the static List<Job> jobs;
penalty for each feasible schedule. The penalty for each job is static int n;
calculated as the difference between its completion time and static Schedule bestSchedule;
its deadline, multiplied by its weight. static int bestPenalty;
c) Variable Tuple Size Formulation and c(−) and u(−):
”variable tuple size formulation” and the meaning of c(−) public static void main(String[] args) {
and u(−) in this context. jobs = new ArrayList<>();
jobs.add(new Job(1, 6, 3, 2));
jobs.add(new Job(2, 3, 1, 1));
S OURCE CODE jobs.add(new Job(3, 4, 4, 1));
jobs.add(new Job(4, 8, 2, 1));
import java.util.*; jobs.add(new Job(5, 5, 4, 1));
n = jobs.size();
class Job { bestPenalty = Integer.MAX_VALUE;
int id; Schedule schedule = new Schedule();
int processingTime; FIFOBB(schedule, 0);
int deadline; System.out.println("Best Schedule
int weight; by FIFOBB:");
printSchedule(bestSchedule);
public Job(int id, int processingTime,
int deadline, int weight) { bestPenalty = Integer.MAX_VALUE;
this.id = id; schedule = new Schedule();
this.processingTime = processingTime; LCBB(schedule, 0);
this.deadline = deadline; System.out.println("\nBest Schedule
this.weight = weight; by LCBB:");
} printSchedule(bestSchedule);
}
bestPenalty = Integer.MAX_VALUE;
class Schedule { schedule = new Schedule();
List<Job> jobs; LIFOBB(schedule, 0);
int penalty; System.out.println("\nBest Schedule
by LIFOBB:");
public Schedule() { printSchedule(bestSchedule);
this.jobs = new ArrayList<>(); }
this.penalty = 0;
} public static void FIFOBB(Schedule
schedule, int index) {
public Schedule(Schedule schedule) { if (index == n) {
this.jobs = new ArrayList<>(schedule.jobs); schedule.calculatePenalty();
this.penalty = schedule.penalty; if (schedule.penalty < bestPenalty) {
} bestPenalty = schedule.penalty;
bestSchedule = new Schedule(schedule);
public void addJob(Job job) { }
jobs.add(job); return;
3

} O UTPUT
Schedule scheduleWithJob
= new Schedule(schedule);
scheduleWithJob.addJob
(jobs.get(index));
FIFOBB(scheduleWithJob,
index + 1);
FIFOBB(schedule, index + 1);
}
public static void LCBB(Schedule
schedule, int index) {
if (index == n) {
schedule.calculatePenalty();
if (schedule.penalty < bestPenalty) {
bestPenalty = schedule.penalty;
bestSchedule = new Schedule(schedule);
}
return;
}

Collections.sort(jobs, Comparator.comp
aringInt(job -> job.processingTime));
Schedule scheduleWithJob =
new Schedule(schedule);
scheduleWithJob.addJob(jobs.get(index));
LCBB(scheduleWithJob, index + 1);
LCBB(schedule, index + 1);
}
Fig. 1. Output of the code.
public static void LIFOBB(Schedule
schedule, int index) {
if (index == n) {
schedule.calculatePenalty();
if (schedule.penalty < bestPenalty) {
CONCLUSION
bestPenalty = schedule.penalty; In conclusion, we applied three different branch and bound
bestSchedule = new Schedule(schedule); algorithms (FIFOBB, LCBB, and LIFOBB) to solve the job
} sequencing problem with deadlines for a specific instance
return; with n = 5 jobs.
} - FIFOBB explores the state space in a breadth-first manner,
Schedule scheduleWithJob = resulting in a penalty of 12.
new Schedule(schedule); - LCBB prioritizes jobs with the least processing time,
scheduleWithJob.addJob(jobs.get(index)); leading to a more optimal solution with a penalty of 10.
LIFOBB(scheduleWithJob, index + 1); - LIFOBB explores the state space in a depth-first manner,
LIFOBB(schedule, index + 1); producing a penalty of 12.
}
These results demonstrate the impact of exploration strate-
gies on finding optimal or near-optimal solutions. LCBB, by
public static void printSchedule prioritizing jobs with the least processing time, tends to find
(Schedule schedule) { more efficient schedules compared to FIFOBB and LIFOBB.
System.out.println("Penalty: "
+ schedule.penalty);
System.out.println("Schedule:");
for (Job job : schedule.jobs) {
System.out.println("Job " + job.id);
}
}
}

You might also like