org.cpsolver.ifs.model

## Class LazySwap<V extends Variable<V,T>,T extends Value<V,T>>

- java.lang.Object
- - org.cpsolver.ifs.model.LazyNeighbour<V,T>
  - - org.cpsolver.ifs.model.LazySwap<V,T>

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Implemented Interfaces:
    Neighbour<V,T>

      public class LazySwap<V extends Variable<V,T>,T extends Value<V,T>>
      extends LazyNeighbour<V,T>

  Lazy swap of two variables. See `LazyNeighbour`.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2013 - 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/interfaces inherited from class org.cpsolver.ifs.model.LazyNeighbour

      `LazyNeighbour.LazyNeighbourAcceptanceCriterion<V extends Variable<V,T>,T extends Value<V,T>>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LazySwap(T v1, T v2)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<V,T>` | `assignments()` Return assignments to be done.
    `protected void` | `doAssign(Assignment<V,T> assignment, long iteration)` Perform swap
    `Model<V,T>` | `getModel()` Return problem model
    `String` | `toString()` String representation
    `protected void` | `undoAssign(Assignment<V,T> assignment, long iteration)` Undo the swap

    - ### Methods inherited from class org.cpsolver.ifs.model.LazyNeighbour

      `assign, getAcceptanceCriterion, setAcceptanceCriterion, value`

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

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

- - ### Constructor Detail

    - #### LazySwap

          public LazySwap(T v1,
                          T v2)

      Constructor
      Parameters:
        `v1` - first variable
        `v2` - second variable

  - ### Method Detail

    - #### doAssign

          protected void doAssign(Assignment<V,T> assignment,
                                  long iteration)

      Perform swap
      Specified by:
        `doAssign` in class `LazyNeighbour<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration

    - #### undoAssign

          protected void undoAssign(Assignment<V,T> assignment,
                                    long iteration)

      Undo the swap
      Specified by:
        `undoAssign` in class `LazyNeighbour<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration

    - #### getModel

          public Model<V,T> getModel()

      Return problem model
      Specified by:
        `getModel` in class `LazyNeighbour<V extends Variable<V,T>,T extends Value<V,T>>`
      Returns:
        problem model

    - #### toString

          public String toString()

      String representation
      Overrides:
        `toString` in class `Object`

    - #### assignments

          public Map<V,T> assignments()

      Description copied from interface: `Neighbour`
      Return assignments to be done.
      Returns:
        list of assignments (including unassignments) of this neighbour