it.unibo.alchemist.model.cognitive.PhysicalSteeringStrategy.kt Maven / Gradle / Ivy
Show all versions of alchemist-cognitive-agents Show documentation
/*
* Copyright (C) 2010-2023, Danilo Pianini and contributors
* listed, for each module, in the respective subproject's build.gradle.kts file.
*
* This file is part of Alchemist, and is distributed under the terms of the
* GNU General Public License, with a linking exception,
* as described in the file LICENSE in the Alchemist distribution's top directory.
*/
package it.unibo.alchemist.model.cognitive
import it.unibo.alchemist.model.Node
import it.unibo.alchemist.model.Position
import it.unibo.alchemist.model.geometry.GeometricShapeFactory
import it.unibo.alchemist.model.geometry.Transformation
import it.unibo.alchemist.model.geometry.Vector
/**
* Defines how physical forces and steering actions (which may be seen as intentional forces) are combined to compute
* the overall next position reached by a physical [node]. The combination of steering actions is delegated to a
* [nonPhysicalStrategy]. The resulting intentional force is then combined with the physical ones to determine the
* next position reached by [node].
*/
interface PhysicalSteeringStrategy : SteeringStrategy
where P : Position, P : Vector
,
A : Transformation
,
F : GeometricShapeFactory
{
/**
* The node to be moved.
*/
val node: Node
/**
* The combination of intentional forces (= steering actions) and [computeTarget] are delegated to this strategy.
*/
val nonPhysicalStrategy: SteeringStrategy
/**
* Computes the next relative position reached by the node, given the overall intentional force.
*/
fun computeNextPosition(overallIntentionalForce: P): P
/**
* Computes the next relative position reached by the node, taking into account both the intentional and the
* physical forces acting on [node] (intentional forces = [actions]).
*/
override fun computeNextPosition(actions: List>): P =
computeNextPosition(nonPhysicalStrategy.computeNextPosition(actions))
/**
* Delegated to [nonPhysicalStrategy].
*/
override fun computeTarget(actions: List>): P = nonPhysicalStrategy.computeTarget(actions)
}