net.sf.cpsolver.ifs.heuristics
Class RoundRobinNeighbourSelection

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

public class RoundRobinNeighbourSelection
extends StandardNeighbourSelection

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.1 (Student Sectioning)
Copyright (C) 2007 Tomáš Müller
muller@unitime.org
Lazenska 391, 76314 Zlin, Czech Republic

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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Constructor Summary
RoundRobinNeighbourSelection(DataProperties properties)
          Constructor
 
Method Summary
 void changeSelection(Solution solution)
          Change selection
 void init(Solver solver)
          Initialization
 void registerSelection(NeighbourSelection selection)
          Register a neighbour selection
 Neighbour selectNeighbour(Solution 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 selection)
Register a neighbour selection


init

public void init(Solver solver)
Initialization

Specified by:
init in interface NeighbourSelection
Overrides:
init in class StandardNeighbourSelection

selectNeighbour

public Neighbour selectNeighbour(Solution 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
Overrides:
selectNeighbour in class StandardNeighbourSelection
Parameters:
solution - given solution
Returns:
a neighbour assignment

changeSelection

public void changeSelection(Solution solution)
Change selection