net.sf.cpsolver.studentsct.constraint
Class ConfigLimit
java.lang.Object
net.sf.cpsolver.ifs.model.Constraint<V,T>
net.sf.cpsolver.ifs.model.GlobalConstraint<Request,Enrollment>
net.sf.cpsolver.studentsct.constraint.ConfigLimit
- All Implemented Interfaces:
- Comparable<Constraint<Request,Enrollment>>
public class ConfigLimit
- extends GlobalConstraint<Request,Enrollment>
Configuration limit constraint. This global constraint ensures that a limit of each
configuration is not exceeded. This means that the total sum of weights of course
requests (see Request.getWeight()) enrolled into a configuration is below
the configuration's limit (see Config.getLimit()).
Configurations with negative limit are considered unlimited, and therefore
completely ignored by this constraint.
Parameters:
| Parameter |
Type |
Comment |
| ConfigLimit.PreferDummyStudents |
Boolean |
If true, requests of dummy (last-like) students are preferred to be
selected as conflicting. |
- Version:
- StudentSct 1.2 (Student Sectioning)
Copyright (C) 2007 - 2010 Tomas Muller
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/.
| Methods inherited from class net.sf.cpsolver.ifs.model.Constraint |
addConstraintListener, compareTo, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isConsistent, isHard, removeConstraintListener, setModel |
ConfigLimit
public ConfigLimit(DataProperties cfg)
- Constructor
- Parameters:
cfg - solver configuration
getEnrollmentWeight
public static double getEnrollmentWeight(Config config,
Request request)
- Enrollment weight of a config if the given request is assigned. In order
to overcome rounding problems with last-like students ( e.g., 5 students
are projected to two configs of limit 2 -- each section can have up to 3
of these last-like students), the weight of the request with the highest
weight in the config is changed to a small nominal weight.
- Parameters:
config - a config that is of concernrequest - a request of a student to be assigned containing the given
section
- Returns:
- section's new weight
computeConflicts
public void computeConflicts(Enrollment enrollment,
Set<Enrollment> conflicts)
- A given enrollment is conflicting, if the config's enrollment
(computed by
getEnrollmentWeight(Config, Request))
exceeds the limit.
If the limit is breached, one or more existing enrollments are
(randomly) selected as conflicting until the overall weight is under the
limit.
- Specified by:
computeConflicts in class Constraint<Request,Enrollment>
- Parameters:
enrollment - Enrollment that is being consideredconflicts - all computed conflicting requests are added into this set
inConflict
public boolean inConflict(Enrollment enrollment)
- A given enrollment is conflicting, if the config's enrollment (computed by
getEnrollmentWeight(Config, Request)) exceeds the
limit.
- Overrides:
inConflict in class Constraint<Request,Enrollment>
- Parameters:
enrollment - Enrollment that is being considered
- Returns:
- true, if the enrollment cannot be assigned without exceeding the limit
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2013 UniTime LLC. All Rights Reserved.