Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Algoritmos Genéticos > Utilities > mutation_ga_binary


A function which performs binary mutation


[Mut_Indiv, pos] = mutation_ga_binary(Indiv,param)



A string.

The individual on which we will perform the mutation.


a list of parameters.

  • "binary_length": an integer scalar, the size of the binary code.

  • "multi_mut": a boolean. If %T, several random bits will be flipped.

  • "multi_mut_nb": an integer scalar, the number of bits to be flipped. Only used when multi_mut is set to %T (default 2).


A string.

The mutated individual.


A vector of integers.

The positions of the mutated bits.


This function performs a classical multi-bits binary mutation.

This generates the individual Mut_Indiv by inverting bits on random positions.

By default mutation_ga_binary(Indiv) selects randomly an index i between 1 and length(Indiv). It then modifies the i-th character of Indiv to 1 if it was 0, or 0 if it was 1.

If "multi_mut" is set to %T multiple mutations may occur. The maximal number of mutation is given by "multi_mut_nb".

Random number generator

mutation_ga_binary is based on grand for generating the random samples. Use grand("setsd", seed) to change the seed for crossover_ga_binary.

seed = getdate("s");
grand("setsd", seed); //sets the seed to current date

seed = 0;
grand("setsd", seed); //sets the seed to default value


[Mut_Indiv, pos] = mutation_ga_binary(Indiv)

// With multiple mutation
[Mut_Indiv, pos] = mutation_ga_binary(Indiv,param)

See also

Report an issue
<< init_ga_default Utilities mutation_ga_default >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:09:45 CET 2017