org.cpsolver.studentsct.constraint

## Class HardDistanceConflicts

- java.lang.Object
- - org.cpsolver.ifs.model.Constraint<V,T>
  - - org.cpsolver.ifs.model.GlobalConstraint<Request,Enrollment>
    - - org.cpsolver.studentsct.constraint.HardDistanceConflicts

- All Implemented Interfaces:
    Comparable<Constraint<Request,Enrollment>>

      public class HardDistanceConflicts
      extends GlobalConstraint<Request,Enrollment>

  Hard distance conflicts constraint. This global constraint checks for distance conflicts that should not be allowed. These are distance conflicts where the distance betweem the two sections is longer than HardDistanceConflict.DistanceHardLimitInMinutes minutes (defaults to 60) and the distance to travel between the two sections is longer than HardDistanceConflict.AllowedDistanceInMinutes minutes (defaults to 30). The constraint checks both pairs of sections that the student is to be enrolled in and distance conflicts with unavailabilities. Hard distance conflicts are allowed between sections that allow for time conflicts.
  Version:
    StudentSct 1.4 (Student Sectioning)
    Copyright (C) 2007 - 2025 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

- - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.model.Constraint

      `iConstraintListeners, iId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HardDistanceConflicts()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment, Set<Enrollment> conflicts)` A given enrollment is conflicting, if there is a section that is disabled and there is not a matching reservation that would allow for that.
    `boolean` | `inConflict(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` A given enrollment is conflicting, if there is a section that is disabled and there is not a matching reservation that would allow for that.
    `static boolean` | `inConflict(StudentQuality sq, SctAssignment s1, Enrollment e)`
    `static boolean` | `inConflict(StudentQuality sq, Section s1, Section s2)`
    `static boolean` | `inConflict(StudentQuality sq, Section s1, Unavailability s2)`
    `String` | `toString()`

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

      `addVariable, assigned, assignedVariables, countAssignedVariables, removeVariable, unassigned, variables`

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

      `addConstraintListener, compareTo, computeConflictsNoForwardCheck, constraintListeners, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isConsistent, isHard, removeConstraintListener, setModel`

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

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

- - ### Constructor Detail

    - #### HardDistanceConflicts

          public HardDistanceConflicts()

  - ### Method Detail

    - #### computeConflicts

          public void computeConflicts(Assignment<Request,Enrollment> assignment,
                                       Enrollment enrollment,
                                       Set<Enrollment> conflicts)

      A given enrollment is conflicting, if there is a section that is disabled and there is not a matching reservation that would allow for that.
      Specified by:
        `computeConflicts` in class `Constraint<Request,Enrollment>`
      Parameters:
        `enrollment` - `Enrollment` that is being considered
        `conflicts` - all computed conflicting requests are added into this set
        `assignment` - current assignment

    - #### inConflict

          public boolean inConflict(Assignment<Request,Enrollment> assignment,
                                    Enrollment enrollment)

      A given enrollment is conflicting, if there is a section that is disabled and there is not a matching reservation that would allow for that.
      Overrides:
        `inConflict` in class `Constraint<Request,Enrollment>`
      Parameters:
        `enrollment` - `Enrollment` that is being considered
        `assignment` - current assignment
      Returns:
        true, if the enrollment does not follow a reservation that must be used

    - #### inConflict

          public static boolean inConflict(StudentQuality sq,
                                           Section s1,
                                           Unavailability s2)

    - #### inConflict

          public static boolean inConflict(StudentQuality sq,
                                           Section s1,
                                           Section s2)

    - #### inConflict

          public static boolean inConflict(StudentQuality sq,
                                           SctAssignment s1,
                                           Enrollment e)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`