# Simulations

The Simulation module of SocLab (in Simulations Simulation Explorer) allows to simulate the way social actors could regularize their behaviors. This page focuses on the usage of this module to run some simulation experiments and handle their results.

Contents:

### Launching simulations

That is how the simulation module looks like:

SocLab’s Simulation module (click to enlarge)

The left panel is divided in three parts.

The upper zone allows to select whether the  simulations will use fuzzy or normal stakes and/or solidarities. The constraints functions (if any) can be applied to the simulation experiment.

The middle zone is where the length of a simulation. is defined. A simulation experiment consists in severals runs (defined in number of Runs) , each run lasting up to a certain number of steps. If a stationary state is reached in a smaller number of steps, the run ends, otherwise the run last until the number of steps is reached. These values are validated by the Accept button.

The lower zone is made of several buttons:

• Open previous simulations : restore previous simulation results and parameters by opening any previous simulations folder.
• Run : Run a simulation with the last accepted parameters. Prompt the user to define a folder where the results will be written (model’s folder by default).
• View Results : see the Results visualization section
• Synthesis  of results: produce basics statistics (mean and standard deviation) on simulation results (Actors’ satisfactions and Relations States)
• State Analysis: invoke the State analysis module (see the [TODO LINK] page), adding the mean convergence  state to the Significant states list.
• Help: invoke a small manual of the Simulation Module
• Save/Clear Report: allows to export some of the results in a .rtf file. File name  follows the pattern <model_name><date><time>Synthesis.rtf

The right panel is divided in three tabs. The Initial States tab purpose is to define the initial Relations’ states values (almost deprecated feature). The Actors Parameters tab allows to define psycho-cognitive traits for each Actor (see the next section). The Description tab allows to write some remarks and further information about a simulation experiment.

### Actors Parameters

In the Actors Parameters tab, Actors rationality can be customized with various parameters.
These parameters affect the rationality algorithm described here [TODO LINK]

• Distance min/max satisfaction : the Euclidean distance between the minimal and maximal satisfaction of the actor.
• Scope : reflects the Actor’s ability to discriminate situations, therefore his ability to select the applicable rules of his base in the current situation. With a Scope of 1,  rules are always applicable, with a Scope of 3, situations are discriminated into bad ones, average ones and good ones.
• Tenacity : reflects the Actor’s relentlessness. The higher his tenacity, the more he will explore,  to the detriment of the exploitation. High tenacity values increase simulations length.
• Reactivity : reflects how quickly an Actor updates his ambition and his exploration rate, according to the satisfaction he receives in the current situation. Small values increase the length of simulation.
• Repartition of reward : repartition of the reward between the last applied rule and the penultimate applied rule.
• Types of rules:
• Simple : Rules are reinforced with a fixed reward, independently of the satisfaction gain (or loss) their application produced. This reward is added (or deducted) to the rule strength until a certain threshold. Rules are progressively removed from the rule base with an oblivion factor.
• Self learning : Rules are reinforced with a reward which is proportional to the satisfaction gain (or loss) their application produce. This reinforcement follows the formula
$strength \leftarrow al*strength + (1-al)*reward$,
where $al \in [0;1]$ progressively increase, following the exploitation rate.
• Oblivion : only used with simple rules.
• Reward : only used with simple rules.
• Action range : reflects the importance of an Actor’s actions (i.e. the magnitude of state modification he performs on relation he controls). The more the action range, the more energetic the exploration.

Don’t forget to click the Accept button to take these values into account during the simulation experiment

### Results Visualization

When you open previous simulation results, or once a simulation experiment is over, the visualization module (triggered by a click on the View Results button).

This what the results viewing GUI looks like:

Results visualization interface (click to enlarge)

Different results can be displayed on each side of this frame. Several options are available, chosen by the radio buttons at the top of each side.For each option, several type of results can be displayed. Once option and type are selected, results are displayed by a click on the Draw it ! button

• Option Simulation : display of simulation runs’ length as a bar plot (mean value and standard deviation). In case of non converging simulation runs, length can be displayed for only converging runs.
• Option Convergence : display of converging and non-converging runs proportion as a pie chart.
• Option Actor : various results can be shown, according to the value of the Experiment and Variable fields
• Experiment: either all the simulation runs or a particular run. If all the runs are selected, results will be displayed far an actor. If a particular run is selected, results will be displayed for all the actors.
• Variable : either an histogram of mean satisfaction values and deviations (if all the runs are selected in the Experiment field) or a curve (for a particular run). For curves, x-axis is the number of simulation steps and y-axis show the Satisfaction or Satisfaction Threshold value.  Black circled cross indicates the end of a run. Putting the mouse anywhere over a curve will display the corresponding Actor. Solid red curve indicates the mean values of all the curves.
• Option Relation behave as the Actor option, except that state values are displayed instead of Satisfaction values.

Every graph drawn can be added to a  report, using the Add/Clear Report button.

N.B. Opening previous simulations may cause SocLab to crash (exceptions displayed in your console/shell ). Turn SocLab off and on again ;-).

### Results Synthesis

Be sure to perform a visualization of results (just launching the module without displaying anything is sufficient) before clicking on the Synthesis of Results button.

Synthesis of Results produce a summary of an experiment, recapitulating the number of runs, the number of steps, the Actors’ parameters and the mean and standard deviation of Relations states and Actors satisfactions.