001package org.cpsolver.coursett.criteria.placement;
002
003import java.util.Set;
004
005import org.cpsolver.coursett.model.Lecture;
006import org.cpsolver.coursett.model.Placement;
007import org.cpsolver.ifs.assignment.Assignment;
008
009
010/**
011 * Use conflict-based statistics to compute potential hard conflicts.
012 * <br>
013 * 
014 * @version CourseTT 1.3 (University Course Timetabling)<br>
015 *          Copyright (C) 2006 - 2014 Tomáš Müller<br>
016 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
017 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
018 * <br>
019 *          This library is free software; you can redistribute it and/or modify
020 *          it under the terms of the GNU Lesser General Public License as
021 *          published by the Free Software Foundation; either version 3 of the
022 *          License, or (at your option) any later version. <br>
023 * <br>
024 *          This library is distributed in the hope that it will be useful, but
025 *          WITHOUT ANY WARRANTY; without even the implied warranty of
026 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
027 *          Lesser General Public License for more details. <br>
028 * <br>
029 *          You should have received a copy of the GNU Lesser General Public
030 *          License along with this library; if not see
031 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
032 */
033public class PotentialHardConflicts extends WeightedHardConflicts {
034    
035    @Override
036    public String getPlacementSelectionWeightName() {
037        return "Placement.NrPotentialConflictsWeight";
038    }
039
040    @Override
041    public double getValue(Assignment<Lecture, Placement> assignment, Placement value, Set<Placement> conflicts) {
042        if (iStat != null && conflicts != null && !conflicts.isEmpty()) {
043            return iStat.countPotentialConflicts(assignment, ((IterationContext)getContext(assignment)).getIteration(), value, 3);
044        } else {
045            return 0.0;
046        }
047    }
048    
049    @Override
050    public double getPlacementSelectionWeightDefault(int level) {
051        return 0.0;
052    }
053
054}