Skip to main content
Version: 🚧 Alpha 🚧

Exploration calibration methods

Several methods are currently available in GAMA to explore and calibrate your simulation model.

The method statement​

The optional method statement selects the algorithm used by a batch experiment.

If this element is omitted, the batch will run an exploration method with default facets, see the exploration section for more details.

For example, an exploration method can be left at its default settings:

method exploration;

Or an optimization method can specify a fitness expression and algorithm options:

method genetic
pop_dim: 3 crossover_prob: 0.7 mutation_prob: 0.1
nb_prelim_gen: 1 max_gen: 5
minimize: nb_infected
aggregation: "max";

Choosing a batch method​

Batch methods fall into three groups:

  • Exploration evaluates selected parameter sets. The default exploration method uses exhaustive sampling unless another sampling plan or explicit parameter sets are supplied.
  • Analysis methods calculate statistics for selected model outputs, including stochasticity and sensitivity analyses.
  • Optimization methods search parameter values that improve an expression using minimize: or maximize:.

Exploration methods​

An exploration method runs simulations for parameter sets generated by a sampling method, supplied with with:, or read from a CSV file with from:. The repeat: facet on the batch experiment controls replications for each parameter set.

Generic method facets (i.e. parameters):​

  • sampling: sampling algorithm. Available choices are factorial, uniform, latinhypercube, orthogonal, saltelli and morris. When omitted, GAMA uses exhaustive exploration; specifying sample: without sampling: selects uniform sampling.
  • sample: number of parameter sets for sampling methods that use a sample size; defaults to 255. For exhaustive exploration, omit sample: to explore the complete parameter space.
  • factorial: number of slices per parameter for factorial sampling. If omitted, each parameter uses the default of 9 slices when ranges need to be divided.
  • with: explicit list of parameter sets, each a map from parameter names to values.
  • from: path to a CSV file. Its first row contains parameter names; each following row supplies one parameter set.
  • outputs: list of global model variables to record for each simulation.
  • raw_results: path where the recorded values are written.

Use only one of sampling:, from: and with: to define parameter sets. If more than one is present, GAMA gives priority to sampling:, then from:, then with:.

Examples:​

Use with: to list explicit parameter sets. Each set is a map whose keys are parameter names and whose values are the values to use:

method exploration with: [
["parameter1"::0.1, "parameter2"::0.01],
["parameter1"::0.5, "parameter2"::0.2],
["parameter1"::1.0, "parameter2"::0.05]
];

To use a CSV file instead, put parameter names in its first row and one parameter set per following row:

experiment exploration mode: batch keep_seed:true until:( time > 5000 ) repeat:40 {
method exploration from:"../includes/my_custom_batch_exploration.csv";
}

When you want GAMA to generate parameter sets, select a sampling method with sampling:. For example:

experiment exploration mode: batch keep_seed:true until:( time > 5000 ) repeat:40 {
method exploration sample:100 sampling:"uniform";
}

The sampling: facet accepts factorial, uniform, latinhypercube, orthogonal, saltelli or morris.

Exhaustive exploration of the parameter space: factorial sampling​

When no sampling:, with: or from: facet is specified, exploration evaluates all combinations of the parameter values. The factorial sampling option can also build combinations by subdividing parameter ranges.

Example:

experiment Batch mode: batch repeat: 2 keep_seed: true until: (food_gathered = food_placed ) or ( time > 400 ) {
parameter 'Evaporation:' var: evaporation_rate among: [ 0.1 , 0.2 , 0.5 , 0.8 , 1.0 ] unit: 'rate every cycle (1.0 means 100%)';
parameter 'Diffusion:' var: diffusion_rate min: 0.1 max: 1.0 unit: 'rate every cycle (1.0 means 100%)' step: 0.3;
}

The order of the simulations depends on the order of the parameters. In our example, the first combinations will be the followings:

  • evaporation_rate = 0.1, diffusion_rate = 0.1, (2 times)
  • evaporation_rate = 0.1, diffusion_rate = 0.4, (2 times)
  • evaporation_rate = 0.1, diffusion_rate = 0.7, (2 times)
  • evaporation_rate = 0.1, diffusion_rate = 1.0, (2 times)
  • evaporation_rate = 0.2, diffusion_rate = 0.1, (2 times)
  • ...

When sampling:"factorial" is selected, use factorial: to set the number of slices per parameter, or sample: to request a total number of parameter sets. If neither is specified, the implementation uses 255 sample sets. Parameter definitions that already specify values determine which combinations can be generated.

experiment exploration_with_explicit_factorial mode: batch repeat: 3 until: (food_gathered = food_placed ) or ( time > 400 ) {
method exploration sampling:"factorial" factorial:4;
}

In the example above, each parameter will have 4 values, taken uniformly from min and max or within the among. When the sample facet is used, Gama scattered the parameters to obtain a given number of point.

