    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 * @author  Tomáš Müller
    036 * @version CourseTT 1.3 (University Course Timetabling)<br>
    037 *          Copyright (C) 2014 Tomáš Müller<br>
    038 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
    039 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
    040 * <br>
    041 *          This library is free software; you can redistribute it and/or modify
    042 *          it under the terms of the GNU Lesser General Public License as
    043 *          published by the Free Software Foundation; either version 3 of the
    044 *          License, or (at your option) any later version. <br>
    045 * <br>
    046 *          This library is distributed in the hope that it will be useful, but
    047 *          WITHOUT ANY WARRANTY; without even the implied warranty of
    048 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    049 *          Lesser General Public License for more details. <br>
    050 * <br>
    051 *          You should have received a copy of the GNU Lesser General Public
    052 *          License along with this library; if not see
    053 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
    054 */
    055public interface StudentSectioning {
    056
    057    /**
    058     * Enroll students into the given offering during the initial data load.
    059     * @param assignment current assignment
    060     * @param offeringId instructional offering id
    061     * @param courseName course name
    062     * @param students list of students to be sectioned
    063     * @param configurations list of configurations the students are to be sectioned into
    064     */
    065    public void initialSectioning(Assignment<Lecture, Placement> assignment, Long offeringId, String courseName, Collection<Student> students, Collection<Configuration> configurations);
    066
    067    /**
    068     * Return true if final student sectioning is implemented.
    069     * @return true if final student sectioning is implemented
    070     */
    071    public boolean hasFinalSectioning();
    072
    073    /**
    074     * Run student final sectioning (switching students between sections of the same
    075     * class in order to minimize overall number of student conflicts).
    076     * @param solution current solution
    077     * @param termination termination condition (optional)
    078     */
    079    public void switchStudents(Solution<Lecture, Placement> solution, TerminationCondition<Lecture, Placement> termination);
    080
    081    /**
    082     * Perform sectioning on the given lecture
    083     * @param assignment current assignment
    084     * @param lecture given lecture
    085     * @param recursive recursively resection lectures affected by a student swap
    086     * @param configAsWell resection students between configurations as well
    087     **/
    088    public void resection(Assignment<Lecture, Placement> assignment, Lecture lecture, boolean recursive, boolean configAsWell);
    089}