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