public class ReservationLimit extends GlobalConstraint<Request,Enrollment>
Request.getWeight()
) enrolled into a reservation is below
the reservation's limit (see Reservation.getLimit()
). It also ensures that
the desired space is reserved in the enrollment's offering and configuration.
Parameter | Type | Comment |
---|---|---|
ReservationLimit.PreferDummyStudents | Boolean |
If true, requests of dummy (last-like) students are preferred to be selected as conflicting. |
iConstraintListeners, iId
Constructor and Description |
---|
ReservationLimit(DataProperties cfg)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
computeConflicts(Assignment<Request,Enrollment> assignment,
Enrollment enrollment,
Set<Enrollment> conflicts)
A given enrollment is conflicting, if the reservation's remaining available space
(computed by
Reservation.getReservedAvailableSpace(Assignment, Request) )
is below the requests weight Request.getWeight() . |
static double |
getUnreservedSpace(Assignment<Request,Enrollment> assignment,
Config config,
Request request,
boolean hasReservation)
Remaining unreserved space in a config if the given request is assigned.
|
boolean |
inConflict(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
A given enrollment is conflicting, if the config's enrollment (computed by
ConfigLimit.getEnrollmentWeight(Assignment, Config, Request) ) exceeds the
limit. |
String |
toString() |
addVariable, assigned, assignedVariables, countAssignedVariables, removeVariable, unassigned, variables
addConstraintListener, compareTo, computeConflictsNoForwardCheck, constraintListeners, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isConsistent, isHard, removeConstraintListener, setModel
public ReservationLimit(DataProperties cfg)
cfg
- solver configurationpublic static double getUnreservedSpace(Assignment<Request,Enrollment> assignment, Config config, Request request, boolean hasReservation)
assignment
- current assignmentconfig
- a config that is of concernrequest
- a request of a student to be assigned containing the given
sectionhasReservation
- true if the enrollment in question has a reservation (only not matching the given configuration)public void computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment, Set<Enrollment> conflicts)
Reservation.getReservedAvailableSpace(Assignment, Request)
)
is below the requests weight Request.getWeight()
. computeConflicts
in class Constraint<Request,Enrollment>
enrollment
- Enrollment
that is being consideredconflicts
- all computed conflicting requests are added into this setassignment
- current assignmentpublic boolean inConflict(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
ConfigLimit.getEnrollmentWeight(Assignment, Config, Request)
) exceeds the
limit.inConflict
in class Constraint<Request,Enrollment>
enrollment
- Enrollment
that is being consideredassignment
- current assignment