001package org.cpsolver.ifs.assignment.context;
002
003import org.cpsolver.ifs.assignment.Assignment;
004import org.cpsolver.ifs.criteria.AbstractCriterion;
005import org.cpsolver.ifs.model.Model;
006
007/**
008 * An interface marking an assignment context. The idea is that each
009 * class that needs to keep some assignment dependent data will implements
010 * {@link HasAssignmentContext} interface and the data will be wrapped by this class.
011 * The {@link HasAssignmentContext} will only contain a reference to this
012 * assignment context, created by calling {@link Model#createReference(HasAssignmentContext)}
013 * during its initialization. The assignment context can be than accessed by calling
014 * {@link Assignment#getAssignmentContext(AssignmentContextReference)}.<br><br>
015 * 
016 * These assignment contexts are being held in memory by a class implementing the
017 * {@link AssignmentContextHolder} interface. For constraints, criteria, extensions, and 
018 * neighborhood selections an existing class implementing the context can be used, see
019 * {@link ConstraintWithContext}, {@link AbstractCriterion}, {@link ExtensionWithContext},
020 * and {@link NeighbourSelectionWithContext} respectively.<br><br>
021 * 
022 * For instance, when implementing {@link ConstraintWithContext}, only the method
023 * {@link ConstraintWithContext#createAssignmentContext(Assignment)} needs to be implemented and the 
024 * assignment context can be accessed within the constraint using the method
025 * {@link ConstraintWithContext#getContext(Assignment)}.
026 * 
027 * @see AssignmentContextHolder
028 * @see HasAssignmentContext
029 * 
030 * @author  Tomáš Müller
031 * @version IFS 1.3 (Iterative Forward Search)<br>
032 *          Copyright (C) 2014 Tomáš Müller<br>
033 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
034 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
035 * <br>
036 *          This library is free software; you can redistribute it and/or modify
037 *          it under the terms of the GNU Lesser General Public License as
038 *          published by the Free Software Foundation; either version 3 of the
039 *          License, or (at your option) any later version. <br>
040 * <br>
041 *          This library is distributed in the hope that it will be useful, but
042 *          WITHOUT ANY WARRANTY; without even the implied warranty of
043 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
044 *          Lesser General Public License for more details. <br>
045 * <br>
046 *          You should have received a copy of the GNU Lesser General Public
047 *          License along with this library; if not see <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>.
048 **/
049public interface AssignmentContext {
050
051}