Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Adding 1 to the target element of the occuancy list
Browse files Browse the repository at this point in the history
  • Loading branch information
guilherme-ds-matos committed Nov 3, 2023
1 parent d39e703 commit 7ff7a98
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void Runtime::handle_process(Process p) {
double sum = 0.0;
auto classes_ = this->find_uc(parse_uc_gen(ops[1]));
for (ClassSchedule* class_ : classes_) {
occupancy.push_back(class_->get_student_count());
occupancy.push_back(class_->get_student_count() + (class_==target ? 1 : 0));
sum += (double)class_->get_student_count();
}
double mean = sum / (double)classes_.size();
Expand All @@ -459,7 +459,7 @@ void Runtime::handle_process(Process p) {
class_->remove_student(student_code);
}
}
if ((*max - *min >= 4) && (std_deviance_after > std_deviance_before)) {
if ((*max - *min > 4) && (std_deviance_after > std_deviance_before)) {
std::cerr << "ERROR: Critical conflicts found: the classes will not be balanced. Skipping." << std::endl;
return;
}
Expand All @@ -482,7 +482,7 @@ void Runtime::handle_process(Process p) {
double sum = 0.0;
auto classes_ = this->find_uc(parse_uc_gen(ops[1]));
for (ClassSchedule* class_ : classes_) {
occupancy.push_back(class_->get_student_count());
occupancy.push_back(class_->get_student_count() + (class_==target ? 1 : 0));
sum += (double)class_->get_student_count();
}
double mean = sum / (double)classes_.size();
Expand All @@ -501,7 +501,7 @@ void Runtime::handle_process(Process p) {
class_->remove_student(student_code);
}
}
if ((*max - *min >= 4) && (std_deviance_after > std_deviance_before)) {
if ((*max - *min > 4) && (std_deviance_after > std_deviance_before)) {
std::cerr << "ERROR: Critical conflicts found: the classes will not be balanced. Skipping." << std::endl;
return;
}
Expand Down

0 comments on commit 7ff7a98

Please sign in to comment.