XCSF  1.4.7
XCSF learning classifier system
sam.c File Reference

Self-adaptive mutation functions. More...

#include "sam.h"
#include "utils.h"
Include dependency graph for sam.c:

Go to the source code of this file.

Macros

#define MU_EPSILON   0.0005
 smallest mutation rate allowable More...
 
#define N_RATES   (10)
 number of mutation rates for rate selection adaptation More...
 

Functions

void sam_init (double *mu, const int N, const int *type)
 Initialises self-adaptive mutation rates. More...
 
void sam_adapt (double *mu, const int N, const int *type)
 Self-adapts mutation rates. More...
 
void sam_json_import (double *mu, const int N, const cJSON *json)
 Initialises a mutation vector from a cJSON object. More...
 

Variables

static const double mrates [(10)]
 Values for rate selection adaptation. More...
 

Detailed Description

Self-adaptive mutation functions.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2015–2021.

Definition in file sam.c.

Macro Definition Documentation

◆ MU_EPSILON

#define MU_EPSILON   0.0005

smallest mutation rate allowable

Definition at line 27 of file sam.c.

◆ N_RATES

#define N_RATES   (10)

number of mutation rates for rate selection adaptation

Definition at line 28 of file sam.c.

Function Documentation

◆ sam_adapt()

void sam_adapt ( double *  mu,
const int  N,
const int *  type 
)

Self-adapts mutation rates.

Parameters
[in,out]muVector of mutation rates.
[in]NNumber of mutation rates.
[in]typeVector specifying each rate type.

Definition at line 68 of file sam.c.

References clamp(), mrates, MU_EPSILON, N_RATES, rand_normal(), rand_uniform(), rand_uniform_int(), SAM_LOG_NORMAL, SAM_RATE_SELECT, and SAM_UNIFORM.

Referenced by act_integer_mutate(), cond_ellipsoid_mutate(), cond_rectangle_mutate(), cond_ternary_mutate(), graph_mutate(), neural_layer_connected_mutate(), neural_layer_convolutional_mutate(), neural_layer_lstm_mutate(), neural_layer_recurrent_mutate(), pred_nlms_mutate(), and tree_mutate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sam_init()

void sam_init ( double *  mu,
const int  N,
const int *  type 
)

Initialises self-adaptive mutation rates.

Parameters
[out]muVector of mutation rates.
[in]NNumber of mutation rates.
[in]typeVector specifying each rate type.

Definition at line 43 of file sam.c.

References mrates, MU_EPSILON, N_RATES, rand_uniform(), rand_uniform_int(), SAM_LOG_NORMAL, SAM_RATE_SELECT, and SAM_UNIFORM.

Referenced by act_integer_init(), cond_ellipsoid_init(), cond_rectangle_init(), cond_ternary_init(), graph_init(), neural_layer_connected_init(), neural_layer_convolutional_init(), neural_layer_lstm_init(), neural_layer_recurrent_init(), pred_nlms_init(), and tree_rand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sam_json_import()

void sam_json_import ( double *  mu,
const int  N,
const cJSON *  json 
)

Initialises a mutation vector from a cJSON object.

Parameters
[in,out]muVector of mutation rates.
[in]NNumber of mutation rates.
[in]jsoncJSON object.

Definition at line 100 of file sam.c.

Referenced by act_integer_json_import(), cond_ellipsoid_json_import(), cond_rectangle_json_import(), cond_ternary_json_import(), graph_json_import(), and pred_nlms_json_import().

Here is the caller graph for this function:

Variable Documentation

◆ mrates

const double mrates[(10)]
static
Initial value:
= { 0.0005, 0.001, 0.002, 0.003, 0.005,
0.01, 0.015, 0.02, 0.05, 0.1 }

Values for rate selection adaptation.

Definition at line 33 of file sam.c.

Referenced by sam_adapt(), and sam_init().