Choose pseudorandom first solution in local search

This commit is contained in:
coolneng 2021-04-12 12:03:11 +02:00
parent 27df20f7d1
commit f73e28fb8a
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,7 @@
from preprocessing import parse_file
from pandas import DataFrame
from sys import argv
from random import seed, randint
def get_first_solution(n, data):
@ -44,9 +45,19 @@ def greedy_algorithm(n, m, data):
return solutions
def get_pseudorandom_solution(n, data):
seed(42)
return data.iloc[randint(a=0, b=n)]
# NOTE In each step, switch to the element that gives the least amount
def local_search(n, m, data):
pass
solutions = DataFrame(columns=["point", "distance"])
first_solution = get_pseudorandom_solution(n=n, data=data)
solutions = solutions.append(first_solution, ignore_index=True)
for _ in range(m):
pass
return solutions
def execute_algorithm(choice, n, m, data):