class Gambit::jswarm_1_0_0::particle_swarm

A swarm of particles and methods to evolve them.

#include <jswarm.hpp>

Public Functions

Name
particle_swarm()
Constructor.
voidinit()
Initialise the swarm.
voidrun()
Release the swarm.

Public Attributes

Name
std::vector< double >upperbounds
std::vector< double >lowerbounds
Scanner::like_ptrlikelihood_function
Pointer to objective function.
Scanner::printer_interface *printer
Pointer to GAMBIT printer.
std::stringpath
Prefix for all j-Swarm save files.
intnPar
Dimensionality of the parameter space.
intnDerived
Number of derived quantities to output (GAMBIT printers handle these).
intnDiscrete
Number of parameters that are to be treated as discrete.
intmaxgen
Maximum number of generations.
intNP
Population size (individuals per generation)
intbndry
Boundary constraint: 1=brick wall, 2=random re-initialization, 3=reflection.
intconvsteps
Number of steps to smooth over when checking convergence.
intsavecount
Save progress every savecount generations.
intinit_pop_strategy
Initialisation strategy: 0=one shot, 1=n-shot, 2=n-shot with error if no valid vectors found.
intmax_ini_attempts
Maximum number of times to try to find a valid vector for each slot in the initial population.
intverbose
Output verbosity: 0=only error messages, 1=basic info, 2=civ-level info, 3+=population info.
intseed
Base seed for random number generation; non-positive means seed from the system clock.
intfcall
Number of calls to the objective function so far.
intfcall_global
Number of calls to the objective function so far across all processes.
doubleomega
Inertial weight.
doublephi1
Cognitive weight.
doublephi2
Social weight.
doubleconvthresh
Threshold for gen-level convergence: smoothed fractional improvement in the mean personal best population value.
doublemin_acceptable_value
Minimum function value to accept for the initial generation if init_population_strategy > 0.
booladapt_phi
Use self-optimising adaptive choices for phi1 and phi2.
booladapt_omega
Use self-optimising adaptive choices for omega.
boolinit_stationary
Initialise particle velocities to zero.
boolresume
Resume from previous run.
boolallow_new_settings
Allow settings to be overridden with new values when resuming.
boolsave_particles_natively
Save full particle data from every generation.
std::vector< int >discrete
Indices of parameters to be treated as discrete.

Public Functions Documentation

function particle_swarm

particle_swarm()

Constructor.

function init

void init()

Initialise the swarm.

function run

void run()

Release the swarm.

Public Attributes Documentation

variable upperbounds

std::vector< double > upperbounds;

Parameter space boundaries

variable lowerbounds

std::vector< double > lowerbounds;

variable likelihood_function

Scanner::like_ptr likelihood_function;

Pointer to objective function.

variable printer

Scanner::printer_interface * printer;

Pointer to GAMBIT printer.

variable path

std::string path;

Prefix for all j-Swarm save files.

variable nPar

int nPar;

Dimensionality of the parameter space.

variable nDerived

int nDerived;

Number of derived quantities to output (GAMBIT printers handle these).

variable nDiscrete

int nDiscrete;

Number of parameters that are to be treated as discrete.

variable maxgen

int maxgen;

Maximum number of generations.

variable NP

int NP;

Population size (individuals per generation)

variable bndry

int bndry;

Boundary constraint: 1=brick wall, 2=random re-initialization, 3=reflection.

variable convsteps

int convsteps;

Number of steps to smooth over when checking convergence.

variable savecount

int savecount;

Save progress every savecount generations.

variable init_pop_strategy

int init_pop_strategy;

Initialisation strategy: 0=one shot, 1=n-shot, 2=n-shot with error if no valid vectors found.

variable max_ini_attempts

int max_ini_attempts;

Maximum number of times to try to find a valid vector for each slot in the initial population.

variable verbose

int verbose;

Output verbosity: 0=only error messages, 1=basic info, 2=civ-level info, 3+=population info.

variable seed

int seed;

Base seed for random number generation; non-positive means seed from the system clock.

variable fcall

int fcall;

Number of calls to the objective function so far.

variable fcall_global

int fcall_global;

Number of calls to the objective function so far across all processes.

variable omega

double omega;

Inertial weight.

variable phi1

double phi1;

Cognitive weight.

variable phi2

double phi2;

Social weight.

variable convthresh

double convthresh;

Threshold for gen-level convergence: smoothed fractional improvement in the mean personal best population value.

variable min_acceptable_value

double min_acceptable_value;

Minimum function value to accept for the initial generation if init_population_strategy > 0.

variable adapt_phi

bool adapt_phi;

Use self-optimising adaptive choices for phi1 and phi2.

variable adapt_omega

bool adapt_omega;

Use self-optimising adaptive choices for omega.

variable init_stationary

bool init_stationary;

Initialise particle velocities to zero.

variable resume

bool resume;

Resume from previous run.

variable allow_new_settings

bool allow_new_settings;

Allow settings to be overridden with new values when resuming.

variable save_particles_natively

bool save_particles_natively;

Save full particle data from every generation.

variable discrete

std::vector< int > discrete;

Indices of parameters to be treated as discrete.


Updated on 2025-02-12 at 15:36:39 +0000