org.cpsolver.coursett.model

## Class OnFlySectioning

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

- All Implemented Interfaces:
    ModelListener<Lecture,Placement>

      public class OnFlySectioning
      extends Object
      implements ModelListener<Lecture,Placement>

  On fly student sectioning.
  In this mode, students are resectioned after each iteration, but only between classes that are affected by the iteration. This slows down the solver, but it can dramatically improve results in the case when there is more stress put on student conflicts (e.g., Woebegon College example).
  Parameters:

  Parameter | Type | Comment
  --- | --- | ---
  OnFlySectioning.Enabled | `Boolean` | Enable on fly sectioning (if enabled, students will be resectioned after each iteration)
  OnFlySectioning.Recursive | `Boolean` | Recursively resection lectures affected by a student swap
  OnFlySectioning.ConfigAsWell | `Boolean` | Resection students between configurations as well

  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/.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OnFlySectioning(TimetableModel model)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterAssigned(Assignment<Lecture,Placement> assignment, long iteration, Placement value)` `FinalSectioning.resection(Assignment, Lecture, boolean, boolean)` is called when given iteration number is greater than zero.
    `void` | `afterUnassigned(Assignment<Lecture,Placement> assignment, long iteration, Placement value)` Called after a value is unassigned from its variable ( `Value.variable()`).
    `void` | `beforeAssigned(Assignment<Lecture,Placement> assignment, long iteration, Placement value)` Called before a value is assigned to its variable ( `Value.variable()`).
    `void` | `beforeUnassigned(Assignment<Lecture,Placement> assignment, long iteration, Placement value)` Called before a value is unassigned from its variable ( `Value.variable()`).
    `void` | `constraintAdded(Constraint<Lecture,Placement> constraint)` Constraint is added to the model
    `void` | `constraintRemoved(Constraint<Lecture,Placement> constraint)` Constraint is removed from the model
    `boolean` | `init(Solver<Lecture,Placement> solver)` Initialization
    `void` | `variableAdded(Lecture variable)` Variable is added to the model
    `void` | `variableRemoved(Lecture variable)` Variable is removed from the model

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

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

- - ### Constructor Detail

    - #### OnFlySectioning

          public OnFlySectioning(TimetableModel model)

      Constructor
      Parameters:
        `model` - timetabling model

  - ### Method Detail

    - #### variableAdded

          public void variableAdded(Lecture variable)

      Description copied from interface: `ModelListener`
      Variable is added to the model
      Specified by:
        `variableAdded` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `variable` - added variable

    - #### variableRemoved

          public void variableRemoved(Lecture variable)

      Description copied from interface: `ModelListener`
      Variable is removed from the model
      Specified by:
        `variableRemoved` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `variable` - removed variable

    - #### constraintAdded

          public void constraintAdded(Constraint<Lecture,Placement> constraint)

      Description copied from interface: `ModelListener`
      Constraint is added to the model
      Specified by:
        `constraintAdded` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `constraint` - added constraint

    - #### constraintRemoved

          public void constraintRemoved(Constraint<Lecture,Placement> constraint)

      Description copied from interface: `ModelListener`
      Constraint is removed from the model
      Specified by:
        `constraintRemoved` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `constraint` - removed constraint

    - #### beforeAssigned

          public void beforeAssigned(Assignment<Lecture,Placement> assignment,
                                     long iteration,
                                     Placement value)

      Description copied from interface: `ModelListener`
      Called before a value is assigned to its variable ( `Value.variable()`).
      Specified by:
        `beforeAssigned` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value to be assigned

    - #### beforeUnassigned

          public void beforeUnassigned(Assignment<Lecture,Placement> assignment,
                                       long iteration,
                                       Placement value)

      Description copied from interface: `ModelListener`
      Called before a value is unassigned from its variable ( `Value.variable()`).
      Specified by:
        `beforeUnassigned` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value to be unassigned

    - #### afterAssigned

          public void afterAssigned(Assignment<Lecture,Placement> assignment,
                                    long iteration,
                                    Placement value)

      `FinalSectioning.resection(Assignment, Lecture, boolean, boolean)` is called when given iteration number is greater than zero.
      Specified by:
        `afterAssigned` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value to be assigned

    - #### afterUnassigned

          public void afterUnassigned(Assignment<Lecture,Placement> assignment,
                                      long iteration,
                                      Placement value)

      Description copied from interface: `ModelListener`
      Called after a value is unassigned from its variable ( `Value.variable()`).
      Specified by:
        `afterUnassigned` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value to be unassigned

    - #### init

          public boolean init(Solver<Lecture,Placement> solver)

      Initialization
      Specified by:
        `init` in interface `ModelListener<Lecture,Placement>`
      Parameters:
        `solver` - IFS solver
      Returns:
        true if successfully initialized