T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class SoftRoleSlotAssignmentStrategy<T extends com.badlogic.gdx.math.Vector<T>> extends BoundedSlotAssignmentStrategy<T>
SoftRoleSlotAssignmentStrategy is a concrete implementation of BoundedSlotAssignmentStrategy that supports soft
roles, i.e. roles that can be broken. Rather than a member having a list of roles it can fulfill, it has a set of values
representing how difficult it would find it to fulfill every role. The value is known as the slot cost. To make a slot
impossible for a member to fill, its slot cost should be infinite (you can even set a threshold to ignore all slots whose cost
is too high; this will reduce computation time when several costs are exceeding). To make a slot ideal for a member, its slot
cost should be zero. We can have different levels of unsuitable assignment for one member.
Slot costs do not necessarily have to depend only on the member and the slot roles. They can be generalized to include any difficulty a member might have in taking up a slot. If a formation is spread out, for example, a member may choose a slot that is close by over a more distant slot. Distance can be directly used as a slot cost.
IMPORTANT NOTES:
| Modifier and Type | Class and Description |
|---|---|
static interface |
SoftRoleSlotAssignmentStrategy.SlotCostProvider<T extends com.badlogic.gdx.math.Vector<T>> |
| Modifier and Type | Field and Description |
|---|---|
protected float |
costThreshold |
protected SoftRoleSlotAssignmentStrategy.SlotCostProvider<T> |
slotCostProvider |
| Constructor and Description |
|---|
SoftRoleSlotAssignmentStrategy(SoftRoleSlotAssignmentStrategy.SlotCostProvider<T> slotCostProvider)
Creates a
SoftRoleSlotAssignmentStrategy with the given slot cost provider and no cost threshold. |
SoftRoleSlotAssignmentStrategy(SoftRoleSlotAssignmentStrategy.SlotCostProvider<T> slotCostProvider,
float costThreshold)
Creates a
SoftRoleSlotAssignmentStrategy with the given slot cost provider and cost threshold. |
| Modifier and Type | Method and Description |
|---|---|
void |
updateSlotAssignments(com.badlogic.gdx.utils.Array<SlotAssignment<T>> assignments)
Updates the assignment of members to slots
|
calculateNumberOfSlots, removeSlotAssignmentprotected SoftRoleSlotAssignmentStrategy.SlotCostProvider<T extends com.badlogic.gdx.math.Vector<T>> slotCostProvider
protected float costThreshold
public SoftRoleSlotAssignmentStrategy(SoftRoleSlotAssignmentStrategy.SlotCostProvider<T> slotCostProvider)
SoftRoleSlotAssignmentStrategy with the given slot cost provider and no cost threshold.slotCostProvider - the slot cost providerpublic SoftRoleSlotAssignmentStrategy(SoftRoleSlotAssignmentStrategy.SlotCostProvider<T> slotCostProvider, float costThreshold)
SoftRoleSlotAssignmentStrategy with the given slot cost provider and cost threshold.slotCostProvider - the slot cost providercostThreshold - is a slot-cost limit, beyond which a slot is considered to be too expensive to consider occupying.public void updateSlotAssignments(com.badlogic.gdx.utils.Array<SlotAssignment<T>> assignments)
SlotAssignmentStrategyupdateSlotAssignments in interface SlotAssignmentStrategy<T extends com.badlogic.gdx.math.Vector<T>>updateSlotAssignments in class BoundedSlotAssignmentStrategy<T extends com.badlogic.gdx.math.Vector<T>>