org.cpsolver.studentsct.constraint

## Class FreeTimeConflicts

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

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

      public class FreeTimeConflicts
      extends GlobalConstraint<Request,Enrollment>

  A simple global constraint that does not allow an overlap with a higher priority free time request, even when it is not assigned.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 2026 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
    `FreeTimeConflicts()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment value, Set<Enrollment> conflicts)` The only method which has to be implemented by any constraint.
    `boolean` | `inConflict(Assignment<Request,Enrollment> assignment, Enrollment value)` Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint.

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

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

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

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

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

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

- - ### Constructor Detail

    - #### FreeTimeConflicts

          public FreeTimeConflicts()

  - ### Method Detail

    - #### computeConflicts

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

      Description copied from class: `Constraint`
      The only method which has to be implemented by any constraint. It returns the values which needs to be unassigned in order to make this constraint consistent with the given value if it is assigned to its variable. The computed list of conflicting values is added to the given set of conflicts.
      Specified by:
        `computeConflicts` in class `Constraint<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment
        `value` - value to be assigned to its variable
        `conflicts` - resultant set of conflicting values

    - #### inConflict

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

      Description copied from class: `Constraint`
      Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint. This method is used by MAC (see `MacPropagation`).
      Overrides:
        `inConflict` in class `Constraint<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment
        `value` - given value
      Returns:
        true if there is a conflict with other assigned variables of the constraint