net.sf.cpsolver.coursett.model
Class Placement

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Value<Lecture,Placement>
      extended by net.sf.cpsolver.coursett.model.Placement
All Implemented Interfaces:
Comparable<Placement>

public class Placement
extends Value<Lecture,Placement>

Placement (value).

It combines room and time location

Version:
CourseTT 1.2 (University Course Timetabling)
Copyright (C) 2006 - 2010 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 net.sf.cpsolver.ifs.model.Value
iValue
 
Constructor Summary
Placement(Lecture lecture, TimeLocation timeLocation, List<RoomLocation> roomLocations)
           
Placement(Lecture lecture, TimeLocation timeLocation, RoomLocation roomLocation)
          Constructor
 
Method Summary
 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()
           
 int getMaxSpreadPenalty()
           
 String getName()
          Values name -- for printing purposes (E.g., Monday 7:30)
 String getNotValidReason()
           
 int getNrRooms()
           
 List<Long> getRoomIds()
           
 RoomLocation getRoomLocation()
          Room location
 RoomLocation getRoomLocation(Long roomId)
           
 List<RoomLocation> getRoomLocations()
          Room locations (multi-room placement)
 String getRoomName(String delim)
           
 List<String> getRoomNames()
           
 int getRoomPreference()
           
 List<Integer> getRoomPrefs()
           
 int getRoomSize()
           
 int getSpreadPenalty()
           
 TimeLocation getTimeLocation()
          Time location
 int hashCode()
           
 boolean hasRoomLocation(Long roomId)
           
 boolean isHard()
           
 boolean isMultiRoom()
           
 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()
          Dobouble representaion.
 String toString()
           
 
Methods inherited from class net.sf.cpsolver.ifs.model.Value
assigned, compareTo, conflicts, countAssignments, getDescription, getExtra, getId, isConsistent, lastAssignmentIteration, lastUnassignmentIteration, setExtra, setVariable, unassigned, 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


getRoomLocation

public RoomLocation getRoomLocation()
Room location


getRoomLocations

public List<RoomLocation> getRoomLocations()
Room locations (multi-room placement)


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)

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>

getLongName

public String getLongName()

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()

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


getDistanceInMinutes

public static int getDistanceInMinutes(DistanceMetric m,
                                       Placement p1,
                                       Placement p2)
Distance between two placements


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()

getNrRooms

public int getNrRooms()

getSpreadPenalty

public int getSpreadPenalty()

getMaxSpreadPenalty

public int getMaxSpreadPenalty()

toDouble

public double toDouble()
Description copied from class: Value
Dobouble representaion. 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>

getAssignment

public Object getAssignment()

setAssignment

public void setAssignment(Object assignment)