3 ms·
Brute force: for i in 1..99999999: if i == 66666654: print(i) break GA: for g in 1..100: pop, best = crosso
by nurettin 1y ago
Brute force:
for i in 1..99999999:
if i == 66666654:
print(i)
break
GA:
for g in 1..100:
pop, best = crossover(tournament(pop, heuristic_fn))
print(best.value)
if best.fitness < 0.01:
break
GA uses a heuristic to converge. If that is brute force, so is binary search.
- maleldil 1y ago> If that is brute force, so is binary search. Binary search is guaranteed to find the target if it exists, so it's not a heuristic. GA isn't, as it can get stuck in local minima. However, I agree that GA isn't brute force.
- nurettin 1y agoHeuristic just means there is a function telling you where to go. For A* it is the goal, for binary search it is lte, for geadient descent it is adam.