001 package net.sf.cpsolver.studentsct.weights;
002
003 import java.util.Set;
004
005 import net.sf.cpsolver.ifs.solution.SolutionComparator;
006 import net.sf.cpsolver.studentsct.extension.DistanceConflict;
007 import net.sf.cpsolver.studentsct.extension.TimeOverlapsCounter;
008 import net.sf.cpsolver.studentsct.model.Enrollment;
009 import net.sf.cpsolver.studentsct.model.Request;
010
011 /**
012 * Interface to model various student weightings
013 *
014 * @version StudentSct 1.2 (Student Sectioning)<br>
015 * Copyright (C) 2007 - 2010 Tomas Muller<br>
016 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
017 * <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
018 * <br>
019 * This library is free software; you can redistribute it and/or modify
020 * it under the terms of the GNU Lesser General Public License as
021 * published by the Free Software Foundation; either version 3 of the
022 * License, or (at your option) any later version. <br>
023 * <br>
024 * This library is distributed in the hope that it will be useful, but
025 * WITHOUT ANY WARRANTY; without even the implied warranty of
026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
027 * Lesser General Public License for more details. <br>
028 * <br>
029 * You should have received a copy of the GNU Lesser General Public
030 * License along with this library; if not see
031 * <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
032 */
033
034 public interface StudentWeights extends SolutionComparator<Request, Enrollment> {
035 /**
036 * Return lower bound for the given request
037 * @param request given request
038 * @return weight of the best value
039 */
040 public double getBound(Request request);
041
042 /**
043 * Return base weight of the given enrollment
044 * @param enrollment given enrollment
045 * @return weight (higher weight means better value)
046 */
047 public double getWeight(Enrollment enrollment);
048
049 /**
050 * Return weight of the given enrollment
051 * @param enrollment given enrollment
052 * @param distanceConflicts distance conflicts
053 * @param timeOverlappingConflicts time overlapping conflicts
054 * @return weight (higher weight means better value)
055 */
056 public double getWeight(Enrollment enrollment, Set<DistanceConflict.Conflict> distanceConflicts, Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts);
057
058 /**
059 * Return weight of a distance conflict
060 */
061 public double getDistanceConflictWeight(DistanceConflict.Conflict distanceConflict);
062
063 /**
064 * Return weight of a time overlapping conflict
065 */
066 public double getTimeOverlapConflictWeight(Enrollment enrollment, TimeOverlapsCounter.Conflict timeOverlap);
067
068 /**
069 * Return true if free time requests allow overlaps
070 */
071 public boolean isFreeTimeAllowOverlaps();
072
073 /**
074 * Registered implementation
075 */
076 public static enum Implementation {
077 Priority(PriorityStudentWeights.class),
078 Equal(EqualStudentWeights.class),
079 Legacy(OriginalStudentWeights.class);
080
081 private Class<? extends StudentWeights> iImplementation;
082 Implementation(Class<? extends StudentWeights> implementation) {
083 iImplementation = implementation;
084 }
085
086 public Class<? extends StudentWeights> getImplementation() { return iImplementation; }
087 }
088 }