net.sf.cpsolver.coursett.constraint
Class MaxBlockFlexibleConstraint
java.lang.Object
net.sf.cpsolver.ifs.model.Constraint<Lecture,Placement>
net.sf.cpsolver.coursett.constraint.FlexibleConstraint
net.sf.cpsolver.coursett.constraint.MaxBlockFlexibleConstraint
- All Implemented Interfaces:
- Comparable<Constraint<Lecture,Placement>>
public class MaxBlockFlexibleConstraint
- extends FlexibleConstraint
The MaxBlock constraint checks for too big blocks of back-to-back classes of an instructor.
It has two parameters: a maximal length of a back-to-back block that is allowed and a minimal length of a break between two classes not to be considered in the same block.
Reference _MaxBlock:120:30_ translates to a maximal block of at most 2 hours (120 minutes) with classes not more than 30 minutes a part.
- 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 |
MaxBlockFlexibleConstraint
public MaxBlockFlexibleConstraint(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
getBlocks
public List<FlexibleConstraint.Block> getBlocks(int dayCode,
Set<Placement> conflicts,
Placement value,
HashMap<Lecture,Placement> assignments,
BitSet week)
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.