Model

scalation.simulation.agent.Model
See theModel companion object
class Model(_name: String, val reps: Int, startSim: Double, animating: Boolean, aniRatio: Double, width: Int, height: Int) extends Identifiable, Completion

The Model class maintains a property graph making up the model and controls the flow of entities (SimAgents) through the model, following the agent-based simulation world-view. It maintains a time-ordered priority queue to activate/re-activate each of the entities. Each entity (SimAgent) is implemented as a Coroutine and may be thought of as running in its own thread.

Value parameters

_name

the name of this simulation model

aniRatio

the ratio of simulation speed vs. animation speed

animating

whether to animate the model

reps

the number of independent replications

startSim

the start time of this simulation

Attributes

Companion
object
Graph
Supertypes
trait Completion
trait Identifiable
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Classlikes

class Reporter(actTime: Double) extends SimAgent

The Reporter inner class observes the statistic at a specific time so schedule this reporter.

The Reporter inner class observes the statistic at a specific time so schedule this reporter.

Value parameters

actTime

the activation for the reporter.

Attributes

Supertypes
class SimAgent
trait Topological
trait Spatial
trait PartiallyOrdered[Spatial & Topological]
trait Temporal
trait Ordered[Temporal]
trait Comparable[Temporal]
trait Identifiable
class Coroutine
trait Runnable
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def animate(agent: SimAgent, what: CommandType, color: Color, shape: Shape): Unit

Put a token command (CreateToken, MoveToken or DestroyToken) on the animation queue.

Put a token command (CreateToken, MoveToken or DestroyToken) on the animation queue.

Value parameters

agent

who is being animated

color

the color the token

shape

the shape of the token

what

what animation command

Attributes

def customReport(statList: ArrayBuffer[Statistical]): Unit

Report (custom) on the statistical results of a simulation run.

Report (custom) on the statistical results of a simulation run.

Value parameters

statList

the list of statistics

Attributes

def finishedup(): Unit

Finish up the simulation.

Finish up the simulation.

Attributes

def getStatistics: ArrayBuffer[Statistic]

Return the statistical results of the simulation (statistics for each vertex). Includes both sample and time-persistent statistics.

Return the statistical results of the simulation (statistics for each vertex). Includes both sample and time-persistent statistics.

Attributes

def reschedule(agent: SimAgent, delay: Double): Unit

Reschedule the agent to act (be activated) at agent.time (optionally delayed) for those agents ahead of director.clock.

Reschedule the agent to act (be activated) at agent.time (optionally delayed) for those agents ahead of director.clock.

Value parameters

agent

the agent to be rescheduled

delay

the amount of time to delay the agent's activation time

Attributes

def reset(): Unit

Reset the agenda and stateful components for next replication.

Reset the agenda and stateful components for next replication.

Attributes

def resetStats(rep: Int, rmax: Int): Unit

Reset and aggregate all statistics.

Reset and aggregate all statistics.

Value parameters

rep

the current replication (1, ... reps)

rmax

the maximum number of replications/batches

Attributes

def resimulate(firstTime: Boolean, simStart: Double): Unit

Re-simulate over the same components multiple times with different input(source); this is not the same as replication, replication input(source) is the same

Re-simulate over the same components multiple times with different input(source); this is not the same as replication, replication input(source) is the same

Value parameters

firstTime

whether it is the first time

simStart

the time of simulation start

Attributes

def schedule(agent: SimAgent, delay: Double): Unit

Schedule the agent to act (be activated) at agent.time (optionally delayed).

Schedule the agent to act (be activated) at agent.time (optionally delayed).

Value parameters

agent

the agent to be scheduled

delay

the amount of time to delay the agent's activation time

Attributes

def simulate(): Unit

Execute the simulation (includes scheduling all Sources) returning summary statistics.

Execute the simulation (includes scheduling all Sources) returning summary statistics.

Attributes

def yield2Next(agent1: SimAgent, quit: Boolean): Unit

Yield to the next agent, i.e., agent1 -- yield-to -> agent2.

Yield to the next agent, i.e., agent1 -- yield-to -> agent2.

Value parameters

agent1

the currently executing agent

quit

whether agent1 wants to quit/terminate

Attributes

Inherited methods

override def equals(that: Any): Boolean

Determine whether Identifiable object 'this' equals Identifiable object 'that'. Works since 'id' is unique for all Identifiable objects.

Determine whether Identifiable object 'this' equals Identifiable object 'that'. Works since 'id' is unique for all Identifiable objects.

Attributes

Definition Classes
Identifiable -> Any
Inherited from:
Identifiable
def hasFinished(): Unit

Signal via the semaphore that the simulation has finished, thereby ending the wait due to calling the waitFinished method.

Signal via the semaphore that the simulation has finished, thereby ending the wait due to calling the waitFinished method.

Attributes

Inherited from:
Completion
override def hashCode: Int

Return the hashCode as the unique id.

Return the hashCode as the unique id.

Attributes

Definition Classes
Identifiable -> Any
Inherited from:
Identifiable
def me: String

Return the full identity.

Return the full identity.

Attributes

Inherited from:
Identifiable
def typeName: String

Get the type of the object.

Get the type of the object.

Attributes

Inherited from:
Identifiable
def waitFinished(): Unit

Wait for the main simulation Thread/Coroutine to complete. This can used used to time execution of models.

Wait for the main simulation Thread/Coroutine to complete. This can used used to time execution of models.

Attributes

See also

apps.process.Bank2

Inherited from:
Completion

Concrete fields

var rep: Int
val reps: Int
val statV: LinkedHashMap[String, VectorD]

The map of statistics vectors records the means of each replication

The map of statistics vectors records the means of each replication

Attributes

Inherited fields

val id: Int

Attributes

Inherited from:
Identifiable
val name: String

Attributes

Inherited from:
Identifiable