net.sf.cpsolver.ifs.heuristics
Class RoundRobinNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>

java.lang.Object
  extended by net.sf.cpsolver.ifs.heuristics.StandardNeighbourSelection<V,T>
      extended by net.sf.cpsolver.ifs.heuristics.RoundRobinNeighbourSelection<V,T>
All Implemented Interfaces:
NeighbourSelection<V,T>
Direct Known Subclasses:
StudentSctNeighbourSelection

public class RoundRobinNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
extends StandardNeighbourSelection<V,T>

A round robin neighbour selection. Two or more NeighbourSelection needs to be registered within the selection. This selection criterion takes the registered neighbour selections one by one and performs NeighbourSelection.init(Solver) and then it is using NeighbourSelection.selectNeighbour(Solution) to select a neighbour. When null is returned by the underlaying selection, next registered neighbour selection is initialized and used for the following selection(s). If the last registered selection returns null, the selection is returned to the first registered neighbour selection (it is initialized before used again).

Version:
StudentSct 1.2 (Student Sectioning)
Copyright (C) 2007 - 2010 Tomas Muller
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
RoundRobinNeighbourSelection(DataProperties properties)
          Constructor
 
Method Summary
 void changeSelection(Solution<V,T> solution)
          Change selection
 void init(Solver<V,T> solver)
          Initialization
 void registerSelection(NeighbourSelection<V,T> selection)
          Register a neighbour selection
 Neighbour<V,T> selectNeighbour(Solution<V,T> solution)
          Select neighbour.
 
Methods inherited from class net.sf.cpsolver.ifs.heuristics.StandardNeighbourSelection
getValueSelection, getVariableSelection, selectValue, selectVariable, setValueSelection, setVariableSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundRobinNeighbourSelection

public RoundRobinNeighbourSelection(DataProperties properties)
                             throws Exception
Constructor

Parameters:
properties - configuration
Throws:
Exception
Method Detail

registerSelection

public void registerSelection(NeighbourSelection<V,T> selection)
Register a neighbour selection


init

public void init(Solver<V,T> solver)
Initialization

Specified by:
init in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
Overrides:
init in class StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>

selectNeighbour

public Neighbour<V,T> selectNeighbour(Solution<V,T> solution)
Select neighbour. A first registered selections is initialized and used until it returns null, then the second registered selections is initialized and used and vice versa.

Specified by:
selectNeighbour in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
Overrides:
selectNeighbour in class StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
Parameters:
solution - given solution
Returns:
a neighbour assignment

changeSelection

public void changeSelection(Solution<V,T> solution)
Change selection



Copyright © 2014 UniTime LLC. All Rights Reserved.