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