org.cpsolver.instructor.model

## Class TeachingAssignment

- java.lang.Object
- - org.cpsolver.ifs.model.Value<TeachingRequest.Variable,TeachingAssignment>
  - - org.cpsolver.instructor.model.TeachingAssignment

- All Implemented Interfaces:
    Comparable<TeachingAssignment>, AssignmentComparable<TeachingAssignment,TeachingRequest.Variable,TeachingAssignment>

      public class TeachingAssignment
      extends Value<TeachingRequest.Variable,TeachingAssignment>

  Teaching assignment. An assignment of an instructor to a teaching request (a set of sections of a course). A teaching assignment also contains the value of attribute, instructor, course, and time preferences.
  Version:
    IFS 1.3 (Instructor Sectioning)
    Copyright (C) 2016 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/.

- - ### Field Summary

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

      `iValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TeachingAssignment(TeachingRequest.Variable variable, Instructor instructor)` Constructor
    `TeachingAssignment(TeachingRequest.Variable variable, Instructor instructor, int attributePreference)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` By default, comparison is made on unique ids
    `int` | `getAttributePreference()` Attribute preference
    `int` | `getCoursePreference()` Course preference
    `Instructor` | `getInstructor()` Assigned instructor
    `int` | `getInstructorPreference()` Instructor preference
    `String` | `getName()` Values name -- for printing purposes (E.g., Monday 7:30)
    `int` | `getTimePreference()` Time preference
    `int` | `hashCode()`
    `double` | `toDouble(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Double representation.
    `String` | `toString()`

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

      `compareTo, compareTo, conflicts, conflicts, getDescription, getExtra, getId, isConsistent, setExtra, setVariable, toDouble, valueEquals, valueEquals, variable`

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

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

- - ### Constructor Detail

    - #### TeachingAssignment

          public TeachingAssignment(TeachingRequest.Variable variable,
                                    Instructor instructor,
                                    int attributePreference)

      Constructor
      Parameters:
        `variable` - teaching request variable
        `instructor` - instructor (it is expected that `Instructor.canTeach(TeachingRequest)` is true and that `TeachingRequest.getAttributePreference(Instructor)` is not prohibited)
        `attributePreference` - attribute preference (value of `TeachingRequest.getAttributePreference(Instructor)`)

    - #### TeachingAssignment

          public TeachingAssignment(TeachingRequest.Variable variable,
                                    Instructor instructor)

      Constructor
      Parameters:
        `variable` - teaching request variable
        `instructor` - instructor (it is expected that `Instructor.canTeach(TeachingRequest)` is true and that `TeachingRequest.getAttributePreference(Instructor)` is not prohibited)

  - ### Method Detail

    - #### getInstructor

          public Instructor getInstructor()

      Assigned instructor
      Returns:
        assigned instructor

    - #### toDouble

          public double toDouble(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Description copied from class: `Value`
      Double representation. This allows us to have generic optimization criteria. The task is than to minimize total value of assigned variables of a solution.
      Overrides:
        `toDouble` in class `Value<TeachingRequest.Variable,TeachingAssignment>`
      Parameters:
        `assignment` - current assignment
      Returns:
        this value's contribution to the solution value

    - #### equals

          public boolean equals(Object o)

      Description copied from class: `Value`
      By default, comparison is made on unique ids
      Overrides:
        `equals` in class `Value<TeachingRequest.Variable,TeachingAssignment>`

    - #### getAttributePreference

          public int getAttributePreference()

      Attribute preference
      Returns:
        `TeachingRequest.getAttributePreference(Instructor)`

    - #### getTimePreference

          public int getTimePreference()

      Time preference
      Returns:
        `Instructor.getTimePreference(TeachingRequest)`

    - #### getInstructorPreference

          public int getInstructorPreference()

      Instructor preference
      Returns:
        `TeachingRequest.getInstructorPreference(Instructor)`

    - #### getCoursePreference

          public int getCoursePreference()

      Course preference
      Returns:
        `Instructor.getCoursePreference(Course)` for `TeachingRequest.getCourse()`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Value<TeachingRequest.Variable,TeachingAssignment>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Value<TeachingRequest.Variable,TeachingAssignment>`

    - #### getName

          public String getName()

      Description copied from class: `Value`
      Values name -- for printing purposes (E.g., Monday 7:30)
      Overrides:
        `getName` in class `Value<TeachingRequest.Variable,TeachingAssignment>`
      Returns:
        value name