net.sf.cpsolver.coursett.heuristics
Class TimetableComparator

java.lang.Object
  extended by net.sf.cpsolver.coursett.heuristics.TimetableComparator
All Implemented Interfaces:
SolutionComparator

public class TimetableComparator
extends Object
implements SolutionComparator

Timetable (solution) comparator.

The quality of a solution is expressed as a weighted sum combining soft time and classroom preferences, satisfied soft group constrains and the total number of student conflicts. This allows us to express the importance of different types of soft constraints.

The solution comparator prefers a more complete solution (with a smaller number of unassigned variables) and a solution with a smaller number of perturbations among solutions with the same number of unassigned variables. If both solutions have the same number of unassigned variables and perturbations, the solution of better quality is selected.

Parameters:

ParameterTypeComment
Comparator.HardStudentConflictWeightDoubleWeight of hard student conflict (conflict between single-section classes)
Comparator.StudentConflictWeightDoubleWeight of student conflict
Comparator.TimePreferenceWeightDoubleTime preferences weight
Comparator.ContrPreferenceWeightDoubleGroup constraint preferences weight
Comparator.RoomPreferenceWeightDoubleRoom preferences weight
Comparator.UselessSlotWeightDoubleUseless slots weight
Comparator.TooBigRoomWeightDoubleToo big room weight
Comparator.DistanceInstructorPreferenceWeightDoubleDistance (of the rooms of the back-to-back classes) based instructor preferences weight
Comparator.PerturbationPenaltyWeightDoublePerturbation penalty (see UniversalPerturbationsCounter)
Comparator.DeptSpreadPenaltyWeightDoubleDepartment balancing penalty (see DepartmentSpreadConstraint)

Version:
CourseTT 1.1 (University Course Timetabling)
Copyright (C) 2006 Tomáš Müller
muller@unitime.org
Lazenska 391, 76314 Zlin, Czech Republic

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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Field Summary
static String COMMITED_STUDENT_CONFLICT_WEIGHT
           
static String CONSTR_PREFERENCE_WEIGHT
           
static String DEPT_SPREAD_PENALTY_WEIGHT
           
static String DISTANCE_INSTRUCTOR_PREFERENCE_WEIGHT
           
static String HARD_STUDENT_CONFLICT_WEIGHT
           
static String PERTURBATION_PENALTY_WEIGHT
           
static String ROOM_PREFERENCE_WEIGHT
           
protected static Logger sLogger
           
static String SPREAD_PENALTY_WEIGHT
           
static String STUDENT_CONFLICT_WEIGHT
           
static String TIME_PREFERENCE_WEIGHT
           
static String TOO_BIG_ROOM_WEIGHT
           
static String USELESS_SLOT_WEIGHT
           
 
Constructor Summary
TimetableComparator(DataProperties properties)
           
 
Method Summary
 double bestValue(Solution currentSolution)
           
 double currentValue(Solution currentSolution)
           
 double currentValue(TimetableModel tm, PerturbationsCounter cnt)
           
 double currentValue(TimetableModel tm, PerturbationsCounter cnt, Vector variables)
           
 boolean isBetterThanBestSolution(Solution currentSolution)
          Compares two solutions.
 double value(Placement placement, PerturbationsCounter cnt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sLogger

protected static Logger sLogger

USELESS_SLOT_WEIGHT

public static final String USELESS_SLOT_WEIGHT
See Also:
Constant Field Values

TIME_PREFERENCE_WEIGHT

public static final String TIME_PREFERENCE_WEIGHT
See Also:
Constant Field Values

STUDENT_CONFLICT_WEIGHT

public static final String STUDENT_CONFLICT_WEIGHT
See Also:
Constant Field Values

ROOM_PREFERENCE_WEIGHT

public static final String ROOM_PREFERENCE_WEIGHT
See Also:
Constant Field Values

CONSTR_PREFERENCE_WEIGHT

public static final String CONSTR_PREFERENCE_WEIGHT
See Also:
Constant Field Values

HARD_STUDENT_CONFLICT_WEIGHT

public static final String HARD_STUDENT_CONFLICT_WEIGHT
See Also:
Constant Field Values

TOO_BIG_ROOM_WEIGHT

public static final String TOO_BIG_ROOM_WEIGHT
See Also:
Constant Field Values

DISTANCE_INSTRUCTOR_PREFERENCE_WEIGHT

public static final String DISTANCE_INSTRUCTOR_PREFERENCE_WEIGHT
See Also:
Constant Field Values

PERTURBATION_PENALTY_WEIGHT

public static final String PERTURBATION_PENALTY_WEIGHT
See Also:
Constant Field Values

DEPT_SPREAD_PENALTY_WEIGHT

public static final String DEPT_SPREAD_PENALTY_WEIGHT
See Also:
Constant Field Values

SPREAD_PENALTY_WEIGHT

public static final String SPREAD_PENALTY_WEIGHT
See Also:
Constant Field Values

COMMITED_STUDENT_CONFLICT_WEIGHT

public static final String COMMITED_STUDENT_CONFLICT_WEIGHT
See Also:
Constant Field Values
Constructor Detail

TimetableComparator

public TimetableComparator(DataProperties properties)
Method Detail

isBetterThanBestSolution

public boolean isBetterThanBestSolution(Solution currentSolution)
Description copied from interface: SolutionComparator
Compares two solutions. Returns true if the given solution is better than its best ever found solution (see Solution.saveBest() and Solution.restoreBest()).

Specified by:
isBetterThanBestSolution in interface SolutionComparator
Parameters:
currentSolution - given solution
Returns:
true if the given solution is better than the best ever found solution

currentValue

public double currentValue(Solution currentSolution)

currentValue

public double currentValue(TimetableModel tm,
                           PerturbationsCounter cnt)

currentValue

public double currentValue(TimetableModel tm,
                           PerturbationsCounter cnt,
                           Vector variables)

bestValue

public double bestValue(Solution currentSolution)

value

public double value(Placement placement,
                    PerturbationsCounter cnt)