org.cpsolver.exam.neighbours

## Class ExamRoomSwapNeighbour

- java.lang.Object
- - org.cpsolver.exam.neighbours.ExamRoomSwapNeighbour

- All Implemented Interfaces:
    Neighbour<Exam,ExamPlacement>

      public class ExamRoomSwapNeighbour
      extends Object
      implements Neighbour<Exam,ExamPlacement>

  Swap a room between two assigned exams.
  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/.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExamRoomSwapNeighbour(Assignment<Exam,ExamPlacement> assignment, ExamPlacement placement, ExamRoomPlacement current, ExamRoomPlacement swap)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assign(Assignment<Exam,ExamPlacement> assignment, long iteration)` Perform assignment
    `Map<Exam,ExamPlacement>` | `assignments()` Return assignments to be done.
    `boolean` | `canDo()`
    `String` | `toString()`
    `protected static String` | `toString(double[] x, double[] y)`
    `double` | `value(Assignment<Exam,ExamPlacement> assignment)` Difference in the evaluation function, if this neighnour is assigned.

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

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

- - ### Constructor Detail

    - #### ExamRoomSwapNeighbour

          public ExamRoomSwapNeighbour(Assignment<Exam,ExamPlacement> assignment,
                                       ExamPlacement placement,
                                       ExamRoomPlacement current,
                                       ExamRoomPlacement swap)

  - ### Method Detail

    - #### canDo

          public boolean canDo()

    - #### assign

          public void assign(Assignment<Exam,ExamPlacement> assignment,
                             long iteration)

      Description copied from interface: `Neighbour`
      Perform assignment
      Specified by:
        `assign` in interface `Neighbour<Exam,ExamPlacement>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          protected static String toString(double[] x,
                                           double[] y)

    - #### value

          public double value(Assignment<Exam,ExamPlacement> assignment)

      Description copied from interface: `Neighbour`
      Difference in the evaluation function, if this neighnour is assigned.
      Specified by:
        `value` in interface `Neighbour<Exam,ExamPlacement>`
      Parameters:
        `assignment` - current assignment
      Returns:
        difference in the solution value when assigned

    - #### assignments

          public Map<Exam,ExamPlacement> assignments()

      Description copied from interface: `Neighbour`
      Return assignments to be done.
      Specified by:
        `assignments` in interface `Neighbour<Exam,ExamPlacement>`
      Returns:
        list of assignments (including unassignments) of this neighbour