org.cpsolver.coursett.model

## Class Placement

- java.lang.Object
- - org.cpsolver.ifs.model.Value<Lecture,Placement>
  - - org.cpsolver.coursett.model.Placement

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

      public class Placement
      extends Value<Lecture,Placement>

  Placement (value).
  It combines room and time location
  Version:
    CourseTT 1.3 (University Course Timetabling)
    Copyright (C) 2006 - 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

- - ### Field Summary

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

      `iValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Placement(Lecture lecture, TimeLocation timeLocation, List<RoomLocation> roomLocations)`
    `Placement(Lecture lecture, TimeLocation timeLocation, RoomLocation roomLocation)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canShareRooms(Placement other)`
    `boolean` | `equals(Object object)` By default, comparison is made on unique ids
    `Object` | `getAssignment()`
    `Long` | `getAssignmentId()`
    `List<Long>` | `getBuildingIds()`
    `int` | `getCommitedConflicts()`
    `static double` | `getDistanceInMeters(DistanceMetric m, Placement p1, Placement p2)` Distance between two placements
    `static int` | `getDistanceInMinutes(DistanceMetric m, Placement p1, Placement p2)` Distance between two placements
    `String` | `getLongName()` Deprecated.
    `String` | `getLongName(boolean useAmPm)`
    `int` | `getMaxSpreadPenalty(Assignment<Lecture,Placement> assignment)`
    `String` | `getName()` Values name -- for printing purposes (E.g., Monday 7:30)
    `String` | `getName(boolean useAmPm)`
    `String` | `getNotValidReason(Assignment<Lecture,Placement> assignment)` Deprecated.
    `String` | `getNotValidReason(Assignment<Lecture,Placement> assignment, boolean useAmPm)`
    `int` | `getNrRooms()`
    `List<Long>` | `getRoomIds()`
    `RoomLocation` | `getRoomLocation()` Room location
    `RoomLocation` | `getRoomLocation(Long roomId)`
    `int` | `getRoomLocationIndex(Long roomId)`
    `List<RoomLocation>` | `getRoomLocations()` Room locations (multi-room placement)
    `String` | `getRoomName(String delim)`
    `List<String>` | `getRoomNames()`
    `int` | `getRoomPenalty()`
    `int` | `getRoomPreference()`
    `List<Integer>` | `getRoomPrefs()`
    `int` | `getRoomSize()`
    `int` | `getSpreadPenalty(Assignment<Lecture,Placement> assignment)`
    `TimeLocation` | `getTimeLocation()` Time location
    `double` | `getTimePenalty()`
    `int` | `hashCode()`
    `boolean` | `hasRoomLocation(Long roomId)`
    `boolean` | `isHard(Assignment<Lecture,Placement> assignment)`
    `boolean` | `isMultiRoom()`
    `boolean` | `isRoomProhibited()`
    `boolean` | `isValid()`
    `int` | `nrDifferentBuildings(Placement placement)`
    `int` | `nrDifferentRooms(Placement placement)`
    `boolean` | `sameRooms(Placement placement)`
    `boolean` | `sameTime(Placement placement)`
    `void` | `setAssignment(Object assignment)`
    `void` | `setAssignmentId(Long assignmentId)`
    `boolean` | `shareRooms(Placement placement)`
    `int` | `sumRoomPreference()`
    `double` | `toDouble(Assignment<Lecture,Placement> 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

    - #### Placement

          public Placement(Lecture lecture,
                           TimeLocation timeLocation,
                           RoomLocation roomLocation)

      Constructor
      Parameters:
        `lecture` - lecture
        `timeLocation` - time location
        `roomLocation` - room location

    - #### Placement

          public Placement(Lecture lecture,
                           TimeLocation timeLocation,
                           List<RoomLocation> roomLocations)

  - ### Method Detail

    - #### getTimeLocation

          public TimeLocation getTimeLocation()

      Time location
      Returns:
        time of this placement

    - #### getRoomLocation

          public RoomLocation getRoomLocation()

      Room location
      Returns:
        room of this placement

    - #### getRoomLocations

          public List<RoomLocation> getRoomLocations()

      Room locations (multi-room placement)
      Returns:
        rooms of this placement (if there are more than one)

    - #### getBuildingIds

          public List<Long> getBuildingIds()

    - #### getRoomIds

          public List<Long> getRoomIds()

    - #### getRoomNames

          public List<String> getRoomNames()

    - #### getRoomPrefs

          public List<Integer> getRoomPrefs()

    - #### isMultiRoom

          public boolean isMultiRoom()

    - #### getRoomLocation

          public RoomLocation getRoomLocation(Long roomId)

    - #### getRoomLocationIndex

          public int getRoomLocationIndex(Long roomId)

    - #### hasRoomLocation

          public boolean hasRoomLocation(Long roomId)

    - #### getRoomName

          public String getRoomName(String delim)

    - #### getName

          public String getName()

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

    - #### getName

          public String getName(boolean useAmPm)

    - #### getLongName

          public String getLongName(boolean useAmPm)

    - #### getLongName

          @Deprecated
          public String getLongName()

      Deprecated.

    - #### sameRooms

          public boolean sameRooms(Placement placement)

    - #### shareRooms

          public boolean shareRooms(Placement placement)

    - #### nrDifferentRooms

          public int nrDifferentRooms(Placement placement)

    - #### nrDifferentBuildings

          public int nrDifferentBuildings(Placement placement)

    - #### sumRoomPreference

          public int sumRoomPreference()

    - #### getRoomPreference

          public int getRoomPreference()

    - #### getRoomSize

          public int getRoomSize()

    - #### isHard

          public boolean isHard(Assignment<Lecture,Placement> assignment)

    - #### isRoomProhibited

          public boolean isRoomProhibited()

    - #### sameTime

          public boolean sameTime(Placement placement)

    - #### equals

          public boolean equals(Object object)

      Description copied from class: `Value`
      By default, comparison is made on unique ids
      Overrides:
        `equals` in class `Value<Lecture,Placement>`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Value<Lecture,Placement>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Value<Lecture,Placement>`

    - #### getDistanceInMeters

          public static double getDistanceInMeters(DistanceMetric m,
                                                   Placement p1,
                                                   Placement p2)

      Distance between two placements
      Parameters:
        `m` - distance matrix
        `p1` - first placement
        `p2` - second placement
      Returns:
        maximal distance in meters between the two placement

    - #### getDistanceInMinutes

          public static int getDistanceInMinutes(DistanceMetric m,
                                                 Placement p1,
                                                 Placement p2)

      Distance between two placements
      Parameters:
        `m` - distance matrix
        `p1` - first placement
        `p2` - second placement
      Returns:
        maximal distance in minutes between the two placement

    - #### getCommitedConflicts

          public int getCommitedConflicts()

    - #### getAssignmentId

          public Long getAssignmentId()

    - #### setAssignmentId

          public void setAssignmentId(Long assignmentId)

    - #### canShareRooms

          public boolean canShareRooms(Placement other)

    - #### isValid

          public boolean isValid()

    - #### getNotValidReason

          public String getNotValidReason(Assignment<Lecture,Placement> assignment,
                                          boolean useAmPm)

    - #### getNotValidReason

          @Deprecated
          public String getNotValidReason(Assignment<Lecture,Placement> assignment)

      Deprecated.

    - #### getNrRooms

          public int getNrRooms()

    - #### getSpreadPenalty

          public int getSpreadPenalty(Assignment<Lecture,Placement> assignment)

    - #### getMaxSpreadPenalty

          public int getMaxSpreadPenalty(Assignment<Lecture,Placement> assignment)

    - #### toDouble

          public double toDouble(Assignment<Lecture,Placement> 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<Lecture,Placement>`
      Parameters:
        `assignment` - current assignment
      Returns:
        this value's contribution to the solution value

    - #### getAssignment

          public Object getAssignment()

    - #### setAssignment

          public void setAssignment(Object assignment)

    - #### getTimePenalty

          public double getTimePenalty()

    - #### getRoomPenalty

          public int getRoomPenalty()