All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.unibo.alchemist.model.cognitive.HeterogeneousPedestrianModel.kt Maven / Gradle / Ivy

There is a newer version: 35.0.0
Show newest version
/*
 * 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.cognitive.impact.individual.Age
import it.unibo.alchemist.model.cognitive.impact.individual.Compliance
import it.unibo.alchemist.model.cognitive.impact.individual.Gender
import it.unibo.alchemist.model.cognitive.impact.individual.HelpAttitude
import it.unibo.alchemist.model.cognitive.impact.individual.Speed
import it.unibo.alchemist.model.geometry.Transformation
import it.unibo.alchemist.model.geometry.Vector

/**
 * A pedestrian with individual characteristics.
 */
data class HeterogeneousPedestrianModel, A : Transformation>(
    /**
     * The age of this pedestrian.
     */
    val age: Age,
    /**
     * The gender of this pedestrian.
     */
    val gender: Gender,
    /**
     * The speed of an agent considering its age, gender and a random factor.
     */
    val speed: Speed,
    /**
     * Value between 0 and 1 representing the attitude towards conforming to social rules of this pedestrian.
     */
    val compliance: Double = Compliance(age, gender).level,
    /**
     * The attitude of an agent towards helping another agent.
     */
    val helpAttitude: HelpAttitude = HelpAttitude(age, gender),
) {
    /**
     * Value between 0 and 1 representing the probability this pedestrian will help another pedestrian in difficulty.
     *
     * @param toHelp The pedestrian who needs help.
     */
    fun probabilityOfHelping(toHelp: HeterogeneousPedestrianModel, isGroupMember: Boolean): Double =
        helpAttitude.level(toHelp.age, toHelp.gender, isGroupMember)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy