org.cpsolver.ifs.extension

## Class AssignedValue<T extends Value<?,T>>

- java.lang.Object
- - org.cpsolver.ifs.extension.AssignedValue<T>

- Type Parameters:
    `T` - Value

      public class AssignedValue<T extends Value<?,T>>
      extends Object

  This class describing an assignment of a value to a variable together with a counter (used by CBS). Counter also supports aging: the counter is multiplied by aging factor for each iteration.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2006 - 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/.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AssignedValue.AssignmentComparator<E extends Value<?,E>>` Assignment comparator

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssignedValue(long iteration, T value, double aging)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `combine(int a, int b)` Combine two integers (for hash code)
    `int` | `compareTo(long iteration, AssignedValue<T> a)` Compare two assignments (their counters)
    `boolean` | `equals(Object o)`
    `Constraint<?,T>` | `getConstraint()` Returns constraint
    `double` | `getCounter(long iteration)` Get counter
    `T` | `getValue()` Returns value
    `int` | `hashCode()`
    `void` | `incCounter(long iteration)` Increments counter
    `void` | `revise(long iteration)` Revise counter.
    `void` | `setConstraint(Constraint<?,T> constraint)` Sets constraint
    `void` | `setCounter(double cnt)` Set counter
    `String` | `toString()` String representation
    `String` | `toString(long iteration, boolean assignment)` String representation (e.g., 10x A := a)

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AssignedValue

          public AssignedValue(long iteration,
                               T value,
                               double aging)

      Constructor
      Parameters:
        `iteration` - current iteration
        `value` - value
        `aging` - aging factor

  - ### Method Detail

    - #### getValue

          public T getValue()

      Returns value
      Returns:
        value

    - #### incCounter

          public void incCounter(long iteration)

      Increments counter
      Parameters:
        `iteration` - current iteration

    - #### setCounter

          public void setCounter(double cnt)

      Set counter
      Parameters:
        `cnt` - new value

    - #### getCounter

          public double getCounter(long iteration)

      Get counter
      Parameters:
        `iteration` - current iteration
      Returns:
        counter

    - #### getConstraint

          public Constraint<?,T> getConstraint()

      Returns constraint
      Returns:
        constraint

    - #### setConstraint

          public void setConstraint(Constraint<?,T> constraint)

      Sets constraint
      Parameters:
        `constraint` - a constraint

    - #### revise

          public void revise(long iteration)

      Revise counter. If aging is used, counter is adopted to the current iteration: it is multiplied by aging factor powered by the number of iterations since last revision.
      Parameters:
        `iteration` - current iteration

    - #### combine

          public static int combine(int a,
                                    int b)

      Combine two integers (for hash code)
      Parameters:
        `a` - first integer
        `b` - second integer
      Returns:
        combined hash code

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      String representation
      Overrides:
        `toString` in class `Object`

    - #### toString

          public String toString(long iteration,
                                 boolean assignment)

      String representation (e.g., 10x A := a)
      Parameters:
        `iteration` - current iteration
        `assignment` - true if assignment
      Returns:
        string representation of the assignment

    - #### compareTo

          public int compareTo(long iteration,
                               AssignedValue<T> a)

      Compare two assignments (their counters)
      Parameters:
        `iteration` - current iteration
        `a` - another assignment
      Returns:
        comparison