Package jline.lang.reward
Class RewardDescriptor
java.lang.Object
jline.lang.reward.RewardDescriptor
- All Implemented Interfaces:
Serializable,RewardFunction
A
RewardFunction that also records what the reward measures.
A RewardDescriptor delegates evaluation to the wrapped reward function, so it can be
passed to Network.setReward exactly like a plain lambda, while additionally
exposing the structural description (getKind(), getNode(),
getJobClass()) that allows the reward to be serialized declaratively.
A descriptor of kind RewardDescriptor.Kind.Custom wraps an arbitrary user function and is
deliberately NOT serializable: the writer warns and omits it rather than emitting a
reward it cannot reproduce on reload.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRewardDescriptor(RewardDescriptor.Kind kind, Node node, JobClass jobClass, RewardFunction delegate) Creates a reward descriptor. -
Method Summary
-
Constructor Details
-
RewardDescriptor
public RewardDescriptor(RewardDescriptor.Kind kind, Node node, JobClass jobClass, RewardFunction delegate) Creates a reward descriptor.- Parameters:
kind- structural kind of the rewardnode- node the reward refers to, or null when not node-scopedjobClass- job class the reward refers to, or null when not class-scopeddelegate- the reward function actually evaluated
-
-
Method Details
-
compute
Description copied from interface:RewardFunctionCompute the reward value for a given state.- Specified by:
computein interfaceRewardFunction- Parameters:
state- The state vector (row from stateSpaceAggr matrix) Format: [n_{1,1}, n_{1,2}, ..., n_{M,K}] where n_{i,k} is the number of class-k jobs at station isn- The NetworkStruct providing access to rates, parameters, etc.- Returns:
- The reward value for this state
-
getKind
- Returns:
- the structural kind of this reward
-
getNode
- Returns:
- the node this reward refers to, or null when not node-scoped
-
getJobClass
- Returns:
- the job class this reward refers to, or null when not class-scoped
-
getDelegate
- Returns:
- the wrapped reward function
-
toString
-