handle missing conflicts
This commit is contained in:
1 parent
587b01b857
commit
360fc9ce66
2 files changed
+19
-19
No files matched your search
@@ -385,12 +385,12 @@ def generateScheduleV3(
|
|||||||
# or classes the student is inserted to is missing
|
# or classes the student is inserted to is missing
|
||||||
# no more than two classes:
|
# no more than two classes:
|
||||||
# continue to next student
|
# continue to next student
|
||||||
if (
|
if not hasConflicts and student["classes"] == student["expectedClasses"]: continue
|
||||||
not hasConflicts and (
|
elif not hasConflicts and (student["expectedClasses"]-2) <= student["classes"] < student["expectedClasses"]:
|
||||||
student["classes"] == student["expectedClasses"] or
|
a_mc_count += 1
|
||||||
(student["expectedClasses"]-2) <= student["classes"] < student["expectedClasses"]
|
acceptableCount += 1
|
||||||
)
|
if not newConflict(student["Pupil #"], "", "Acceptable", "A-MC", "Missing 1-2 Classses", conflictLogs): studentsAcceptable += 1
|
||||||
): continue
|
continue
|
||||||
|
|
||||||
studentData = {
|
studentData = {
|
||||||
"Pupil #": student["Pupil #"],
|
"Pupil #": student["Pupil #"],
|
||||||
@@ -408,7 +408,7 @@ def generateScheduleV3(
|
|||||||
# list to ginore them when looking for clashes, and not to
|
# list to ginore them when looking for clashes, and not to
|
||||||
# accidently overwrite while evaluating other classes
|
# accidently overwrite while evaluating other classes
|
||||||
if len(exceptions) > 0:
|
if len(exceptions) > 0:
|
||||||
for i, block in enumerate(blocks):
|
for i in range(len(blocks)):
|
||||||
if i in exceptions: blocks[i] = ['EXPT']
|
if i in exceptions: blocks[i] = ['EXPT']
|
||||||
conflicts = sum(1 for b in blocks if len(b)>1)
|
conflicts = sum(1 for b in blocks if len(b)>1)
|
||||||
|
|
||||||
@@ -504,7 +504,11 @@ def generateScheduleV3(
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
if not found_oBlockSolution: exceptions.append(clashIndex)
|
if not found_oBlockSolution:
|
||||||
|
exceptions.append(clashIndex)
|
||||||
|
criticalCount += 1
|
||||||
|
c_cr_count += 1
|
||||||
|
if not newConflict(student["Pupil #"], "", "Critial", "C-CR", "Couldn't Resolve", conflictLogs): studentsCritical += 1
|
||||||
|
|
||||||
foundSolution = True
|
foundSolution = True
|
||||||
break
|
break
|
||||||
@@ -513,8 +517,11 @@ def generateScheduleV3(
|
|||||||
if classOutIndex < len(blocks[clashIndex]) - 1: classOutIndex += 1
|
if classOutIndex < len(blocks[clashIndex]) - 1: classOutIndex += 1
|
||||||
elif classOutIndex == len(blocks[clashIndex]) - 1:
|
elif classOutIndex == len(blocks[clashIndex]) - 1:
|
||||||
if len(student["remainingAlts"]) > 0:
|
if len(student["remainingAlts"]) > 0:
|
||||||
# pass
|
|
||||||
exceptions.append(clashIndex)
|
exceptions.append(clashIndex)
|
||||||
|
criticalCount += 1
|
||||||
|
c_cr_count += 1
|
||||||
|
if not newConflict(student["Pupil #"], "", "Critical", "C-CR", "Couldn't Resolve", conflictLogs): studentsCritical += 1
|
||||||
|
|
||||||
attemptResolve = False
|
attemptResolve = False
|
||||||
# Attempt to use alt
|
# Attempt to use alt
|
||||||
elif len(student["remainingAlts"]) == 0:
|
elif len(student["remainingAlts"]) == 0:
|
||||||
@@ -555,13 +562,6 @@ def generateScheduleV3(
|
|||||||
print(f"Fatal error ({getLineNumber()}): Impossible error")
|
print(f"Fatal error ({getLineNumber()}): Impossible error")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
criticals = []
|
|
||||||
acceptables = []
|
|
||||||
for student in conflictLogs:
|
|
||||||
for conflict in conflictLogs[student]:
|
|
||||||
if conflict["Type"] == "Critical": criticals.append(conflict)
|
|
||||||
elif conflict["Type"] == "Acceptable": acceptables.append(conflict)
|
|
||||||
|
|
||||||
finalConflictLogs = {
|
finalConflictLogs = {
|
||||||
"Conflicts": conflictLogs,
|
"Conflicts": conflictLogs,
|
||||||
"Critical": {
|
"Critical": {
|
||||||
|
|||||||
+3
-3
@@ -22,15 +22,15 @@ def errorOutput(students) -> Tuple[PrettyTable, dict, dict]:
|
|||||||
totalCritical = conflicts["Critical"]["Students"]
|
totalCritical = conflicts["Critical"]["Students"]
|
||||||
totalAcceptable = conflicts["Acceptable"]["Students"]
|
totalAcceptable = conflicts["Acceptable"]["Students"]
|
||||||
|
|
||||||
t = PrettyTable(['Type', 'Error %', 'Success %', 'Error Ratio'])
|
t = PrettyTable(['Type', 'Error %', 'Success %', 'Student Error Ratio'])
|
||||||
|
|
||||||
errorsC = round(totalCritical / len(students) * 100, 2)
|
errorsC = round(totalCritical / len(students) * 100, 2)
|
||||||
successC = round(100 - errorsC, 2)
|
successC = round(100 - errorsC, 2)
|
||||||
errorsA = round(totalAcceptable / len(students) * 100, 2)
|
errorsA = round(totalAcceptable / len(students) * 100, 2)
|
||||||
successA = round(100 - errorsA, 2)
|
successA = round(100 - errorsA, 2)
|
||||||
|
|
||||||
t.add_row(['Critical', f"{errorsC} %", f"{successC} %", f"{totalCritical}/{len(students)}"])
|
t.add_row(['Critical', f"{errorsC} %", f"{successC} %", f"{totalCritical}/{len(students)} Students"])
|
||||||
t.add_row(['Acceptable', f"{errorsA} %", f"{successA} %", f"{totalAcceptable}/{len(students)}"])
|
t.add_row(['Acceptable', f"{errorsA} %", f"{successA} %", f"{totalAcceptable}/{len(students)} Students"])
|
||||||
|
|
||||||
return t, conflicts["Critical"], conflicts["Acceptable"]
|
return t, conflicts["Critical"], conflicts["Acceptable"]
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user