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