Movable Agent Resource
An AgentResource whose position is tracked in a ContinuousProjection. Composes the agent-resource semantics (seizable, queueable, on-shift / off-shift, statechart, mailbox, optional AgentPerformance stats) with continuous-space position tracking. Spatial queries on the projection (space.within(p, r), space.neighborsOf(...)) automatically see this resource at its current position.
The agent-layer analog of ksl.modeling.spatial.MovableResource, but built on agent-layer primitives. Differences from the spatial-layer version:
Position lives in a
ContinuousProjection, not aSpatialModel. Spatial queries on the projection see this resource alongside any other agents.Movement uses the agent-layer travelTo primitive (or any other code that updates the projection's positions). No built-in
KSLProcess.transportWith(this)integration — for that path, use the spatial-layerMovableResourcedirectly (possibly with the Phase 4.1 bridge for shared coordinates).Velocity isn't a fixed property of the resource. Each travel specifies its own velocity, which is more flexible (allows loaded vs. empty velocities, fast vs. slow modes) at the cost of one extra parameter per call site.
Typical usage:
class Warehouse(parent: ModelElement) : AgentModel(parent, "warehouse") {
val world: Context<AgentLike> = Context("world")
val floor: ContinuousProjection<AgentLike> =
ContinuousProjection(world, 0.0..100.0, 0.0..100.0)
val forklift: MovableAgentResource = MovableAgentResource(
this, floor, initPosition = Point2D(50.0, 50.0), name = "forklift-1",
)
inner class TaskRunner : Agent("runner") {
val script: KSLProcess = process(isDefaultProcess = true) {
val allocation = seize(forklift)
travelTo(forklift, floor, Point2D(80.0, 20.0), velocity = 2.5)
delay(2.0) // load
travelTo(forklift, floor, Point2D(10.0, 90.0), velocity = 2.5)
delay(2.0) // unload
release(allocation)
}
}
}Lifecycle: a MovableAgentResource is a ResourceWithQ (via AgentResource), so it's a ModelElement and must be constructed before simulate(). It joins its projection's context automatically at construction and is placed at initPosition.
Constraints on type variance: the projection is typed as ContinuousProjection<AgentLike> so the same projection can hold both Agents and MovableAgentResources (and any other AgentLike types). Models that need a more specific projection type can either keep separate projections per type or upcast this resource to AgentLike at the call site.
Parameters
the enclosing AgentModel; required as AgentResource needs an AgentModel parent for its mailbox.
the projection that tracks this resource's position. Must hold AgentLike (or compatible) members.
starting position in the projection.
optional name; defaults to MovableAgentResource_<id>.
initial resource capacity (default 1).
optional shared request queue.
Constructors
Types
Mutable global defaults for MovableAgentResource construction.