Cost

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Cost(val name: String = "")

Annotates a method that computes the dynamic cost or value of an action at planning time. Similar to @Condition, this method can take domain object parameters from the blackboard. Unlike @Condition, all domain object parameters must be nullable. If a parameter is not available on the blackboard, null will be passed.

The method can also take a Blackboard parameter for direct access to all available objects.

The method must return a Double between 0.0 and 1.0.

Example:

@Cost(name = "processingCost")
public double computeProcessingCost(@Nullable LargeDataSet largeData) {
return largeData != null ? 0.9 : 0.1;
}

@Action(costMethod = "processingCost")
public DataOutput processData(DataInput input) { ... }

Parameters

name

Name of the cost method. Referenced by @Action.costMethod or @Action.valueMethod. If not provided, the name will be the method name.

Properties

Link copied to clipboard