thesis version

This commit is contained in:
2021-05-10 18:14:24 +02:00
commit caf2a692f9
281 changed files with 73182 additions and 0 deletions

23
scripts/bench_hw Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
n=24
o=20
i=20
root=$(pwd)
source "${root}/scripts/common"
data=$(echo "${root}/data/${in}"|sed "s,^$(pwd)/,,")
cc_options+="-DDATA_FILE=\"${data}\" -DGRASP_N=${n} -DELS_ITER_MAX=${o} -DELS_GEN=${i}"
cc_options+=" -DSUBTIME"
${cc} ${cc_options} -o ${exe} -DFUNC=hw_seq_v ${sources}
./${exe} --seed "${seed}"
for scale in $(seq 2 2 32); do
${cc} ${cc_options} -DFUNC=hw_par_v -DPARLEV=2 -DNTHREADS=${scale} -o ${exe} ${sources}
./${exe} --seed "${seed}"
done
quit

21
scripts/bench_sk Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
n=24
o=20
i=20
root=$(pwd)
source "${root}/scripts/common"
data=$(echo "${root}/data/${in}"|sed "s,^$(pwd)/,,")
cc_options+="-DDATA_FILE=\"${data}\" -DGRASP_N=${n} -DELS_ITER_MAX=${o} -DELS_GEN=${i}"
${cc} ${cc_options} -o ${exe} -DFUNC=sk_seq ${sources}
./${exe} --seed "${seed}"
for scale in $(seq 2 2 4); do
${cc} ${cc_options} -DFUNC=sk_par_dynamicpool -DNTHREADS=${scale} -o ${exe} ${sources}
./${exe} --seed "${seed}"
done
quit

21
scripts/bench_sk_nr Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
n=24
o=20
i=20
root=$(pwd)
source "${root}/scripts/common"
data=$(echo "${root}/data/${in}"|sed "s,^$(pwd)/,,")
cc_options+="-DDATA_FILE=\"${data}\" -DGRASP_N=${n} -DELS_ITER_MAX=${o} -DELS_GEN=${i}"
${cc} ${cc_options} -o ${exe} -DFUNC=sk_nr_seq ${sources}
./${exe} --seed "${seed}"
for scale in $(seq 2 2 32); do
${cc} ${cc_options} -DFUNC=sk_nr_par -DNTHREADS=${scale} -o ${exe} ${sources}
./${exe} --seed "${seed}"
done
quit

20
scripts/common Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
cc=g++
# cc_options="-std=gnu++14 -pthread -ltbb -O2 -I${root}/src -I${root}/inc -DWITH_TBB"
cc_options="-std=gnu++14 -pthread -O2 -I${root}/src -I${root}/inc "
sources="${root}/src/tsp/*.cpp ${root}/bench/graspels/*.cpp"
exe=bench_graspels
quit() {
rm "${exe}"
exit 0
}
trap quit SIGINT
in="gr431"
in="dj38"
# in="qa194"
seed=std::mt19937::default_seed

59
scripts/common.py Normal file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import matplotlib.lines as lines
def set_size(width, fraction=1):
""" Set aesthetic figure dimensions to avoid scaling in latex.
Parameters
----------
width: float
Width in pts (\\the\\textwidth)
fraction: float
Fraction of the width which you wish the figure to occupy
Returns
-------
fig_dim: tuple
Dimensions of figure in inches
"""
# Width of figure
fig_width_pt = width * fraction
# Convert from pt to inches
inches_per_pt = 1 / 72.27
# Golden ratio to set aesthetic figure height
golden_ratio = (5 ** 0.5 - 1) / 2
# Figure width in inches
fig_width_in = fig_width_pt * inches_per_pt
# Figure height in inches
fig_height_in = fig_width_in * golden_ratio
return fig_width_in, fig_height_in
def config_plt():
plt.rc('font', size=11, family='Latin Modern Roman')
plt.rc('text', usetex=True)
plt.rc('xtick', labelsize=11)
plt.rc('ytick', labelsize=11)
plt.rc('axes', labelsize=11)
def get_colors(l, v):
color_palette = [
'#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd',
'#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf',
]
return color_palette[l.index(v)], '#888888'
def fix_log_rects(bar, e = 1e-4):
for rect in bar.patches:
if rect.get_y() == 0:
rect.set_y(e)
rect.set_height(rect.get_height() - e)

36
scripts/displaySolution Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
import sys
import fileinput
import matplotlib.pyplot as plt
import matplotlib.lines as lines
xs = []
ys = []
for line in fileinput.input():
xs.append(float(line.split(',')[0]))
ys.append(float(line.split(',')[1]))
if len(xs) == 0 or len(ys) == 0:
sys.exit(1)
xs.append(xs[0])
ys.append(ys[0])
####
lineList = []
it = 0
while it < len(xs)-1:
p = plt.plot(xs[it], ys[it], "o", color = "blue")
plt.annotate(it, (xs[it], ys[it]))
it = it+1
it = -1
while it < len(xs)-1:
plt.plot([xs[it], xs[it+1]], [ys[it], ys[it+1]], "k-")
it = it+1
plt.show()

29
scripts/test Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
n=24
o=20
i=20
root=$(pwd)
source "${root}/scripts/common"
data=$(echo "${root}/data/${in}"|sed "s,^$(pwd)/,,")
cc_options+="-DDATA_FILE=\"${data}\""
cc_options+=" -DSUBTIME"
# ${cc} ${cc_options} -o ${exe} -DFUNC=hw_seq_v ${sources}
# ./${exe}
# for scale in $(seq 2 2 32); do
# ${cc} ${cc_options} -DFUNC=hw_par_v -DGRASP_N=${n} -DELS_ITER_MAX=${o} -DELS_GEN=${i} -DPARLEV=1 -DNTHREADS=${scale} -o ${exe} ${sources}
# ./${exe}
# done
scale=4
for n in $(seq 6 2 24); do
${cc} ${cc_options} -DFUNC=hw_par_v -DGRASP_N=${n} -DELS_ITER_MAX=${o} -DELS_GEN=${i} -DPARLEV=1 -DNTHREADS=${scale} -o ${exe} ${sources}
./${exe}
done
quit