org.cpsolver.studentsct.heuristics.selection

## Class PriorityConstructionSelection

- java.lang.Object
- - org.cpsolver.studentsct.heuristics.selection.PriorityConstructionSelection

- All Implemented Interfaces:
    NeighbourSelection<Request,Enrollment>

      public class PriorityConstructionSelection
      extends Object
      implements NeighbourSelection<Request,Enrollment>

  This selection is very much like `BranchBoundSelection`, but it works in cycles (over all the students) assigning only the first N priority courses. It starts with N = 1 and increases it by one after each cycle. The selection ends when no student can get more requests assigned in a whole cycle. Run the selection only once (at the beginning), the selection falls back to `BranchBoundSelection` if there are already some requests assigned at the time of initialization.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 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/.
  Author:
    Tomáš Müller

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `PriorityConstructionSelection.ConstructionNeighbour` Takes `BranchBoundSelection.BranchBoundNeighbour` but only assign the given number of assignments, corresponding to the number of cycles.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected StudentOrder` | `iOrder`
    `protected List<Student>` | `iStudents`
    `protected Iterator<Student>` | `iStudentsEnumeration`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PriorityConstructionSelection(DataProperties properties)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Neighbour<Request,Enrollment>` | `branchAndBound(Solution<Request,Enrollment> solution)` Find best solution for the next student using `BranchBoundSelection`.
    `void` | `init(Solver<Request,Enrollment> solver)` Initialize
    `protected void` | `nextCycle(Solution<Request,Enrollment> solution)` Increment cycle
    `Neighbour<Request,Enrollment>` | `selectNeighbour(Solution<Request,Enrollment> solution)` Select neighbor.

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

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

- - ### Field Detail

    - #### iStudentsEnumeration

          protected Iterator<Student> iStudentsEnumeration

    - #### iOrder

          protected StudentOrder iOrder

    - #### iStudents

          protected List<Student> iStudents

  - ### Constructor Detail

    - #### PriorityConstructionSelection

          public PriorityConstructionSelection(DataProperties properties)

      Constructor
      Parameters:
        `properties` - configuration

  - ### Method Detail

    - #### init

          public void init(Solver<Request,Enrollment> solver)

      Initialize
      Specified by:
        `init` in interface `NeighbourSelection<Request,Enrollment>`
      Parameters:
        `solver` - current solver

    - #### branchAndBound

          public Neighbour<Request,Enrollment> branchAndBound(Solution<Request,Enrollment> solution)

      Find best solution for the next student using `BranchBoundSelection`.
      Parameters:
        `solution` - current selection
      Returns:
        generated neighbour

    - #### nextCycle

          protected void nextCycle(Solution<Request,Enrollment> solution)

      Increment cycle
      Parameters:
        `solution` - current solution

    - #### selectNeighbour

          public Neighbour<Request,Enrollment> selectNeighbour(Solution<Request,Enrollment> solution)

      Select neighbor. All students are taken, one by one in a random order. For each student a branch & bound search is employed.
      Specified by:
        `selectNeighbour` in interface `NeighbourSelection<Request,Enrollment>`
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment