gaft.components.decimal_individual¶
Definition of individual class with decimal encoding.
-
class
gaft.components.decimal_individual.
DecimalIndividual
(ranges, eps=0.001)¶ Bases:
gaft.components.individual.IndividualBase
Individual with decimal encoding.
Parameters: - 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.
-
clone
()¶ Clone a new individual from current one.
-
decode
()¶ Decode gene sequence to decimal solution
-
encode
()¶ Encode solution to gene sequence
-
init
(chromsome=None, solution=None)¶ Initialize the individual by providing chromsome or solution.
Parameters: - chromsome (list of (float / int)) – chromesome sequence for the individual
- solution (list of float) – the variable vector of the target function.
Note
If both chromsome and solution are provided, only the chromsome would be used. If neither is provided, individual would be initialized randomly.