org.cpsolver.exam.heuristics

## Class ExamGreatDeluge

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext<Exam,ExamPlacement,ExamGreatDeluge.Context>
  - - org.cpsolver.exam.heuristics.ExamGreatDeluge

- All Implemented Interfaces:
    CanHoldContext, HasAssignmentContext<Exam,ExamPlacement,ExamGreatDeluge.Context>, NeighbourSelection<Exam,ExamPlacement>, LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>, SolutionListener<Exam,ExamPlacement>

  Deprecated.

      @Deprecated
      public class ExamGreatDeluge
      extends NeighbourSelectionWithContext<Exam,ExamPlacement,ExamGreatDeluge.Context>
      implements SolutionListener<Exam,ExamPlacement>, LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>

  Greate deluge. In each iteration, one of the following three neighbourhoods is selected first
  - random move (`ExamRandomMove`)
  - period swap (`ExamTimeMove`)
  - room swap (`ExamRoomMove`)
  , then a neighbour is generated and it is accepted if the value of the new solution is below certain bound. This bound is initialized to the GreatDeluge.UpperBoundRate × value of the best solution ever found. After each iteration, the bound is decreased by GreatDeluge.CoolRate (new bound equals to old bound × GreatDeluge.CoolRate). If the bound gets bellow GreatDeluge.LowerBoundRate × value of the best solution ever found, it is changed back to GreatDeluge.UpperBoundRate × value of the best solution ever found. If there was no improvement found between the bounds, the new bounds are changed to GreatDeluge.UpperBoundRate^2 and GreatDeluge.LowerBoundRate^2, GreatDeluge.UpperBoundRate^3 and GreatDeluge.LowerBoundRate^3, etc. till there is an improvement found.
  Version:
    ExamTT 1.3 (Examination Timetabling)
    Copyright (C) 2008 - 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/.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ExamGreatDeluge.Context` Deprecated.

  - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext

      `iContextOverride`

    - ### Fields inherited from interface org.cpsolver.ifs.assignment.context.CanHoldContext

      `sMaxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExamGreatDeluge(DataProperties properties)` Deprecated. Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(Assignment<Exam,ExamPlacement> assignment, LazyNeighbour<Exam,ExamPlacement> neighbour, double value)` Deprecated. Accept lazy neighbour
    `protected boolean` | `accept(Solution<Exam,ExamPlacement> solution, Neighbour<Exam,ExamPlacement> neighbour)` Deprecated. Accept neighbour
    `void` | `bestCleared(Solution<Exam,ExamPlacement> solution)` Deprecated. Called by the solution when method `Solution.clearBest()` is called.
    `void` | `bestRestored(Solution<Exam,ExamPlacement> solution)` Deprecated. Called by the solution when method `Solution.restoreBest()` is called.
    `void` | `bestSaved(Solution<Exam,ExamPlacement> solution)` Deprecated. Update last improving iteration count
    `ExamGreatDeluge.Context` | `createAssignmentContext(Assignment<Exam,ExamPlacement> assignment)` Deprecated. Create a new assignment context for the given assignment.
    `Neighbour<Exam,ExamPlacement>` | `genMove(Solution<Exam,ExamPlacement> solution)` Deprecated. Generate neighbour -- select neighbourhood randomly, select neighbour
    `void` | `getInfo(Solution<Exam,ExamPlacement> solution, Map<String,String> info)` Deprecated. Called by the solution when it is asked to produce info table, see `Solution.getInfo()`.
    `void` | `getInfo(Solution<Exam,ExamPlacement> solution, Map<String,String> info, Collection<Exam> variables)` Deprecated. Called by the solution when it is asked to produce info table, see `Solution.getInfo()`.
    `protected void` | `incIter(Solution<Exam,ExamPlacement> solution)` Deprecated. Increment iteration count, update bound
    `protected void` | `info(Solution<Exam,ExamPlacement> solution)` Deprecated. Print some information
    `void` | `init(Solver<Exam,ExamPlacement> solver)` Deprecated. Initialization
    `Neighbour<Exam,ExamPlacement>` | `selectNeighbour(Solution<Exam,ExamPlacement> solution)` Deprecated. A neighbour is generated randomly untill an acceptable one is found.
    `void` | `solutionUpdated(Solution<Exam,ExamPlacement> solution)` Deprecated. Called by the solution when it is updated, see `Solution.update(double)`.

    - ### Methods inherited from class org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext

      `getAssignmentContextReference, getContext, getContext, hasContextOverride, isSingleContextSolver, setAssignmentContextReference`

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

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

