Interface Constraint

All Known Implementing Classes:
BalanceConstraint, ContinuousHoursConstraint, CustomConstraint, CustomDurationConstraint, NonePlacedBeforeConstraint, RoomConstraint, TeacherConstraint

public interface Constraint
This interface represents a constraint in a timetable. A constraint is a condition that must be met when generating a timetable. It provides a method to check if a given timetable, time slot, course, and set of teachers meet the constraint. It also provides a default method to update the state of the constraint when the check is successful.
  • Method Details

    • isRequired

      default boolean isRequired()
    • check

      boolean check(Timetable timetable, Lesson lesson, Set<Teacher> teachers, Map<String,Room> rooms)
      Checks if the given timetable, time slot, course, and set of teachers meet this constraint.
      Parameters:
      timetable - the timetable to check
      lesson - the lesson to check
      teachers - the set of teachers to check
      rooms - the set of room to check
      Returns:
      true if the constraint is met, false otherwise
    • updateOnSuccess

      default void updateOnSuccess(Timetable timetable, Lesson lesson, Set<Teacher> teachers, Map<String,Room> rooms)
      Updates the state of this constraint when the check is successful. This is a default method and does nothing unless overridden by a concrete implementation of this interface.
      Parameters:
      timetable - the timetable that met the constraint
      lesson - the lesson that met the constraint
      teachers - the set of teachers that met the constraint
      rooms - the set of rooms that met the constraint