Sheffield Genetic Algorithm Toolbox

Install Toolbox

As a function library of matlab, the Sheffield Genetic Algorithm Toolbox can easily implement genetic algorithms. At the beginning, I learned the swarm intelligence optimization algorithms such as particle swarm optimization and whale optimization algorithms, both in the integer domain, relying on different operators to iterate each agent in the population, and I have also encountered genetics such as differential evolution algorithms. Improved algorithm. After initially understanding the genetic algorithm, I have been thinking about the conversion between binary and decimal in the genetic algorithm, because it involves the decimal part of the decimal and the number of binary digits. In the Sheffield toolbox, there is a bs2rv () function. The built-in function contains a specific algorithm, which allows us to easily convert a binary array into a decimal number in a specific interval according to the parameters required by the algorithm. The principle is not special. To understanding.

Download toolbox

The original download link was provided by the official for free, but it is currently 404. If you need it, you can privately trust me. The original official website is the following.
http://codem.group.shef.ac.uk/index.php/ga-toolbox
(1) Get out of the network disk, in order to remember the addition of Chinese, you can delete the previous Chinese after downloading.

(2) Unzip it and put it in the folder (toolbox) of the matlab management tool. PS I use matlab2012a
Insert picture description here

Add path

Find the following folder in matlab and add gatbx to the path of all files. My matlab needs to be added every time it starts.
Insert picture description here

Genetic algorithm function

Genetic algorithm is a group intelligence optimization algorithm. In the population, iterate through the three operations of selection, crossover and mutation for each particle. Here are a few functions that are slightly difficult to understand. For some functions, my understanding may be biased.

ranking () function

There are three calling formats for ranking () function
1.FitnV = ranking (ObjV)
2.FitnV = ranking (ObjV, RFun)
3.FitnV = ranking (ObjV, RFun, SUBPOP)

The first format
ObjV is an object value , which stores a vector. Returns a sequence with linear sorting and differential pressure = 2 , where linear sorting and differential pressure of 2 are the default attributes. From a macro perspective, a ** [0,2] vector is returned. The larger ObjV , the smaller the return value. This return value will be called in the select function **.
The second format
Rfun needs to pass in a two-digit array. In
Rfun (1), for linear sorting, Rfun (1) needs to be controlled in [1,2], As far as I understand, the pressure difference is a compression mode, Rfun (1) = 2, the return value of the function will be controlled at [0,2], Rfun (1) = 1.5, the return value will be controlled at [0.5,1.5].
In Rfun (2), Rfun (2) = 1 is a nonlinear sorting, and Rfun (2) = 0 is a linear sorting. Little is known about linear sorting and nonlinear sorting. The ranking () function defaults to linear sorting.
The third format
defaults SUBPOP = 1, SUBPOP defines the number of ObjV neutron populations, this parameter has not been studied too much.

select () function

Select individuals from the population 1.
SelCh = select (SEL_F, Chrom, FitnV)
2. SelCh = select (SEL_F, Chrom, FitnV, GGAP)
3. SelCh = select (SEL_F, Chrom, FitnV, GGAP, SUBPOP)

The first format
SEL_F passes in a string parameter 'rws' is Roulette Wheel Selection, which is roulette and 'sus' is Stochastic Universal Sampling, which is random universal sampling.
The second format
GGAP represents the generation gap, that is, the probability of remaining. The default is 1.0

bs2rv () function

Binary to decimal function
bs2rv (Chrom, FieldD)
This function is understood as an algorithm built into the genetic algorithm toolbox. Because the selection, crossover, and mutation in the genetic algorithm are all completed in the binary string, this function needs to be converted Decimal.
FieldD understands that our conversion is a format parameter that needs to be passed in.
FieldD = [len lb ub code scale lbin ubin]
len = size (Chrom, 2)
lb, ub are the upper and lower limits of each variable.
The code comes in the encoding mode, 1 means standard binary encoding, and 0 means Gray encoding.
scale The scale used for the incoming substring. 0 means the scale is calculated. 1 means logarithmic scale.
lbin ubin indicates whether the converted range contains boundaries, 0 means no boundaries, and 1 means inclusion.

summary

This article only briefly introduces a small part of the Sheffield genetic algorithm toolbox. If there are any inaccuracies, you are welcome to discuss them in private letters. I hope this article can help everyone in addition to helping me record my learning.

Published 1 original article · liked 0 · visits 6

Guess you like

Origin blog.csdn.net/qq_40705144/article/details/105600406