experiment exploration_with_sampled_factorial mode: batch repeat: 3 until: (food_gathered = food_placed ) or ( time > 400 ) {
method exploration sampling:"factorial" sample:100;
}

In the example above, Parameters are spliced into n values in order to get closer as possible to 100 points. For two parameters, it means 10 values for each, to obtain 100 possible combination of parameter values.

random exploration of the parameter space: uniform sampling​

Provides a quick and simple way to explore the parameter space, drawing uniformly each points. The drawing algorithm treat parameters in two distinctive ways: when min and max facet of the parameter is used, the value is drawn uniformly within the boundaries (included); when a list/set of values is defined, the value is drawn uniformly within this list/set. Each parameter value is treated independently. The algorithm select as many points as defined by the sample facet.

Example:

experiment exploration mode: batch until:( time > 5000 ) repeat:40 {
method exploration sample:100 sampling:"uniform";
}

latin hypercube sampling​

The procedure of Latin Hypercube Sampling (LHS) works upon a grid view of the parameter space: each parameter is divided into n slices, with n based on sample facet, making up a matrix with d dimensions, with d the number of parameters. At first iteration, the procedure select one slice per parameter, draw a value for each ones (within the boundaries of the slice) and exclude each selected slice; then procedure continue until no more slices remains. For a simple yet more precise definition, see the wikipedia page.

Example:

experiment exploration mode: batch until:( time > 5000 ) repeat:40 {
method exploration sample:100 sampling:"latinhypercube";
}

orthogonal sampling​

Orthogonal sampling uses an orthogonal-array-based plan. Its iterations: facet controls the number of iterations and defaults to 5.

Example:

experiment exploration mode: batch until:( time > 5000 ) repeat:40 {
method exploration sample:100 sampling:"orthogonal";
}

Analysis Methods​

Analysis methods run simulations for selected parameter sets and calculate statistics for the outputs named in outputs:. GAMA provides stochanalyse, sobol, morris and betad. Each method has its own required facets and sampling plan; use results: when raw simulation values should also be saved. See the SIR Analysis tutorial for complete models using these methods.

Stochastic analysis: stochanalyse​

This method evaluates output variability over repeated simulations for sampled parameter sets. The batch experiment's repeat: sets the replication count; sample: and sampling: on the method control the parameter sets. Its report summarizes coefficient-of-variation and standard-error thresholds, along with critical-effect-size and power-test estimates.

The required facets are outputs: and report:. sample: and sampling: are optional; results: optionally saves raw simulation values.

method stochanalyse
outputs: ["nb_recovered"]
sampling: uniform
sample: 100
report: "../results/stoch_report.txt"
results: "../results/stoch_raw.csv";

Interpret the report with the parameter ranges, replication count, thresholds and effect sizes used for that run. It provides diagnostics for choosing a replication count; it does not select one value that is appropriate for every model.

Sobol analysis: sobol​

The Sobol method estimates first-order and total-order contributions to output variance using a Saltelli sample. sample:, outputs: and report: are required; results: optionally saves raw simulation values. The optional path: facet can point to a Saltelli sample CSV.

method sobol
outputs: ["nb_recovered"]
sample: 20
report: "../results/sobol_report.csv"
results: "../results/sobol_raw.csv";

The report contains first-order (S1) and total-order (ST) estimates for the selected outputs. Read them with the parameter ranges and sample size used for the run; the estimates include sampling uncertainty.

Morris analysis: morris​

Morris sampling evaluates trajectories that vary one parameter at a time. The report gives the mean (μ), mean absolute effect (μ*) and standard deviation (σ) of the elementary effects for each parameter. These summarize direction, magnitude and variation within the sampled parameter space.

outputs: and report: are required. sample: sets the number of trajectories and defaults to 10; levels: sets the number of levels and defaults to 4. results: optionally saves raw simulation values.

method morris
outputs: ["nb_recovered"]
sample: 10
levels: 4
report: "../results/morris_report.txt"
results: "../results/morris_raw.csv";

Choose the sample size and parameter ranges for the question being investigated. The reported indices describe the sampled ranges and output.

Beta^d analysis: betad​

The betad method compares empirical output distributions for each parameter value with the overall output distribution, then averages the resulting discretized Kuiper distances. Its implementation cites Borgonovo et al. (2022). The report is a separate sensitivity summary; interpret it alongside the model and sampling settings.

sampling:, outputs: and report: are required. sample: is optional. bootstrap: controls additional parameter combinations generated by the implementation and defaults to 4; it does not configure a confidence interval. results: optionally saves raw simulation values.

method betad
outputs: ["nb_recovered"]
sample: 6
sampling: orthogonal
report: "../results/betad_report.txt"
results: "../results/betad_raw.csv";

Calibration Methods​

A calibration method searches the parameter combinations defined in a batch experiment and evaluates each simulation using a fitness expression. Set either maximize: or minimize: to specify the expression and direction. The result is the best solution found by that method; it is not a guarantee of a global optimum.

