001package org.cpsolver.coursett.criteria.additional;
002
003import java.util.Collection;
004import java.util.Map;
005
006import org.cpsolver.coursett.model.Lecture;
007import org.cpsolver.coursett.model.Placement;
008import org.cpsolver.coursett.model.Student;
009import org.cpsolver.ifs.assignment.Assignment;
010import org.cpsolver.ifs.util.DataProperties;
011
012
013/**
014 * Important student hard conflicts. Same as {@link ImportantStudentConflict}, but
015 * only hard student conflicts are counted (between classes that do not have alternatives,
016 * see {@link Lecture#isSingleSection()}). Weighted by Comparator.ImportantHardStudentConflictWeight
017 * parameter.
018 * .  
019 * <br>
020 * 
021 * @author  Tomáš Müller
022 * @version CourseTT 1.3 (University Course Timetabling)<br>
023 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
024 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
025 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
026 * <br>
027 *          This library is free software; you can redistribute it and/or modify
028 *          it under the terms of the GNU Lesser General Public License as
029 *          published by the Free Software Foundation; either version 3 of the
030 *          License, or (at your option) any later version. <br>
031 * <br>
032 *          This library is distributed in the hope that it will be useful, but
033 *          WITHOUT ANY WARRANTY; without even the implied warranty of
034 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
035 *          Lesser General Public License for more details. <br>
036 * <br>
037 *          You should have received a copy of the GNU Lesser General Public
038 *          License along with this library; if not see
039 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
040 */
041public class ImportantStudentHardConflict extends ImportantStudentConflict {
042
043    @Override
044    public boolean isApplicable(Lecture l1, Lecture l2) {
045        return l1 != null && l2 != null && !ignore(l1, l2) && hard(l1, l2) && important(l1, l2);
046    }
047    
048    @Override
049    public boolean isApplicable(Student student, Lecture l1, Lecture l2) {
050        return l1 != null && l2 != null && !ignore(l1, l2) && hard(l1, l2) && student.getConflictingPriorty(l1, l2) != null;
051    }
052
053    @Override
054    public double getWeightDefault(DataProperties config) {
055        return config.getPropertyDouble("Comparator.ImportantHardStudentConflictWeight",
056                3.0 * config.getPropertyDouble("Comparator.HardStudentConflictWeight", 5.0));
057    }
058    
059    @Override
060    public String getPlacementSelectionWeightName() {
061        return "Placement.NrImportantHardStudConfsWeight";
062    }
063    
064    @Override
065    public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info) {
066    }
067    
068    @Override
069    public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info, Collection<Lecture> variables) {
070    }
071}