Package org.optaplanner.core.impl.domain.solution.descriptor

## Class SolutionDescriptor<Solution_>

- java.lang.Object
- - org.optaplanner.core.impl.domain.solution.descriptor.SolutionDescriptor<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation

      public class SolutionDescriptor<Solution_>
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected org.slf4j.Logger` | `logger` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SolutionDescriptor​(Class<Solution_> solutionClass)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addEntityDescriptor​(EntityDescriptor<Solution_> entityDescriptor)` |
    `ScoreDefinition` | `buildScoreDefinition​(Class<? extends Score> scoreType, PlanningScore annotation)` |
    `static <Solution_> SolutionDescriptor<Solution_>` | `buildSolutionDescriptor​(Class<Solution_> solutionClass, Class<?>... entityClasses)` |
    `static <Solution_> SolutionDescriptor<Solution_>` | `buildSolutionDescriptor​(Class<Solution_> solutionClass, List<Class<?>> entityClassList)` |
    `static <Solution_> SolutionDescriptor<Solution_>` | `buildSolutionDescriptor​(DomainAccessType domainAccessType, Class<Solution_> solutionClass, Class<?>... entityClasses)` |
    `static <Solution_> SolutionDescriptor<Solution_>` | `buildSolutionDescriptor​(DomainAccessType domainAccessType, Class<Solution_> solutionClass, List<Class<?>> entityClassList)` |
    `void` | `checkIfProblemFactsExist()` | Only called if Drools score calculation is used.
    `int` | `countUninitializedVariables​(Solution_ solution)` |
    `Iterator<Object>` | `extractAllEntitiesIterator​(Solution_ solution)` |
    `Stream<Object>` | `extractAllEntitiesStream​(Solution_ solution)` |
    `Class<? extends Score<?>>` | `extractScoreClass()` |
    `EntityDescriptor<Solution_>` | `findEntityDescriptor​(Class<?> entitySubclass)` |
    `EntityDescriptor<Solution_>` | `findEntityDescriptorOrFail​(Class<?> entitySubclass)` |
    `GenuineVariableDescriptor<Solution_>` | `findGenuineVariableDescriptor​(Object entity, String variableName)` |
    `GenuineVariableDescriptor<Solution_>` | `findGenuineVariableDescriptorOrFail​(Object entity, String variableName)` |
    `VariableDescriptor<Solution_>` | `findVariableDescriptor​(Object entity, String variableName)` |
    `VariableDescriptor<Solution_>` | `findVariableDescriptorOrFail​(Object entity, String variableName)` |
    `Collection<Object>` | `getAllFacts​(Solution_ solution)` |
    `ConstraintConfigurationDescriptor<Solution_>` | `getConstraintConfigurationDescriptor()` |
    `MemberAccessor` | `getConstraintConfigurationMemberAccessor()` |
    `DomainAccessType` | `getDomainAccessType()` |
    `Set<Class<?>>` | `getEntityClassSet()` |
    `Map<String,​MemberAccessor>` | `getEntityCollectionMemberAccessorMap()` |
    `int` | `getEntityCount​(Solution_ solution)` |
    `Collection<EntityDescriptor<Solution_>>` | `getEntityDescriptors()` |
    `EntityDescriptor<Solution_>` | `getEntityDescriptorStrict​(Class<?> entityClass)` |
    `List<Object>` | `getEntityList​(Solution_ solution)` |
    `List<Object>` | `getEntityListByEntityClass​(Solution_ solution, Class<?> entityClass)` |
    `Map<String,​MemberAccessor>` | `getEntityMemberAccessorMap()` |
    `List<String>` | `getEntityMemberAndEntityCollectionMemberNames()` |
    `Collection<EntityDescriptor<Solution_>>` | `getGenuineEntityDescriptors()` |
    `long` | `getGenuineVariableCount​(Solution_ solution)` |
    `LookUpStrategyResolver` | `getLookUpStrategyResolver()` |
    `long` | `getMaximumValueCount​(Solution_ solution)` |
    `int` | `getMovableEntityCount​(ScoreDirector<Solution_> scoreDirector)` |
    `Map<String,​MemberAccessor>` | `getProblemFactCollectionMemberAccessorMap()` |
    `Map<String,​MemberAccessor>` | `getProblemFactMemberAccessorMap()` |
    `List<String>` | `getProblemFactMemberAndProblemFactCollectionMemberNames()` |
    `Set<Class<?>>` | `getProblemFactOrEntityClassSet()` |
    `long` | `getProblemScale​(Solution_ solution)` | Calculates an indication on how big this problem instance is.
    `Score` | `getScore​(Solution_ solution)` |
    `ScoreDefinition` | `getScoreDefinition()` |
    `Class<Solution_>` | `getSolutionClass()` |
    `SolutionCloner<Solution_>` | `getSolutionCloner()` |
    `int` | `getValueCount​(Solution_ solution)` |
    `boolean` | `hasEntityDescriptor​(Class<?> entitySubclass)` |
    `boolean` | `hasEntityDescriptorStrict​(Class<?> entityClass)` |
    `void` | `processAnnotations​(DescriptorPolicy descriptorPolicy, List<Class<?>> entityClassList)` |
    `void` | `setDomainAccessType​(DomainAccessType domainAccessType)` |
    `void` | `setScore​(Solution_ solution, Score score)` | Called when the `Score` has been calculated or predicted.
    `String` | `toString()` |
    `void` | `validateConstraintWeight​(String constraintPackage, String constraintName, Score<?> constraintWeight)` |

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

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

