Search in sources :

Example 11 with Lesson

use of org.acme.schooltimetabling.domain.Lesson in project optaplanner-quickstarts by kiegroup.

the class TimeTableConstraintProviderTest method teacherConflict.

@Test
void teacherConflict() {
    String conflictingTeacher = "Teacher1";
    Lesson firstLesson = new Lesson(1, "Subject1", conflictingTeacher, "Group1", TIMESLOT1, ROOM1);
    Lesson conflictingLesson = new Lesson(2, "Subject2", conflictingTeacher, "Group2", TIMESLOT1, ROOM2);
    Lesson nonConflictingLesson = new Lesson(3, "Subject3", "Teacher2", "Group3", TIMESLOT2, ROOM1);
    constraintVerifier.verifyThat(TimeTableConstraintProvider::teacherConflict).given(firstLesson, conflictingLesson, nonConflictingLesson).penalizesBy(1);
}
Also used : Lesson(org.acme.schooltimetabling.domain.Lesson) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 12 with Lesson

use of org.acme.schooltimetabling.domain.Lesson in project optaplanner-quickstarts by kiegroup.

the class TimeTableConstraintProviderTest method teacherRoomStability.

@Test
void teacherRoomStability() {
    String teacher = "Teacher1";
    Lesson lessonInFirstRoom = new Lesson(1, "Subject1", teacher, "Group1", TIMESLOT1, ROOM1);
    Lesson lessonInSameRoom = new Lesson(2, "Subject2", teacher, "Group2", TIMESLOT1, ROOM1);
    Lesson lessonInDifferentRoom = new Lesson(3, "Subject3", teacher, "Group3", TIMESLOT1, ROOM2);
    constraintVerifier.verifyThat(TimeTableConstraintProvider::teacherRoomStability).given(lessonInFirstRoom, lessonInDifferentRoom, lessonInSameRoom).penalizesBy(2);
}
Also used : Lesson(org.acme.schooltimetabling.domain.Lesson) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 13 with Lesson

use of org.acme.schooltimetabling.domain.Lesson in project optaplanner-quickstarts by kiegroup.

the class TimeTableConstraintProviderTest method studentGroupConflict.

@Test
void studentGroupConflict() {
    String conflictingGroup = "Group1";
    Lesson firstLesson = new Lesson(1, "Subject1", "Teacher1", conflictingGroup, TIMESLOT1, ROOM1);
    Lesson conflictingLesson = new Lesson(2, "Subject2", "Teacher2", conflictingGroup, TIMESLOT1, ROOM2);
    Lesson nonConflictingLesson = new Lesson(3, "Subject3", "Teacher3", "Group3", TIMESLOT2, ROOM1);
    constraintVerifier.verifyThat(TimeTableConstraintProvider::studentGroupConflict).given(firstLesson, conflictingLesson, nonConflictingLesson).penalizesBy(1);
}
Also used : Lesson(org.acme.schooltimetabling.domain.Lesson) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 14 with Lesson

use of org.acme.schooltimetabling.domain.Lesson in project optaplanner-quickstarts by kiegroup.

the class TimeTableConstraintProviderTest method teacherTimeEfficiency.

@Test
void teacherTimeEfficiency() {
    String teacher = "Teacher1";
    Lesson singleLessonOnMonday = new Lesson(1, "Subject1", teacher, "Group1", TIMESLOT1, ROOM1);
    Lesson firstTuesdayLesson = new Lesson(2, "Subject2", teacher, "Group2", TIMESLOT2, ROOM1);
    Lesson secondTuesdayLesson = new Lesson(3, "Subject3", teacher, "Group3", TIMESLOT3, ROOM1);
    Lesson thirdTuesdayLessonWithGap = new Lesson(4, "Subject4", teacher, "Group4", TIMESLOT4, ROOM1);
    constraintVerifier.verifyThat(TimeTableConstraintProvider::teacherTimeEfficiency).given(singleLessonOnMonday, firstTuesdayLesson, secondTuesdayLesson, thirdTuesdayLessonWithGap).rewardsWith(// Second tuesday lesson immediately follows the first.
    1);
}
Also used : Lesson(org.acme.schooltimetabling.domain.Lesson) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 15 with Lesson

use of org.acme.schooltimetabling.domain.Lesson in project optaplanner-quickstarts by kiegroup.

the class TimeTableConstraintProviderTest method roomConflict.

@Test
void roomConflict() {
    Lesson firstLesson = new Lesson(1, "Subject1", "Teacher1", "Group1", TIMESLOT1, ROOM1);
    Lesson conflictingLesson = new Lesson(2, "Subject2", "Teacher2", "Group2", TIMESLOT1, ROOM1);
    Lesson nonConflictingLesson = new Lesson(3, "Subject3", "Teacher3", "Group3", TIMESLOT2, ROOM1);
    constraintVerifier.verifyThat(TimeTableConstraintProvider::roomConflict).given(firstLesson, conflictingLesson, nonConflictingLesson).penalizesBy(1);
}
Also used : Lesson(org.acme.schooltimetabling.domain.Lesson) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Aggregations

Lesson (org.acme.schooltimetabling.domain.Lesson)18 Test (org.junit.jupiter.api.Test)12 QuarkusTest (io.quarkus.test.junit.QuarkusTest)11 TimeTable (org.acme.schooltimetabling.domain.TimeTable)8 Room (org.acme.schooltimetabling.domain.Room)6 Timeslot (org.acme.schooltimetabling.domain.Timeslot)6 Timeout (org.junit.jupiter.api.Timeout)4 ArrayList (java.util.ArrayList)3 Transactional (javax.transaction.Transactional)2 SolverRequest (org.acme.schooltimetabling.message.SolverRequest)2 SolverResponse (org.acme.schooltimetabling.message.SolverResponse)2 DayOfWeek (java.time.DayOfWeek)1 Duration (java.time.Duration)1 LocalTime (java.time.LocalTime)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 TimeTableConstraintProvider (org.acme.schooltimetabling.solver.TimeTableConstraintProvider)1 Solver (org.optaplanner.core.api.solver.Solver)1