DAA LATEX (Batch-4)
DAA LATEX (Batch-4)
} 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);
}
}
}