- - ### Field Detail

    - #### logger

          protected final transient org.slf4j.Logger logger

  - ### Constructor Detail

    - #### SolutionDescriptor

          public SolutionDescriptor​(Class<Solution_> solutionClass)

  - ### Method Detail

    - #### buildSolutionDescriptor

          public static <Solution_> SolutionDescriptor<Solution_> buildSolutionDescriptor​(Class<Solution_> solutionClass,
                                                                                          Class<?>... entityClasses)

    - #### buildSolutionDescriptor

          public static <Solution_> SolutionDescriptor<Solution_> buildSolutionDescriptor​(DomainAccessType domainAccessType,
                                                                                          Class<Solution_> solutionClass,
                                                                                          Class<?>... entityClasses)

    - #### buildSolutionDescriptor

          public static <Solution_> SolutionDescriptor<Solution_> buildSolutionDescriptor​(Class<Solution_> solutionClass,
                                                                                          List<Class<?>> entityClassList)

    - #### buildSolutionDescriptor

          public static <Solution_> SolutionDescriptor<Solution_> buildSolutionDescriptor​(DomainAccessType domainAccessType,
                                                                                          Class<Solution_> solutionClass,
                                                                                          List<Class<?>> entityClassList)

    - #### getDomainAccessType

          public DomainAccessType getDomainAccessType()

    - #### setDomainAccessType

          public void setDomainAccessType​(DomainAccessType domainAccessType)

    - #### addEntityDescriptor

          public void addEntityDescriptor​(EntityDescriptor<Solution_> entityDescriptor)

    - #### processAnnotations

          public void processAnnotations​(DescriptorPolicy descriptorPolicy,
                                         List<Class<?>> entityClassList)

    - #### checkIfProblemFactsExist

          public void checkIfProblemFactsExist()

      Only called if Drools score calculation is used.

    - #### buildScoreDefinition

          public ScoreDefinition buildScoreDefinition​(Class<? extends Score> scoreType,
                                                      PlanningScore annotation)

    - #### getSolutionClass

          public Class<Solution_> getSolutionClass()

    - #### extractScoreClass

          public Class<? extends Score<?>> extractScoreClass()

      Returns:
        the `Class` of `PlanningScore`

    - #### getScoreDefinition

          public ScoreDefinition getScoreDefinition()

    - #### getSolutionCloner

          public SolutionCloner<Solution_> getSolutionCloner()

    - #### getProblemFactMemberAccessorMap

          public Map<String,​MemberAccessor> getProblemFactMemberAccessorMap()

    - #### getProblemFactCollectionMemberAccessorMap

          public Map<String,​MemberAccessor> getProblemFactCollectionMemberAccessorMap()

    - #### getProblemFactMemberAndProblemFactCollectionMemberNames

          public List<String> getProblemFactMemberAndProblemFactCollectionMemberNames()

    - #### getEntityMemberAccessorMap

          public Map<String,​MemberAccessor> getEntityMemberAccessorMap()

    - #### getEntityCollectionMemberAccessorMap

          public Map<String,​MemberAccessor> getEntityCollectionMemberAccessorMap()

    - #### getEntityMemberAndEntityCollectionMemberNames

          public List<String> getEntityMemberAndEntityCollectionMemberNames()

    - #### getProblemFactOrEntityClassSet

          public Set<Class<?>> getProblemFactOrEntityClassSet()

    - #### getConstraintConfigurationMemberAccessor

          public MemberAccessor getConstraintConfigurationMemberAccessor()

    - #### getConstraintConfigurationDescriptor

          public ConstraintConfigurationDescriptor<Solution_> getConstraintConfigurationDescriptor()

      Returns:
        sometimes null

    - #### getEntityClassSet

          public Set<Class<?>> getEntityClassSet()

    - #### getEntityDescriptors

          public Collection<EntityDescriptor<Solution_>> getEntityDescriptors()

    - #### getGenuineEntityDescriptors

          public Collection<EntityDescriptor<Solution_>> getGenuineEntityDescriptors()

    - #### hasEntityDescriptorStrict

          public boolean hasEntityDescriptorStrict​(Class<?> entityClass)

    - #### getEntityDescriptorStrict

          public EntityDescriptor<Solution_> getEntityDescriptorStrict​(Class<?> entityClass)

    - #### hasEntityDescriptor

          public boolean hasEntityDescriptor​(Class<?> entitySubclass)

    - #### findEntityDescriptorOrFail

          public EntityDescriptor<Solution_> findEntityDescriptorOrFail​(Class<?> entitySubclass)

    - #### findEntityDescriptor

          public EntityDescriptor<Solution_> findEntityDescriptor​(Class<?> entitySubclass)

    - #### findGenuineVariableDescriptor

          public GenuineVariableDescriptor<Solution_> findGenuineVariableDescriptor​(Object entity,
                                                                                    String variableName)

    - #### findGenuineVariableDescriptorOrFail

          public GenuineVariableDescriptor<Solution_> findGenuineVariableDescriptorOrFail​(Object entity,
                                                                                          String variableName)

    - #### findVariableDescriptor

          public VariableDescriptor<Solution_> findVariableDescriptor​(Object entity,
                                                                      String variableName)

    - #### findVariableDescriptorOrFail

          public VariableDescriptor<Solution_> findVariableDescriptorOrFail​(Object entity,
                                                                            String variableName)

    - #### getLookUpStrategyResolver

          public LookUpStrategyResolver getLookUpStrategyResolver()

    - #### validateConstraintWeight

          public void validateConstraintWeight​(String constraintPackage,
                                               String constraintName,
                                               Score<?> constraintWeight)

    - #### getAllFacts

          public Collection<Object> getAllFacts​(Solution_ solution)

    - #### getEntityCount

          public int getEntityCount​(Solution_ solution)

      Parameters:
        `solution` - never null
      Returns:
        `>= 0`

    - #### getEntityList

          public List<Object> getEntityList​(Solution_ solution)

    - #### getEntityListByEntityClass

          public List<Object> getEntityListByEntityClass​(Solution_ solution,
                                                         Class<?> entityClass)

    - #### getMovableEntityCount

          public int getMovableEntityCount​(ScoreDirector<Solution_> scoreDirector)

      Parameters:
        `scoreDirector` - never null
      Returns:
        `>= 0`

    - #### getGenuineVariableCount

          public long getGenuineVariableCount​(Solution_ solution)

      Parameters:
        `solution` - never null
      Returns:
        `>= 0`

    - #### getMaximumValueCount

          public long getMaximumValueCount​(Solution_ solution)

    - #### getValueCount

          public int getValueCount​(Solution_ solution)

      Parameters:
        `solution` - never null
      Returns:
        `>= 0`

    - #### getProblemScale

          public long getProblemScale​(Solution_ solution)

      Calculates an indication on how big this problem instance is. This is intentionally very loosely defined for now.
      Parameters:
        `solution` - never null
      Returns:
        `>= 0`

    - #### countUninitializedVariables

          public int countUninitializedVariables​(Solution_ solution)

    - #### extractAllEntitiesIterator

          public Iterator<Object> extractAllEntitiesIterator​(Solution_ solution)

    - #### extractAllEntitiesStream

          public Stream<Object> extractAllEntitiesStream​(Solution_ solution)

    - #### getScore

          public Score getScore​(Solution_ solution)

      Parameters:
        `solution` - never null
      Returns:
        sometimes null, if the `Score` hasn't been calculated yet

    - #### setScore

          public void setScore​(Solution_ solution,
                               Score score)

      Called when the `Score` has been calculated or predicted.
      Parameters:
        `solution` - never null
        `score` - sometimes null, in rare occasions to indicate that the old `Score` is stale, but no new ones has been calculated

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`