- - ### Constructor Detail

    - #### ExamGreatDeluge

          public ExamGreatDeluge(DataProperties properties)

      Deprecated.
      Constructor. Following problem properties are considered:
      - GreatDeluge.CoolRate ... bound cooling rate (default 0.99999995)
      - GreatDeluge.UpperBoundRate ... bound upper bound relative to best solution ever found (default 1.05)
      - GreatDeluge.LowerBoundRate ... bound lower bound relative to best solution ever found (default 0.95)
      Parameters:
        `properties` - problem properties

  - ### Method Detail

    - #### init

          public void init(Solver<Exam,ExamPlacement> solver)

      Deprecated.
      Initialization
      Specified by:
        `init` in interface `NeighbourSelection<Exam,ExamPlacement>`
      Overrides:
        `init` in class `NeighbourSelectionWithContext<Exam,ExamPlacement,ExamGreatDeluge.Context>`
      Parameters:
        `solver` - current solver

    - #### info

          protected void info(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Print some information
      Parameters:
        `solution` - current solution

    - #### genMove

          public Neighbour<Exam,ExamPlacement> genMove(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Generate neighbour -- select neighbourhood randomly, select neighbour
      Parameters:
        `solution` - current solution
      Returns:
        a neigbour that was selected

    - #### accept

          protected boolean accept(Solution<Exam,ExamPlacement> solution,
                                   Neighbour<Exam,ExamPlacement> neighbour)

      Deprecated.
      Accept neighbour
      Parameters:
        `solution` - current solution
        `neighbour` - a neighbour in question
      Returns:
        true if the neighbour should be accepted

    - #### accept

          public boolean accept(Assignment<Exam,ExamPlacement> assignment,
                                LazyNeighbour<Exam,ExamPlacement> neighbour,
                                double value)

      Deprecated.
      Accept lazy neighbour
      Specified by:
        `accept` in interface `LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>`
      Parameters:
        `assignment` - current assignment
        `neighbour` - neighbour that was assigned
        `value` - change in overall solution value
      Returns:
        true if the neighbour can be accepted (false to undo the assignment)

    - #### incIter

          protected void incIter(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Increment iteration count, update bound
      Parameters:
        `solution` - current solution

    - #### selectNeighbour

          public Neighbour<Exam,ExamPlacement> selectNeighbour(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      A neighbour is generated randomly untill an acceptable one is found.
      Specified by:
        `selectNeighbour` in interface `NeighbourSelection<Exam,ExamPlacement>`
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment

    - #### bestSaved

          public void bestSaved(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Update last improving iteration count
      Specified by:
        `bestSaved` in interface `SolutionListener<Exam,ExamPlacement>`
      Parameters:
        `solution` - source solution

    - #### solutionUpdated

          public void solutionUpdated(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Description copied from interface: `SolutionListener`
      Called by the solution when it is updated, see `Solution.update(double)`.
      Specified by:
        `solutionUpdated` in interface `SolutionListener<Exam,ExamPlacement>`
      Parameters:
        `solution` - source solution

    - #### getInfo

          public void getInfo(Solution<Exam,ExamPlacement> solution,
                              Map<String,String> info)

      Deprecated.
      Description copied from interface: `SolutionListener`
      Called by the solution when it is asked to produce info table, see `Solution.getInfo()`. A listener can also add some its info into this table.
      Specified by:
        `getInfo` in interface `SolutionListener<Exam,ExamPlacement>`
      Parameters:
        `solution` - source solution
        `info` - produced info table

    - #### getInfo

          public void getInfo(Solution<Exam,ExamPlacement> solution,
                              Map<String,String> info,
                              Collection<Exam> variables)

      Deprecated.
      Description copied from interface: `SolutionListener`
      Called by the solution when it is asked to produce info table, see `Solution.getInfo()`. A listener can also add some its info into this table.
      Specified by:
        `getInfo` in interface `SolutionListener<Exam,ExamPlacement>`
      Parameters:
        `solution` - source solution
        `info` - produced info table
        `variables` - only variables from this set are included

    - #### bestCleared

          public void bestCleared(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Description copied from interface: `SolutionListener`
      Called by the solution when method `Solution.clearBest()` is called.
      Specified by:
        `bestCleared` in interface `SolutionListener<Exam,ExamPlacement>`
      Parameters:
        `solution` - source solution

    - #### bestRestored

          public void bestRestored(Solution<Exam,ExamPlacement> solution)

      Deprecated.
      Description copied from interface: `SolutionListener`
      Called by the solution when method `Solution.restoreBest()` is called.
      Specified by:
        `bestRestored` in interface `SolutionListener<Exam,ExamPlacement>`
      Parameters:
        `solution` - source solution

    - #### createAssignmentContext

          public ExamGreatDeluge.Context createAssignmentContext(Assignment<Exam,ExamPlacement> assignment)

      Deprecated.
      Description copied from interface: `HasAssignmentContext`
      Create a new assignment context for the given assignment. If there are already some variables assigned in the value, the method should make sure that the context is appropriately initialized.
      Specified by:
        `createAssignmentContext` in interface `HasAssignmentContext<Exam,ExamPlacement,ExamGreatDeluge.Context>`
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
      Returns:
        a new instance of the assignment context, filled according to the given assignment