<jupyter_start><jupyter_text>Asteroid Route Optimization<jupyter_code>import sys
import os
import os.path
from glob import glob
import numpy as np
import pandas as pd
# print(sys.version)
pd.show_versions()
import matplotlib.pyplot as plt
import matplotlib
tex_fonts = {
    # Use LaTeX to write all text
    "text.usetex": True,
    "font.family": "serif",
    # Use 10pt font in plots, to match 10pt font in document
    "axes.labelsize": 9,
    "font.size": 8,
    # Make the legend/label fonts a little smaller
    "legend.fontsize": 6,
    "xtick.labelsize": 8,
    "ytick.labelsize": 8,
    # Use Type 1 fonts in plots.
    "pdf.fonttype": 42,
}
plt.rcParams.update(tex_fonts)
# Do not wrap long lines
np.set_printoptions(linewidth=np.nan)
from arp_vis import AsteroidRoutingProblem,plot_solution_to_pdf,get_fig_size
instance = AsteroidRoutingProblem(10, 73)
path = f"./results/m1-er0/arp_{instance.n}_{instance.seed}/"
file = "greedynn-euclidean.csv.xz"
pdf = f"img/sol_greedy_{instance.n}_{instance.seed}.pdf"
greedy = pd.read_csv(path + file).loc[0,'x']
greedy = np.fromstring(greedy, dtype=int, sep=' ')
print(greedy)
plot_solution_to_pdf(instance, greedy, title ="", pdf_file=pdf)
path = f"./results/m400-er1/arp_{instance.n}_{instance.seed}/"
file = "cego-greedy_euclidean.csv.xz"
pdf = f"img/sol_cego-greedy-er1_{instance.n}_{instance.seed}.pdf"
df = pd.read_csv(path + file)
sol = df.loc[df.Fitness.idxmin(),'x']
sol = np.fromstring(sol, dtype=int, sep=' ')
print(sol)
plot_solution_to_pdf(instance, sol, title="", pdf_file=pdf)
path = f"./results/m400-er0/arp_{instance.n}_{instance.seed}/"
file = "umm-greedy_euclidean.csv.xz"
pdf = f"img/sol_umm-greedy-er0_{instance.n}_{instance.seed}.pdf"
df = pd.read_csv(path + file)
sol = df.loc[df.Fitness.idxmin(),'x']
sol = np.fromstring(sol, dtype=int, sep=' ')
print(sol)
plot_solution_to_pdf(instance, sol, title="", pdf_file=pdf)<jupyter_output>[5.74569961e-17 2.80210587e+02 0.00000000e+00 2.86813872e+02 4.47923915e-17 2.69083574e+02 1.22613646e-17 4.60912609e+02 0.00000000e+00 3.50441077e+02 0.00000000e+00 2.00633852e+02 0.00000000e+00 4.00392126e+02 0.00000000e+00 2.91699767e+02 0.00000000e+00 4.45951443e+02 0.00000000e+00 5.05844061e+02]
0
8
Number of impulses: 2, Total cost: 43.457332 km / s
1
5
Number of impulses: 2, Total cost: 14.695049 km / s
2
3
Number of impulses: 2, Total cost: 63.805063 km / s
3
0
Number of impulses: 2, Total cost: 25.080785 km / s
4
4
Number of impulses: 2, Total cost: 25.729889 km / s
5
2
Number of impulses: 2, Total cost: 11.596637 km / s
6
9
Number of impulses: 2, Total cost: 20.045415 km / s
7
7
Number of impulses: 2, Total cost: 27.249223 km / s
8
6
Number of impulses: 2, Total cost: 21.551078 km / s
9
1
Number of impulses: 2, Total cost: 23.639640 km / s
{'fraction_non_alphanumeric': 0.13836705202312138, 'fraction_numerical': 0.12969653179190752, 'mean_word_length': 4.639511201629328, 'pattern_counts': {'":': 8, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 7, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '537147', 'license': 'MIT', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1091, 'n_words': 276, 'path': '4-visualize_sol.ipynb', 'repo_name': 'MLopez-Ibanez/AsteroidRoutingProblem', 'size': '2768'}