From 04bfd630f1224d884ffa8e284f7697a354844f19 Mon Sep 17 00:00:00 2001 From: "Francois Berube\\frabe" Date: Mon, 2 Apr 2018 23:58:33 -0400 Subject: [PATCH] =?UTF-8?q?Correction=20de=20bugs=20li=C3=A9s=20aux=20cont?= =?UTF-8?q?raintes=20de=20recouvrement=20d'horaire.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbsenceSchedulesArray.java | 21 +++---------------- .../RecoveredSchedulesArray.java | 11 +++++++--- 2 files changed, 11 insertions(+), 21 deletions(-) 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; }