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 * @version CourseTT 1.3 (University Course Timetabling)<br>
022 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
023 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
024 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
025 * <br>
026 *          This library is free software; you can redistribute it and/or modify
027 *          it under the terms of the GNU Lesser General Public License as
028 *          published by the Free Software Foundation; either version 3 of the
029 *          License, or (at your option) any later version. <br>
030 * <br>
031 *          This library is distributed in the hope that it will be useful, but
032 *          WITHOUT ANY WARRANTY; without even the implied warranty of
033 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
034 *          Lesser General Public License for more details. <br>
035 * <br>
036 *          You should have received a copy of the GNU Lesser General Public
037 *          License along with this library; if not see
038 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
039 */
040public class ImportantStudentHardConflict extends ImportantStudentConflict {
041
042    @Override
043    public boolean isApplicable(Lecture l1, Lecture l2) {
044        return l1 != null && l2 != null && !ignore(l1, l2) && hard(l1, l2) && important(l1, l2);
045    }
046    
047    @Override
048    public boolean isApplicable(Student student, Lecture l1, Lecture l2) {
049        return l1 != null && l2 != null && !ignore(l1, l2) && hard(l1, l2) && student.getConflictingPriorty(l1, l2) != null;
050    }
051
052    @Override
053    public double getWeightDefault(DataProperties config) {
054        return config.getPropertyDouble("Comparator.ImportantHardStudentConflictWeight",
055                3.0 * config.getPropertyDouble("Comparator.HardStudentConflictWeight", 5.0));
056    }
057    
058    @Override
059    public String getPlacementSelectionWeightName() {
060        return "Placement.NrImportantHardStudConfsWeight";
061    }
062    
063    @Override
064    public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info) {
065    }
066    
067    @Override
068    public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info, Collection<Lecture> variables) {
069    }
070}