When repeat: is greater than one, GAMA runs each parameter combination repeatedly. aggregation: controls how those repeated fitness values are combined. The implementation uses their mean when the facet is omitted; methods that expose the facet accept min, max and, where listed, avr. The local-search methods also accept init_solution: as a map from parameter names to starting values.

The Calibration model is a complete runnable example of these methods. The snippets below use its infection_rate, dying_proba and num_dead declarations.

Hill Climbing: hill_climbing​

Hill Climbing starts from an initial parameter set and evaluates the neighboring sets formed by changing one explored parameter. It keeps the best fitness found and moves to that parameter set when it improves the current solution. The search stops when no neighbor improves the current solution, no neighbors remain, or the optional iter_max move limit is reached. It returns the best solution found, not a guarantee of a global optimum.

  • iter_max sets the maximum number of moves; it is optional.
  • init_solution optionally sets the starting values as a map, for example map(["infection_rate"::0.2, "dying_proba"::0.05]).
  • aggregation accepts min, max or avr when repeated runs are aggregated.
method hill_climbing init_solution: map(["infection_rate"::0.2, "dying_proba"::0.05]) minimize: num_dead aggregation: "max";

Simulated Annealing: annealing​

Simulated Annealing searches neighboring parameter sets while reducing a temperature value. The implementation evaluates a fixed number of candidates per temperature level and stops when the temperature is no longer greater than temp_end or the neighborhood is empty.

  • temp_init sets the initial temperature (default 100).
  • temp_end sets the stopping temperature (default 1).
  • temp_decrease is multiplied by the current temperature after each level (default 0.5).
  • nb_iter_cst_temp sets the number of candidate evaluations per level (default 5).
  • init_solution optionally sets the starting values. aggregation accepts min or max for repeated runs.
method annealing minimize: num_dead temp_decrease: 0.5 temp_end: 10.0 temp_init: 50;

Tabu Search: tabu​

Tabu Search explores parameter neighbors while keeping a list of recently visited solutions. Neighbors on that list are skipped; the search stops when it reaches its iteration limit or has no eligible neighbor.

  • iter_max sets the maximum number of moves (default 50).
  • tabu_list_size sets the maximum number of recent solutions retained (default 5).
  • init_solution optionally sets the starting values. aggregation accepts min, max or avr for repeated runs.
method tabu iter_max: 5 tabu_list_size: 5 minimize: num_dead aggregation: "max";

Reactive Tabu Search: reactive_tabu​

Reactive Tabu Search adjusts its tabu-list size during search and checks for repeated solution cycles. Its available controls are:

  • iter_max sets the maximum number of moves.
  • tabu_list_size_init, tabu_list_size_min and tabu_list_size_max set the initial, minimum and maximum list sizes.
  • nb_tests_wthout_col_max sets the number of moves without revisiting a tested solution before the list can shrink.
  • cycle_size_min and cycle_size_max set the cycle lengths considered by the implementation.
  • init_solution optionally sets the starting values. aggregation accepts min, max or avr for repeated runs.
method reactive_tabu iter_max: 10 cycle_size_max: 10 cycle_size_min: 3 tabu_list_size_init: 5 minimize: num_dead aggregation: "max";

Genetic Algorithm: genetic​

The Genetic Algorithm builds a population of parameter sets and evolves it with crossover and mutation. The implementation uses one-point crossover and one-variable mutation. It selects the next population by fitness; set stochastic_sel: true to use roulette selection. improve_sol: true applies a local search to population members.

  • pop_dim sets the population size (default 3).
  • crossover_prob and mutation_prob set the crossover and mutation probabilities (defaults 0.7 and 0.1).
  • nb_prelim_gen sets the number of preliminary random populations used to build the initial population (default 1).
  • max_gen sets the generation limit (default 20).
  • improve_sol enables local improvement; stochastic_sel enables roulette selection. Both are optional and default to false.
  • aggregation accepts min, max or avr for repeated runs.
method genetic pop_dim: 3 crossover_prob: 0.7 mutation_prob: 0.1 improve_sol: true stochastic_sel: false nb_prelim_gen: 1 max_gen: 5 minimize: num_dead aggregation: "min";

Particle Swarm Optimization: pso​

Particle Swarm Optimization updates candidate parameter sets (particles) using their current velocities, personal best positions and the best position found by the swarm. The implementation supports numerical parameter ranges.

  • iter_max is required and sets the iteration limit.
  • num_particles sets the number of particles.
  • weight_inertia, weight_cognitive and weight_social control the corresponding velocity components.
  • aggregation accepts min, max or avr for repeated runs.
method pso num_particles: 5 weight_inertia: 0.7 weight_cognitive: 1.5 weight_social: 1.5 iter_max: 5 aggregation: "avr" minimize: num_dead;