org.cpsolver.ifs.assignment.context

## Interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>

- Type Parameters:
    `V` - Variable
    `T` - Value
    `C` - Assignment Context
  All Known Implementing Classes:
    AbstractClassWithContext, AbstractCriterion, AssignedValue, AssignmentCount, AttributePreferences, BackToBack, BackToBackInstructorPreferences, BinaryConstraintWithContext, BreakFlexibleConstraint, BrokenTimePatterns, Config, ConstraintWithContext, Course, CoursePreferences, CourseRequest, CourseReservation, CurriculumOverride, CurriculumReservation, DbtPropagation, DeltaTimePreference, DepartmentBalancingPenalty, DepartmentSpreadConstraint, DifferentLecture, DiscouragedRoomConstraint, DistanceConflict, DistanceToStronglyPreferredRoom, DistributionPenalty, DistributionPreferences, DistributionViolation, DummyReservation, ExamConstruction, ExamCriterion, ExamDistributionConstraint, ExamGreatDeluge, ExamHillClimbing, ExamModel, ExamNeighbourSelection, ExamRoom, ExamRotationPenalty, ExamSimulatedAnnealing, ExamSplitter, ExamTabuSearch, ExtensionWithContext, FixCompleteSolutionNeighbourSelection, FlexibleConstraint, FlexibleConstraintCriterion, FreeTimeRequest, GreatDeluge, GroupConstraint, GroupReservation, HardConflicts, HillClimber, IgnoredCommittedStudentConflict, IgnoredStudentConflict, ImportantStudentConflict, ImportantStudentHardConflict, IndividualReservation, Instructor, InstructorBackToBackConflicts, InstructorConflict, InstructorConstraint, InstructorDirectConflicts, InstructorDistanceBackToBackConflicts, InstructorFairness, InstructorLunchBreak, InstructorMoreThan2ADayConflicts, InstructorNotAvailableConflicts, InstructorPreferences, InstructorSchedulingCriterion, InstructorStudentConflict, InstructorStudentHardConflict, JenrlConstraint, LargeExamsPenalty, LearningCommunityReservation, Lecture, MacPropagation, MacRevised, MaxBlockFlexibleConstraint, MaxBreaksFlexibleConstraint, MaxDaysFlexibleConstraint, MaxHalfDaysFlexibleConstraint, MaxHolesFlexibleConstraint, MaxWeeksFlexibleConstraint, MetaHeuristicSearch, MinimizeNumberOfUsedGroupsOfTime, MinimizeNumberOfUsedRoomsConstraint, ModelWithContext, NeighbourSearch, NeighbourSelectionWithContext, OnlineConfig, OnlineReservation, OnlineSection, OnlineSectioningModel, OriginalInstructor, ParallelConstruction, PeriodIndexPenalty, PeriodPenalty, PeriodSizePenalty, PeriodViolation, PerturbationPenalty, Perturbations, PlacementSelectionCriterion, PotentialHardConflicts, QuadraticStudentConflict, QuadraticStudentHardConflict, Request, RequestGroup, Reservation, ReservationOverride, Resource, ResourceConstraint, RoomConstraint, RoomPenalty, RoomPerturbationPenalty, RoomPreferences, RoomSizePenalty, RoomSizePenalty, RoomSplitDistancePenalty, RoomSplitPenalty, RoomViolation, RoomViolations, SameCommon, SameCourse, SameDays, SameInstructor, SameInstructorConstraint, SameLink, SameLinkConstraint, SameRoom, SameSubpartBalancingPenalty, SearchIntensification, Section, SimpleSearch, SimulatedAnnealing, SoftInstructorConstraint, SpreadConstraint, StepCountingHillClimber, StudentBackToBackConflicts, StudentCommittedConflict, StudentConflict, StudentDirectConflicts, StudentDistanceBackToBackConflicts, StudentDistanceConflict, StudentHardConflict, StudentLuchBreak, StudentMinimizeDaysOfWeek, StudentMinimizeScheduleHoles, StudentMoreThan1ADayConflicts, StudentMoreThan2ADayConflicts, StudentNotAvailableConflicts, StudentOverlapConflict, StudentOverLunchConflict, StudentQuality, StudentSectioningModel, StudentWorkdayConflict, TeachingPreferences, Test.TestModel, TimeOverlaps, TimeOverlapsCounter, TimePreferences, TimePreferences, TimetablingCriterion, TimeViolations, TooBigRooms, UnusedInstructorLoad, UselessHalfHours, VariableWithContext, WeightedHardConflicts

      public interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>

  An interface to be implemented by a class that need an assignment context associated with it. I.e., for each existing assignment, there can be an instance of `AssignmentContext` available to the class.
  The idea is that each class that needs to keep some assignment dependent data will implements `HasAssignmentContext` interface and the data will be wrapped by this class. The `HasAssignmentContext` will only contain a reference to this assignment context, created by calling `Model.createReference(HasAssignmentContext)` during its initialization. The assignment context can be than accessed by calling `Assignment.getAssignmentContext(AssignmentContextReference)`.
  These assignment contexts are being held in memory by a class implementing the `AssignmentContextHolder` interface. For constraints, criteria, extensions, and neighborhood selections an existing class implementing the context can be used, see `ConstraintWithContext`, `AbstractCriterion`, `ExtensionWithContext`, and `NeighbourSelectionWithContext` respectively.
  For instance, when implementing `ConstraintWithContext`, only the method `createAssignmentContext(Assignment)` needs to be implemented and the assignment context can be accessed within the constraint using the method `ConstraintWithContext.getContext(Assignment)`.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses.
  See Also:
    `AssignmentContextHolder`, `HasAssignmentContext`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `C` | `createAssignmentContext(Assignment<V,T> assignment)` Create a new assignment context for the given assignment.
    `AssignmentContextReference<V,T,C>` | `getAssignmentContextReference()` Returns an assignment context reference
    `C` | `getContext(Assignment<V,T> assignment)` Returns an assignment context associated with this object.
    `void` | `setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)` Store an assignment context reference that was given for the class by the `Model.createReference(HasAssignmentContext)`.

- - ### Method Detail

    - #### createAssignmentContext

          C createAssignmentContext(Assignment<V,T> assignment)

      Create a new assignment context for the given assignment. If there are already some variables assigned in the value, the method should make sure that the context is appropriately initialized.
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
      Returns:
        a new instance of the assignment context, filled according to the given assignment

    - #### getAssignmentContextReference

          AssignmentContextReference<V,T,C> getAssignmentContextReference()

      Returns an assignment context reference
      Returns:
        reference provided by the model by calling `Model.createReference(HasAssignmentContext)` during initialization

    - #### setAssignmentContextReference

          void setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)

      Store an assignment context reference that was given for the class by the `Model.createReference(HasAssignmentContext)`.
      Parameters:
        `reference` - reference provided by the model by calling `Model.createReference(HasAssignmentContext)` during initialization

    - #### getContext

          C getContext(Assignment<V,T> assignment)

      Returns an assignment context associated with this object. If there is no assignment context associated with this object yet, one is created using the `createAssignmentContext(Assignment)` method.
      Parameters:
        `assignment` - given assignment
      Returns:
        assignment context associated with this object and the given assignment