org.cpsolver.coursett.model

## Class FinalSectioning

- java.lang.Object
- - org.cpsolver.coursett.model.FinalSectioning

-     public class FinalSectioning
      extends Object

  Student sectioning (after a solution is found).
  In the current implementation, students are not re-sectioned during the search, but a student re-sectioning algorithm is called after the solver is finished or upon the user's request. The re-sectioning is based on a local search algorithm where the neighboring assignment is obtained from the current assignment by applying one of the following moves:
  - Two students enrolled in the same course swap all of their class assignments.
  - A student is re-enrolled into classes associated with a course such that the number of conflicts involving that student is minimized.
  The solver maintains a queue, initially containing all courses with multiple classes. During each iteration, an improving move (i.e., a move decreasing the overall number of student conflicts) is applied once discovered. Re-sectioning is complete once no more improving moves are possible. Only consistent moves (i.e., moves that respect class limits and other constraints) are considered. Any additional courses having student conflicts after a move is accepted are added to the queue.
  Since students are not re-sectioned during the timetabling search, the computed number of student conflicts is really an upper bound on the actual number that may exist afterward. To compensate for this during the search, student conflicts between subparts with multiple classes are weighted lower than conflicts between classes that meet at a single time (i.e., having student conflicts that cannot be avoided by re-sectioning).
  Version:
    CourseTT 1.3 (University Course Timetabling)
    Copyright (C) 2006 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
  Author:
    Tomáš Müller

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `FinalSectioning.Move`
    `class` | `FinalSectioning.MoveBetweenCfgs`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `sEps`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FinalSectioning(TimetableModel model)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FinalSectioning.MoveBetweenCfgs` | `createMove(Assignment<Lecture,Placement> assignment, Configuration firstConfig, Student firstStudent, Configuration secondConfig, Student secondStudent)`
    `FinalSectioning.Move` | `createMove(Assignment<Lecture,Placement> assignment, Lecture firstLecture, Student firstStudent, Lecture secondLecture, Student secondStudent)`
    `FinalSectioning.Move` | `createMove(Assignment<Lecture,Placement> assignment, Lecture firstLecture, Student firstStudent, Lecture secondLecture, Student secondStudent, FinalSectioning.Move parentMove)`
    `void` | `execute(Solution<Lecture,Placement> solution, TerminationCondition<Lecture,Placement> termination)`
    `void` | `findAndPerformMoves(Assignment<Lecture,Placement> assignment, Configuration configuration, HashSet<Lecture> lecturesToRecompute)`
    `void` | `findAndPerformMoves(Assignment<Lecture,Placement> assignment, Lecture lecture, HashSet<Lecture> lecturesToRecompute)` Swap students between this and the same lectures (lectures which differ only in the section)
    `FinalSectioning.Move` | `findAwayMove(Assignment<Lecture,Placement> assignment, Lecture lecture)`
    `FinalSectioning.MoveBetweenCfgs` | `findMove(Assignment<Lecture,Placement> assignment, Configuration config, Student student)`
    `FinalSectioning.Move` | `findMove(Assignment<Lecture,Placement> assignment, Lecture lecture, Student student)`
    `void` | `resection(Assignment<Lecture,Placement> assignment, Lecture lecture, boolean recursive, boolean configAsWell)` Perform sectioning on the given lecture
    `int` | `test(Assignment<Lecture,Placement> assignment, Student student, Lecture lecture)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### sEps

          public static double sEps

  - ### Constructor Detail

    - #### FinalSectioning

          public FinalSectioning(TimetableModel model)

  - ### Method Detail

    - #### execute

          public void execute(Solution<Lecture,Placement> solution,
                              TerminationCondition<Lecture,Placement> termination)

    - #### resection

          public void resection(Assignment<Lecture,Placement> assignment,
                                Lecture lecture,
                                boolean recursive,
                                boolean configAsWell)

      Perform sectioning on the given lecture
      Parameters:
        `assignment` - current assignment
        `lecture` - given lecture
        `recursive` - recursively resection lectures affected by a student swap
        `configAsWell` - resection students between configurations as well

    - #### findAndPerformMoves

          public void findAndPerformMoves(Assignment<Lecture,Placement> assignment,
                                          Lecture lecture,
                                          HashSet<Lecture> lecturesToRecompute)

      Swap students between this and the same lectures (lectures which differ only in the section)
      Parameters:
        `assignment` - current assignment
        `lecture` - a class that is being considered
        `lecturesToRecompute` - set of classes that may need to be re-considered

    - #### findAndPerformMoves

          public void findAndPerformMoves(Assignment<Lecture,Placement> assignment,
                                          Configuration configuration,
                                          HashSet<Lecture> lecturesToRecompute)

    - #### findAwayMove

          public FinalSectioning.Move findAwayMove(Assignment<Lecture,Placement> assignment,
                                                   Lecture lecture)

    - #### findMove

          public FinalSectioning.Move findMove(Assignment<Lecture,Placement> assignment,
                                               Lecture lecture,
                                               Student student)

    - #### findMove

          public FinalSectioning.MoveBetweenCfgs findMove(Assignment<Lecture,Placement> assignment,
                                                          Configuration config,
                                                          Student student)

    - #### createMove

          public FinalSectioning.Move createMove(Assignment<Lecture,Placement> assignment,
                                                 Lecture firstLecture,
                                                 Student firstStudent,
                                                 Lecture secondLecture,
                                                 Student secondStudent)

    - #### createMove

          public FinalSectioning.Move createMove(Assignment<Lecture,Placement> assignment,
                                                 Lecture firstLecture,
                                                 Student firstStudent,
                                                 Lecture secondLecture,
                                                 Student secondStudent,
                                                 FinalSectioning.Move parentMove)

    - #### createMove

          public FinalSectioning.MoveBetweenCfgs createMove(Assignment<Lecture,Placement> assignment,
                                                            Configuration firstConfig,
                                                            Student firstStudent,
                                                            Configuration secondConfig,
                                                            Student secondStudent)

    - #### test

          public int test(Assignment<Lecture,Placement> assignment,
                          Student student,
                          Lecture lecture)