Module for Individual with binary encoding.
Class for individual in population. Random solution will be initialized by default.
- ranges (tuple list) – value ranges for all entries in solution.
- eps (float or float list (with the same length with ranges)) – decrete precisions for binary encoding, default is 0.001.
binarize(decimal, eps, length)¶
Helper function to convert a float to binary sequence.
Clone a new individual from current one.
decimalize(binary, eps, lower_bound)¶
Helper function to convert a binary sequence back to decimal number.
Decode gene sequence to solution of target function.
Encode solution to gene sequence in individual using different encoding.
Initialize the individual by providing chromsome or solution.
- chromsome (list of (float / int)) – chromesome sequence for the individual
- solution (list of float) – the variable vector of the target function.
If both chromsome and solution are provided, only the chromsome would be used. If neither is provided, individual would be initialized randomly.