001package org.cpsolver.coursett.model; 002 003import java.util.Collection; 004 005import org.cpsolver.ifs.assignment.Assignment; 006import org.cpsolver.ifs.solution.Solution; 007import org.cpsolver.ifs.termination.TerminationCondition; 008 009 010/** 011 * Interface for student sectioning functions needed within the course timetabling solver.<br> 012 * <br> 013 * Many course offerings consist of multiple classes, with students enrolled in 014 * the course divided among them. These classes are often linked by a set of 015 * constraints, namely: 016 * <ul> 017 * <li>Each class has a limit stating the maximum number of students who can be 018 * enrolled in it. 019 * <li>A student must be enrolled in exactly one class for each subpart of a 020 * course. 021 * <li>If two subparts of a course have a parent-child relationship, a student 022 * enrolled in the parent class must also be enrolled in one of the child 023 * classes. 024 * </ul> 025 * Moreover, some of the classes of an offering may be required or prohibited 026 * for certain students, based on reservations that can be set on an offering, a 027 * configuration, or a class. <br> 028 * While the data are loaded into the solver, an initial sectioning of students into 029 * classes is processed (see {@link InitialSectioning}). However, it 030 * is still possible to improve on the number of student conflicts in the 031 * solution. This can be accomplished by moving students between alternative 032 * classes of the same course during or after the search (see 033 * {@link FinalSectioning}). 034 * 035 * @version CourseTT 1.3 (University Course Timetabling)<br> 036 * Copyright (C) 2014 Tomáš Müller<br> 037 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br> 038 * <a href="http://muller.unitime.org">http://muller.unitime.org</a><br> 039 * <br> 040 * This library is free software; you can redistribute it and/or modify 041 * it under the terms of the GNU Lesser General Public License as 042 * published by the Free Software Foundation; either version 3 of the 043 * License, or (at your option) any later version. <br> 044 * <br> 045 * This library is distributed in the hope that it will be useful, but 046 * WITHOUT ANY WARRANTY; without even the implied warranty of 047 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 048 * Lesser General Public License for more details. <br> 049 * <br> 050 * You should have received a copy of the GNU Lesser General Public 051 * License along with this library; if not see 052 * <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>. 053 */ 054public interface StudentSectioning { 055 056 /** 057 * Enroll students into the given offering during the initial data load. 058 * @param assignment current assignment 059 * @param offeringId instructional offering id 060 * @param courseName course name 061 * @param students list of students to be sectioned 062 * @param configurations list of configurations the students are to be sectioned into 063 */ 064 public void initialSectioning(Assignment<Lecture, Placement> assignment, Long offeringId, String courseName, Collection<Student> students, Collection<Configuration> configurations); 065 066 /** 067 * Return true if final student sectioning is implemented. 068 * @return true if final student sectioning is implemented 069 */ 070 public boolean hasFinalSectioning(); 071 072 /** 073 * Run student final sectioning (switching students between sections of the same 074 * class in order to minimize overall number of student conflicts). 075 * @param solution current solution 076 * @param termination termination condition (optional) 077 */ 078 public void switchStudents(Solution<Lecture, Placement> solution, TerminationCondition<Lecture, Placement> termination); 079 080 /** 081 * Perform sectioning on the given lecture 082 * @param assignment current assignment 083 * @param lecture given lecture 084 * @param recursive recursively resection lectures affected by a student swap 085 * @param configAsWell resection students between configurations as well 086 **/ 087 public void resection(Assignment<Lecture, Placement> assignment, Lecture lecture, boolean recursive, boolean configAsWell); 088}