Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.1.0.CR1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

## org.optaplanner.core.api.domain.variable
Annotation Type PlanningVariable

    @Target(value=METHOD)
    @Retention(value=RUNTIME)
    public @interface PlanningVariable

Specifies that a bean property can be changed and should be optimized by the optimization algorithms.

It is specified on a getter of a java bean property of a `PlanningEntity` class.

Optional Element Summary
`PlanningVariableGraphType` | `graphType` In some use cases, such as Vehicle Routing, planning entities form a specific graph type, as specified by `PlanningVariableGraphType`.
`boolean` | `nullable` A nullable planning variable will automatically add the planning value null to the `ValueRangeProvider`'s range.
`Class<? extends SelectionFilter>` | `reinitializeVariableEntityFilter` Construction heuristics only change reinitializable planning variables.
`Class<? extends Comparator>` | `strengthComparatorClass` Allows a collection of planning values for this variable to be sorted by strength.
`Class<? extends SelectionSorterWeightFactory>` | `strengthWeightFactoryClass` The `SelectionSorterWeightFactory` alternative for `strengthComparatorClass()`.
`String[]` | `valueRangeProviderRefs` Any `ValueRangeProvider` annotation on a `PlanningSolution` or `PlanningEntity` will automatically be registered with it's `ValueRangeProvider.id()`.

### valueRangeProviderRefs

    public abstract String[] valueRangeProviderRefs

  Any `ValueRangeProvider` annotation on a `PlanningSolution` or `PlanningEntity` will automatically be registered with it's `ValueRangeProvider.id()`.

  There should be at least 1 valueRangeRef.

  Returns:
    1 (or more) registered `ValueRangeProvider.id()`
  Default:
    {}

### nullable

    public abstract boolean nullable

  A nullable planning variable will automatically add the planning value null to the `ValueRangeProvider`'s range.

  In repeated planning use cases, it's recommended to specify a `reinitializeVariableEntityFilter()` for every nullable planning variable too.

  `nullable()` true is not compatible with `PlanningVariableGraphType.CHAINED` true. `nullable()` true is not compatible with a primitive property type.

  Returns:
    true if null is a valid value for this planning variable
  Default:
    false

### reinitializeVariableEntityFilter

    public abstract Class<? extends SelectionFilter> reinitializeVariableEntityFilter

  Construction heuristics only change reinitializable planning variables. Non reinitializable planning variable is ignored by construction heuristics. This is especially useful in repeated planning use cases, in which starting from scratch would waste previous results and time.

  If no `reinitializeVariableEntityFilter()` is specified, the default considers an entity uninitialized for a variable if its value is null (even if `nullable()` is true).

  The method `SelectionFilter.accept(ScoreDirector, Object)` returns false if the selection entity should be reinitialized for this variable and it returns true if the selection entity should not be reinitialized for this variable

  Returns:
    `PlanningVariable.NullReinitializeVariableEntityFilter` when it is null (workaround for annotation limitation)
  Default:
    org.optaplanner.core.api.domain.variable.PlanningVariable.NullReinitializeVariableEntityFilter.class

### graphType

    public abstract PlanningVariableGraphType graphType

  In some use cases, such as Vehicle Routing, planning entities form a specific graph type, as specified by `PlanningVariableGraphType`.

  Returns:
    never null, defaults to `PlanningVariableGraphType.NONE`
  Default:
    org.optaplanner.core.api.domain.variable.PlanningVariableGraphType.NONE

### strengthComparatorClass

    public abstract Class<? extends Comparator> strengthComparatorClass

  Allows a collection of planning values for this variable to be sorted by strength. A strengthWeight estimates how strong a planning value is. Some algorithms benefit from planning on weaker planning values first or from focusing on them.

  The `Comparator` should sort in ascending strength. For example: sorting 3 computers on strength based on their RAM capacity: Computer B (1GB RAM), Computer A (2GB RAM), Computer C (7GB RAM),

  Do not use together with `strengthWeightFactoryClass()`.

  Returns:
    `PlanningVariable.NullStrengthComparator` when it is null (workaround for annotation limitation)
  See Also:
    `strengthWeightFactoryClass()`
  Default:
    org.optaplanner.core.api.domain.variable.PlanningVariable.NullStrengthComparator.class

### strengthWeightFactoryClass

    public abstract Class<? extends SelectionSorterWeightFactory> strengthWeightFactoryClass

  The `SelectionSorterWeightFactory` alternative for `strengthComparatorClass()`.

  Do not use together with `strengthComparatorClass()`.

  Returns:
    `PlanningVariable.NullStrengthWeightFactory` when it is null (workaround for annotation limitation)
  See Also:
    `strengthComparatorClass()`
  Default:
    org.optaplanner.core.api.domain.variable.PlanningVariable.NullStrengthWeightFactory.class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.1.0.CR1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

Copyright © 2006-2014 JBoss by Red Hat. All Rights Reserved.