net.sf.cpsolver.coursett.constraint
Class BreakFlexibleConstraint
java.lang.Object
net.sf.cpsolver.ifs.model.Constraint<Lecture,Placement>
net.sf.cpsolver.coursett.constraint.FlexibleConstraint
net.sf.cpsolver.coursett.constraint.BreakFlexibleConstraint
- All Implemented Interfaces:
- Comparable<Constraint<Lecture,Placement>>
public class BreakFlexibleConstraint
- extends FlexibleConstraint
The Break constraint checks for instructor lunch break or a break in general in between the given classes.
It has three parameters: a start and an end time of a window in which the break is required / preferred, and a minimal length of a break that is needed.
Reference _Break:132:162:30_ translates to a break of at least 30 minutes between 11 am (slot 132) and 1:30 pm (slot 162).
- Version:
- CourseTT 1.2 (University Course Timetabling)
Copyright (C) 2013 Matej Lukac
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.coursett.constraint.FlexibleConstraint |
assigned, getCurrentPreference, getName, getOwner, getPrologPreference, getReference, getRelevantPlacements, getType, getWeeks, isConsistent, isHard, mergeToBlocks, toString, unassigned |
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint |
addConstraintListener, addVariable, assignedVariables, compareTo, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, inConflict, removeConstraintListener, removeVariable, setModel, variables |
BreakFlexibleConstraint
public BreakFlexibleConstraint(Long id,
String owner,
String preference,
String reference)
- Parameters:
owner
- identifier of distribution preference the constraint was created forpreference
- time preference ("R" for required, "P" for prohibited, "-2",
"-1", "1", "2" for soft preference)reference
- parameters of the constraint in String form
computeConflicts
public void computeConflicts(Placement value,
Set<Placement> conflicts)
- Description copied from class:
Constraint
- The only method which has to be implemented by any constraint. It returns
the values which needs to be unassigned in order to make this constraint
consistent with the given value if it is assigned to its variable. The
computed list of conflicting values is added to the given set of
conflicts.
- Specified by:
computeConflicts
in class FlexibleConstraint
- Parameters:
value
- value to be assigned to its varaibleconflicts
- resultant set of conflicting values
getBreakBlocks
public List<FlexibleConstraint.Block> getBreakBlocks(int dayCode,
Set<Placement> conflicts,
Placement value,
HashMap<Lecture,Placement> assignments,
BitSet week)
- Creates a list of consecutive blocks with back-to-back classes.
getNrViolations
public double getNrViolations(Set<Placement> conflicts,
HashMap<Lecture,Placement> assignments)
- Specified by:
getNrViolations
in class FlexibleConstraint
- Parameters:
conflicts
- conflicting placements to be unassignedassignments
- assigned placements
- Returns:
- the number of violations of the constraint during days and all weeks of the semester
Copyright © 2014 UniTime LLC. All Rights Reserved.