Rename get_first_random_solution function
This commit is contained in:
parent
2e12296f2c
commit
9aff3e3e06
|
@ -2,7 +2,7 @@ from numpy import put, sum, append, where, zeros
|
||||||
from numpy.random import choice, seed
|
from numpy.random import choice, seed
|
||||||
|
|
||||||
|
|
||||||
def get_first_random_solution(n, m):
|
def generate_first_solution(n, m):
|
||||||
seed(42)
|
seed(42)
|
||||||
solution = zeros(shape=n, dtype=bool)
|
solution = zeros(shape=n, dtype=bool)
|
||||||
random_indices = choice(n, size=m, replace=False)
|
random_indices = choice(n, size=m, replace=False)
|
||||||
|
@ -63,7 +63,7 @@ def explore_neighbourhood(element, data, max_iterations=100000):
|
||||||
|
|
||||||
|
|
||||||
def genetic_algorithm(n, m, data):
|
def genetic_algorithm(n, m, data):
|
||||||
first_solution = get_first_random_solution(n=n, m=m)
|
first_solution = generate_first_solution(n=n, m=m)
|
||||||
best_solution = explore_neighbourhood(
|
best_solution = explore_neighbourhood(
|
||||||
element=first_solution, data=data, max_iterations=100
|
element=first_solution, data=data, max_iterations=100
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue