org.cpsolver.coursett.constraint

## Class NoStudentOnlineConflicts

- java.lang.Object
- - org.cpsolver.ifs.model.Constraint<V,T>
  - - org.cpsolver.ifs.model.GlobalConstraint<Lecture,Placement>
    - - org.cpsolver.coursett.constraint.NoStudentOnlineConflicts

- All Implemented Interfaces:
    Comparable<Constraint<Lecture,Placement>>

      public class NoStudentOnlineConflicts
      extends GlobalConstraint<Lecture,Placement>

  An experimental global constraints that prohibits cases where a student has an online and in-person class on the same day. Online classes are identified by a regular expression matching the room name and set in the General.OnlineRoom parameter (defaults to (?i)ONLINE|). Classes without a room are considered online when the General.OnlineRoom parameter matches a blank string. If a class has multiple rooms, all rooms must be online for the class to be considered online. See `StudentOnlineConflict` criterion for a soft variant.
  Version:
    CourseTT 1.3 (University Course Timetabling)
    Copyright (C) 2013 - 2023 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
    `NoStudentOnlineConflicts()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `computeConflicts(Assignment<Lecture,Placement> assignment, Placement placement, Set<Placement> conflicts)` The only method which has to be implemented by any constraint.
    `String` | `getName()` Constraint's name -- for printing purposes
    `boolean` | `inConflict(Assignment<Lecture,Placement> assignment, Placement placement)` Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint.
    `boolean` | `isConsistent(Placement p1, Placement p2)` Returns true if the given assignments are consistent respecting this constraint.
    `protected boolean` | `isOnline(Placement p)`
    `void` | `setModel(Model<Lecture,Placement> model)` Sets the model which the constraint belongs to
    `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, hashCode, isHard, removeConstraintListener`

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

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

- - ### Constructor Detail

    - #### NoStudentOnlineConflicts

          public NoStudentOnlineConflicts()

  - ### Method Detail

    - #### setModel

          public void setModel(Model<Lecture,Placement> model)

      Description copied from class: `Constraint`
      Sets the model which the constraint belongs to
      Overrides:
        `setModel` in class `Constraint<Lecture,Placement>`
      Parameters:
        `model` - problem model

    - #### computeConflicts

          public void computeConflicts(Assignment<Lecture,Placement> assignment,
                                       Placement placement,
                                       Set<Placement> 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<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
        `placement` - value to be assigned to its variable
        `conflicts` - resultant set of conflicting values

    - #### inConflict

          public boolean inConflict(Assignment<Lecture,Placement> assignment,
                                    Placement placement)

      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<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
        `placement` - given value
      Returns:
        true if there is a conflict with other assigned variables of the constraint

    - #### isConsistent

          public boolean isConsistent(Placement p1,
                                      Placement p2)

      Description copied from class: `Constraint`
      Returns true if the given assignments are consistent respecting this constraint. This method is used by MAC (see `MacPropagation`).
      Overrides:
        `isConsistent` in class `Constraint<Lecture,Placement>`
      Parameters:
        `p1` - a value
        `p2` - a value
      Returns:
        true if the constraint is ok with the assignment

    - #### isOnline

          protected boolean isOnline(Placement p)

    - #### getName

          public String getName()

      Description copied from class: `Constraint`
      Constraint's name -- for printing purposes
      Overrides:
        `getName` in class `Constraint<Lecture,Placement>`
      Returns:
        constraint name

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`