org.drools.planner.api.domain.variable
Annotation Type PlanningVariable


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

Specifies that a bean property should be optimized by Drools Planner.

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


Optional Element Summary
 boolean chained
          In some use cases, such as Vehicle Routing, planning entities are chained.
 Class<? extends PlanningVariableListener>[] listenerClasses
          Deprecated. 
 Class<? extends Comparator> strengthComparatorClass
          Allows a collection of planning values for this variable to be sorted by strength.
 Class<? extends PlanningValueStrengthWeightFactory> strengthWeightFactoryClass
          Allows a collection of planning values for this variable to be sorted by strength.
 

strengthComparatorClass

public abstract Class<? extends Comparator> strengthComparatorClass
Allows a collection of planning values for this variable to be sorted by strength.

Do not use together with strengthWeightFactoryClass().

Returns:
PlanningVariable.NullStrengthComparator when it is null (workaround for annotation limitation)
Default:
org.drools.planner.api.domain.variable.PlanningVariable.NullStrengthComparator.class

strengthWeightFactoryClass

public abstract Class<? extends PlanningValueStrengthWeightFactory> strengthWeightFactoryClass
Allows a collection of planning values for this variable to be sorted by strength.

Do not use together with strengthComparatorClass().

Returns:
PlanningVariable.NullStrengthWeightFactory when it is null (workaround for annotation limitation)
See Also:
PlanningValueStrengthWeightFactory
Default:
org.drools.planner.api.domain.variable.PlanningVariable.NullStrengthWeightFactory.class

chained

public abstract boolean chained
In some use cases, such as Vehicle Routing, planning entities are chained. A chained variable recursively points to a planning fact, which is called the anchor. So either it points directly to the anchor (that planning fact) or it points to another planning entity with the same planning variable (which recursively points to the anchor). Chains always have exactly 1 anchor, thus they never loop and the tail is always open. Chains never split into a tree: a anchor or planning entity has at most 1 trailing planning entity.

When a chained planning entity changes position, then chain correction must happen:

For example: Given A <- B <- C <- D <- X <- Y, when B moves between X and Y, pointing to X, then Y is also changed to point to B and C is also changed to point to A, giving the result A <- C <- D <- X <- B <- Y.

Returns:
true if changes to this variable need to trigger chain correction
Default:
false

listenerClasses

@Deprecated
public abstract Class<? extends PlanningVariableListener>[] listenerClasses
Deprecated. 

Default:
{}


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.