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