Packages

  • package root

    For detailed documentation on using the framework please see the README.md file at the Github repository at https://github.com/markblokpoel/lanag-core.

    Language Agents Simulation framework

    For detailed documentation on using the framework please see the README.md file at the Github repository at https://github.com/markblokpoel/lanag-core.

    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package markblokpoel
    Definition Classes
    com
  • package lanag
    Definition Classes
    markblokpoel
  • package core

    Provides classes, objects and traits that specify the com.markblokpoel.lanag.core architecture of the simulation framework.

    Provides classes, objects and traits that specify the com.markblokpoel.lanag.core architecture of the simulation framework.

    Overview

    Most of the classes, objects and traits in this packages cannot be used on their own. Instead, they specify what minimally should be implemented in any Lanag agent-based simulation.

    Definition Classes
    lanag
    See also

    For an example implementation, see the source code of project ambiguity helps.

  • package jupyterdisplayers

    This package contains a collection of Displayer classes for nice html formatted output in Jupyter notebooks.

    This package contains a collection of Displayer classes for nice html formatted output in Jupyter notebooks.

    Definition Classes
    lanag
  • package math

    A collection of com.markblokpoel.lanag.math utility functions, grouped by topic.

    A collection of com.markblokpoel.lanag.math utility functions, grouped by topic.

    Definition Classes
    lanag
  • package rsa

    This package contains the implementation for the mathematical foundations of Rational Speech Act theory (Frank & Goodman, 2012).

    This package contains the implementation for the mathematical foundations of Rational Speech Act theory (Frank & Goodman, 2012).

    Definition Classes
    lanag
  • package util

    Provides classes and objects for dealing with the simulation infrastructure.

    Provides classes and objects for dealing with the simulation infrastructure.

    Overview

    Spark simulations

    Use com.markblokpoel.lanag.util.SparkSimulation to create an instance of Spark running locally on your machine:

    import com.markblokpoel.lanag.com.markblokpoel.lanag.coreg.util.LocalSparkSimulation
    import LocalSparkSimulation.spark.implicits._
    
    val sequenceToBeParallelized = Seq(...)
    val rdd = LocalSparkSimulation.parallelize(sequenceToBeParallelized)

    You can now RDD functions like org.apache.spark.rdd.RDD.flatMap() and org.apache.spark.rdd.RDD.map() to apply transformations to the sequence.

    rdd.map(a => a +1)

    These will be executed lazily and in parallel. Until you write the results to file, or otherwise collect them, nothing will be executed. For a tutorial on Spark see the Apache Spark website https://spark.apache.org/docs/latest/quick-start.html.

    Global number generators

    The object com.markblokpoel.lanag.util.InteractionIdentifier is used in com.markblokpoel.lanag.core.Interaction to identify pairs of agents.

    The object com.markblokpoel.lanag.util.RNG specifies a global random number generator. Implementations of com.markblokpoel.lanag.core.Interaction that use this object exclusive will be repeatable for specific RNG seeds.

    Definition Classes
    lanag
  • ConfigWrapper
  • DefaultMain
  • InteractionIdentifier
  • RNG
  • SparkSimulation
  • StreamingMap

package util

Provides classes and objects for dealing with the simulation infrastructure.

Overview

Spark simulations

Use com.markblokpoel.lanag.util.SparkSimulation to create an instance of Spark running locally on your machine:

import com.markblokpoel.lanag.com.markblokpoel.lanag.coreg.util.LocalSparkSimulation
import LocalSparkSimulation.spark.implicits._

val sequenceToBeParallelized = Seq(...)
val rdd = LocalSparkSimulation.parallelize(sequenceToBeParallelized)

You can now RDD functions like org.apache.spark.rdd.RDD.flatMap() and org.apache.spark.rdd.RDD.map() to apply transformations to the sequence.

rdd.map(a => a +1)

These will be executed lazily and in parallel. Until you write the results to file, or otherwise collect them, nothing will be executed. For a tutorial on Spark see the Apache Spark website https://spark.apache.org/docs/latest/quick-start.html.

Global number generators

The object com.markblokpoel.lanag.util.InteractionIdentifier is used in com.markblokpoel.lanag.core.Interaction to identify pairs of agents.

The object com.markblokpoel.lanag.util.RNG specifies a global random number generator. Implementations of com.markblokpoel.lanag.core.Interaction that use this object exclusive will be repeatable for specific RNG seeds.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. util
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class ConfigWrapper(conf: Config) extends Product with Serializable
  2. case class SparkSimulation(local: Boolean = false, cores: Int = 4) extends Product with Serializable

    A Spark session utility wrapper.

    A Spark session utility wrapper.

    This session can be used to parallelize simulations. It requires the local machine to have a Spark driver installed, if used with flag local = true. See the Apache Spark website https://spark.apache.org/downloads.html for installation instructions.

    local

    Flag to specify whether or not should run in local mode.

    cores

    Number of cores to use in local mode, default is 4. Set to 0 to request maximum number of cores.

  3. class StreamingMap[K, V] extends Serializable

    A lazy implementation of Map, where the values for each key of type

    A lazy implementation of Map, where the values for each key of type

    K

    are specified by a function

    valueFunc

    of type

    K => V

    . This implementation is mutable. If an element

    key

    is requested and its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    key }}} its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    K => V }}} its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    valueFunc }}} its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    K }}}

    valueFunc

    of type

    K => V

    . This implementation is mutable. If an element

    key

    is requested and its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    key }}} its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    K => V }}} its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    valueFunc }}} its value is not yet computed, StreamingMap computes

    valueFunc(key)

    and stores the result. If the value has already been computed, then its simply returns the stored value.

    valueFunc(key) }}} value has already been computed, then its simply returns the stored value.

    K

    The parameter type of the keys.

    V

    The parameter type of the values.

    Annotations
    @SerialVersionUID()

Value Members

  1. object DefaultMain extends App
  2. object InteractionIdentifier extends Product with Serializable

    Global parameter for generating unique identifier numbers for interactions.

  3. object RNG

    A global Random Number Generator.

    A global Random Number Generator.

    Can be used to generate random numbers of various types:

    val p = RNG.nextProbability
    val i = RNG.nextInt(10)
    val b = RNG.nextBoolean

    You can set the seed of the random number generator using:

    RNG.setSeed(1024)

    If simulations use RNG exclusively, the results are the same if all parameters and the seed are the same.

Inherited from AnyRef

Inherited from Any

Ungrouped