Record Class ConstraintAnalysis<Score_ extends Score<Score_>>

java.lang.Object
java.lang.Record
ai.timefold.solver.core.api.score.analysis.ConstraintAnalysis<Score_>
Type Parameters:
Score_ -
Record Components:
matches - null if analysis not available; empty if constraint has no matches, but still non-zero constraint weight; non-empty if constraint has matches. This is a List to simplify access to individual elements, but it contains no duplicates just like HashSet wouldn't.
matchCount -
  • For regular constraint analysis: -1 if analysis not available, 0 if constraint has no matches, positive if constraint has matches. Equal to the size of the matches list.
  • For a diff of constraint analyses: positive if the constraint has more matches in the new analysis, zero if the number of matches is the same in both, negative otherwise. Need not be equal to the size of the matches list.

public record ConstraintAnalysis<Score_ extends Score<Score_>>(@NonNull ConstraintRef constraintRef, @NonNull Score_ extends Score<Score_> weight, @NonNull Score_ extends Score<Score_> score, @Nullable List<MatchAnalysis<Score_ extends Score<Score_>>> matches, int matchCount) extends Record
Note: Users should never create instances of this type directly. It is available transitively via SolutionManager.analyze(Object).
  • Constructor Details

    • ConstraintAnalysis

      public ConstraintAnalysis(@NonNull ConstraintRef constraintRef, @NonNull Score_ weight, @NonNull Score_ score, @Nullable List<MatchAnalysis<Score_>> matches)
    • ConstraintAnalysis

      public ConstraintAnalysis(@NonNull ConstraintRef constraintRef, @NonNull Score_ weight, @NonNull Score_ score, @Nullable List<MatchAnalysis<Score_>> matches, int matchCount)
      Creates an instance of a ConstraintAnalysis record class.
      Parameters:
      constraintRef - the value for the constraintRef record component
      weight - the value for the weight record component
      score - the value for the score record component
      matches - the value for the matches record component
      matchCount - the value for the matchCount record component
  • Method Details

    • constraintPackage

      @Deprecated(forRemoval=true, since="1.13.0") public String constraintPackage()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Do not rely on constraint package in user code.
      Return package name of the constraint that this analysis is for.
      Returns:
      equal to constraintRef.packageName()
    • constraintName

      public @NonNull String constraintName()
      Return name of the constraint that this analysis is for.
      Returns:
      equal to constraintRef.constraintName()
    • summarize

      public @NonNull String summarize()
      Returns a diagnostic text that explains part of the score quality through the ConstraintAnalysis API. The string is built fresh every time the method is called.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • constraintRef

      public @NonNull ConstraintRef constraintRef()
      Returns the value of the constraintRef record component.
      Returns:
      the value of the constraintRef record component
    • weight

      public @NonNull Score_ weight()
      Returns the value of the weight record component.
      Returns:
      the value of the weight record component
    • score

      public @NonNull Score_ score()
      Returns the value of the score record component.
      Returns:
      the value of the score record component
    • matches

      public @Nullable List<MatchAnalysis<Score_>> matches()
      Returns the value of the matches record component.
      Returns:
      the value of the matches record component
    • matchCount

      public int matchCount()
      Returns the value of the matchCount record component.
      Returns:
      the value of the matchCount record component