fix: Implemented Relative Mutation
This commit is contained in:
@@ -693,7 +693,7 @@ class Function:
|
|||||||
|
|
||||||
# Use mutation_strength
|
# Use mutation_strength
|
||||||
noise = np.random.normal(0, options.mutation_strength, mutation_size)
|
noise = np.random.normal(0, options.mutation_strength, mutation_size)
|
||||||
dst_solutions[idx_cross_end:idx_mut_end] = mutation_candidates + noise
|
dst_solutions[idx_cross_end:idx_mut_end] = mutation_candidates * (1.0 + noise)
|
||||||
|
|
||||||
# 4. New Randoms: Add new blood to prevent getting stuck
|
# 4. New Randoms: Add new blood to prevent getting stuck
|
||||||
dst_solutions[idx_mut_end:] = np.random.uniform(min_r, max_r, random_size)
|
dst_solutions[idx_mut_end:] = np.random.uniform(min_r, max_r, random_size)
|
||||||
@@ -805,7 +805,7 @@ class Function:
|
|||||||
noise_real = np.random.normal(0, options.mutation_strength, mutation_size)
|
noise_real = np.random.normal(0, options.mutation_strength, mutation_size)
|
||||||
noise_imag = np.random.normal(0, options.mutation_strength, mutation_size)
|
noise_imag = np.random.normal(0, options.mutation_strength, mutation_size)
|
||||||
|
|
||||||
dst_solutions[idx_cross_end:idx_mut_end] = (mut_candidates.real + noise_real) + 1j * (mut_candidates.imag + noise_imag)
|
dst_solutions[idx_cross_end:idx_mut_end] = (mut_candidates.real * (1.0 + noise_real)) + 1j * (mut_candidates.imag * (1.0 + noise_imag))
|
||||||
|
|
||||||
# 4. New Randoms: Add new blood to prevent getting stuck
|
# 4. New Randoms: Add new blood to prevent getting stuck
|
||||||
rand_real = np.random.uniform(min_r, max_r, random_size)
|
rand_real = np.random.uniform(min_r, max_r, random_size)
|
||||||
@@ -935,7 +935,7 @@ class Function:
|
|||||||
|
|
||||||
# Use mutation_strength
|
# Use mutation_strength
|
||||||
noise = cupy.random.normal(0, options.mutation_strength, mutation_size)
|
noise = cupy.random.normal(0, options.mutation_strength, mutation_size)
|
||||||
d_dst_solutions[idx_cross_end:idx_mut_end] = d_mutation_candidates + noise
|
d_dst_solutions[idx_cross_end:idx_mut_end] = d_mutation_candidates * (1.0 + noise)
|
||||||
|
|
||||||
# 4. New Randoms
|
# 4. New Randoms
|
||||||
d_dst_solutions[idx_mut_end:] = cupy.random.uniform(
|
d_dst_solutions[idx_mut_end:] = cupy.random.uniform(
|
||||||
@@ -1100,7 +1100,7 @@ class Function:
|
|||||||
noise_imag = cupy.random.normal(0, options.mutation_strength, mutation_size)
|
noise_imag = cupy.random.normal(0, options.mutation_strength, mutation_size)
|
||||||
|
|
||||||
# Apply Mutation: Scale Real/Imag independently to allow "rotation" off the line
|
# Apply Mutation: Scale Real/Imag independently to allow "rotation" off the line
|
||||||
d_dst_solutions[idx_cross_end:idx_mut_end] = (mut_candidates.real + noise_real) + 1j * (mut_candidates.imag + noise_imag)
|
d_dst_solutions[idx_cross_end:idx_mut_end] = (mut_candidates.real * (1.0 + noise_real)) + 1j * (mut_candidates.imag * (1.0 + noise_imag))
|
||||||
|
|
||||||
# 4. Random Injection: Fresh genetic material
|
# 4. Random Injection: Fresh genetic material
|
||||||
rand_real = cupy.random.uniform(min_r, max_r, random_size, dtype=cupy.float64)
|
rand_real = cupy.random.uniform(min_r, max_r, random_size, dtype=cupy.float64)
|
||||||
|
|||||||
Reference in New Issue
Block a user