diff --git a/Travail_de_session/AbsenceSchedules/AbsenceSchedulesArray.java b/Travail_de_session/AbsenceSchedules/AbsenceSchedulesArray.java index 75bb4ce..55aa0ab 100644 --- a/Travail_de_session/AbsenceSchedules/AbsenceSchedulesArray.java +++ b/Travail_de_session/AbsenceSchedules/AbsenceSchedulesArray.java @@ -6,39 +6,24 @@ import jdistlib.rng.RandomEngine; import org.chocosolver.solver.Solution; public class AbsenceSchedulesArray extends SchedulesArray{ - - protected boolean[][] partTimeEmployeeUnavailabilitySchedules; - protected boolean[][] fullTimeEmployeeUnavailabilitySchedules; - + public AbsenceSchedulesArray(SchedulesArray myScheduleArray) { super(myScheduleArray); } public AbsenceSchedulesArray(AbsenceSchedulesArray myAbsenceScheduleArray) { super(myAbsenceScheduleArray); - this.partTimeEmployeeUnavailabilitySchedules = new boolean[this.maxPartTimeEmployee][this.workPeriodsPerSchedule]; - for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) { - for (int employee = 0; employee < this.maxPartTimeEmployee; employee++) { - this.partTimeEmployeeUnavailabilitySchedules[employee][workPeriod] = myAbsenceScheduleArray.partTimeEmployeeUnavailabilitySchedules[employee][workPeriod]; - } - } - this.fullTimeEmployeeUnavailabilitySchedules = new boolean[this.maxFullTimeEmployee][this.workPeriodsPerSchedule]; - for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) { - for (int employee = 0; employee < this.maxFullTimeEmployee; employee++) { - this.fullTimeEmployeeUnavailabilitySchedules[employee][workPeriod] = myAbsenceScheduleArray.fullTimeEmployeeUnavailabilitySchedules[employee][workPeriod]; - } - } } public void generateAbsences(RandomEngine r) { - this.partTimeEmployeeUnavailabilitySchedules = new boolean[this.maxPartTimeEmployee][this.workPeriodsPerSchedule]; + for (int i = 0; i < this.maxPartTimeEmployee; i++) { boolean[] a = new AbsencesVector(this.workPeriodsPerSchedule, r).getAbsencesVector(); for (int j = 0; j < this.workPeriodsPerSchedule; j++) { this.partTimeSchedules[i][j] = this.initialPartTimeSchedules[i][j] && a[j]; } } - this.fullTimeEmployeeUnavailabilitySchedules = new boolean[this.maxFullTimeEmployee][this.workPeriodsPerSchedule]; + for (int i = 0; i < this.maxFullTimeEmployee; i++) { boolean[] a = new AbsencesVector(this.workPeriodsPerSchedule, r).getAbsencesVector(); for (int j = 0; j < this.workPeriodsPerSchedule; j++) { diff --git a/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java b/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java index dc42230..f506635 100644 --- a/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java +++ b/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java @@ -14,9 +14,6 @@ import AbsenceSchedules.AbsenceSchedulesArray; */ public class RecoveredSchedulesArray extends AbsenceSchedulesArray{ - protected boolean[][] partTimeEmployeeAbsenceRecoveringAvailabilitySchedules; - protected boolean[][] fullTimeEmployeeAbsenceRecoveringAvailabilitySchedules; - public RecoveredSchedulesArray(AbsenceSchedulesArray myAbsenceScheduleArray){ super(myAbsenceScheduleArray); } @@ -94,6 +91,8 @@ public class RecoveredSchedulesArray extends AbsenceSchedulesArray{ boolean validConsecutivePreviousNonWorkingPeriods = false; if (compteurWorkPeriod == -1) { validConsecutivePreviousNonWorkingPeriods = true; + } else if (consecutivePreviousNonWorkingPeriods == 0) { + validConsecutivePreviousNonWorkingPeriods = true; } else if (consecutivePreviousNonWorkingPeriods >= myModelInitialSchedules.myScheduleParameters.minConsecutiveNonWorkingPeriodsBetweenShiftWorksOfPartTimeEmployees) { validConsecutivePreviousNonWorkingPeriods = true; } @@ -106,6 +105,8 @@ public class RecoveredSchedulesArray extends AbsenceSchedulesArray{ boolean validConsecutiveNextNonWorkingPeriods = false; if (compteurWorkPeriod == workPeriodsPerSchedule) { validConsecutiveNextNonWorkingPeriods = true; + } else if (consecutiveNextNonWorkingPeriods == 0) { + validConsecutiveNextNonWorkingPeriods = true; } else if (consecutiveNextNonWorkingPeriods >= myModelInitialSchedules.myScheduleParameters.minConsecutiveNonWorkingPeriodsBetweenShiftWorksOfPartTimeEmployees) { validConsecutiveNextNonWorkingPeriods = true; } @@ -152,6 +153,8 @@ public class RecoveredSchedulesArray extends AbsenceSchedulesArray{ boolean validConsecutivePreviousNonWorkingPeriods = false; if (compteurWorkPeriod == -1) { validConsecutivePreviousNonWorkingPeriods = true; + } else if (consecutivePreviousNonWorkingPeriods == 0) { + validConsecutivePreviousNonWorkingPeriods = true; } else if (consecutivePreviousNonWorkingPeriods >= myModelInitialSchedules.myScheduleParameters.minConsecutiveNonWorkingPeriodsBetweenShiftWorksOfFullTimeEmployees) { validConsecutivePreviousNonWorkingPeriods = true; } @@ -164,6 +167,8 @@ public class RecoveredSchedulesArray extends AbsenceSchedulesArray{ boolean validConsecutiveNextNonWorkingPeriods = false; if (compteurWorkPeriod == workPeriodsPerSchedule) { validConsecutiveNextNonWorkingPeriods = true; + } else if (consecutiveNextNonWorkingPeriods == 0) { + validConsecutiveNextNonWorkingPeriods = true; } else if (consecutiveNextNonWorkingPeriods >= myModelInitialSchedules.myScheduleParameters.minConsecutiveNonWorkingPeriodsBetweenShiftWorksOfFullTimeEmployees) { validConsecutiveNextNonWorkingPeriods = true; }