Commit 67fd64c7 by Matthew Maat

### All programs and files for my bachelor's thesis.

parents
.idea/vcs.xml 0 → 100644
 \ No newline at end of file
compare_area.py 0 → 100644
 from greedy_algorithm import * #### File to investigate average/minimum area ONLYPLOT=True #True to only load a data file and plot graphs, False to also run a simulation def minzsort(F): for i in range(len(F) - 1): for j in range(len(F) - 1): if F[j][0] > F[j + 1][0]: F[j], F[j + 1] = F[j + 1], F[j] return def find_average_and_minimum(N,n,ind,compare_opt): minimumareas = [[(1.0,[(0, 0) for k in range(10)]) for i in range(10)] for j in range(10)] ##0:norm 1, 1:norm 2, 2:norm inf, 3:invnorm -2,4:invnorm -1, 5:invnorm 0,6:invnorm 2 7:euclidean 8:largest non-dominated rectangle toptenarea = [1.0 for i in range(10)] allsets=[] totals=[0.0 for i in range(10)] squarez=[0.0 for i in range(10)] start=time() for ii in range(n): S = generate_points(N) sorted_x = sort_by_x(S) #Opt = optimum_algorithm(S)[0] resultz=[0,0,0,0,0,0,0,0,0,0] resultz[0]=greedy_algorithm2(sort_by_norm(S, 1)[::-1], sorted_x)[0] resultz[1] = greedy_algorithm2(sort_by_norm(S, 2)[::-1], sorted_x)[0] resultz[2] = greedy_algorithm2(sort_by_norm(S, math.inf)[::-1], sorted_x)[0] resultz[3] = greedy_algorithm2(sort_by_inverse_norm(S, -2)[::-1], sorted_x)[0] resultz[4] = greedy_algorithm2(sort_by_inverse_norm(S, -1)[::-1], sorted_x)[0] resultz[5] = greedy_algorithm2(sort_by_inverse_norm(S, 0)[::-1], sorted_x)[0] resultz[6] = greedy_algorithm2(sort_by_inverse_norm(S, 2)[::-1], sorted_x)[0] resultz[7] = extended_greedy_algorithm(S, sorted_x,0)[0] resultz[8] = extended_greedy_algorithm(S, sorted_x,1)[0] resultz[9] = extended_greedy_algorithm(S, sorted_x, 2)[0] if compare_opt: optarea=optimum_algorithm(S)[0] resultz=[resultz[jj]/optarea for jj in range(10)] for i in range(10): totals[i]+=resultz[i] squarez[i]+=pow(resultz[i],2) if resultz[i]