<jupyter_start><jupyter_text>Generate traces using mobility models* Use **random waypoint** algorithm to generate random traces for $N$ users.* The random waypoint generator creates a random point for the $N$ users.* Iterating $C$ times this generator generates a trace of length $C$ for the $N$ users.<jupyter_code># Number of users
N = 2

# Length of traces
C = 1000

# Velocity (min, max)
V = (0.1, 0.3)

# Maximum wait time (staying at same point)
WT = 1
rw = random_waypoint(N, dimensions=(1, 1), velocity=V, wt_max=WT)
# rw = random_direction(N, dimensions=(1, 1), velocity=V, wt_max=WT)
# rw = random_walk(N, dimensions=(1, 1), velocity=0.05)
import itertools
import numpy as np

# trace = np.array(list(itertools.islice(rw, 1)))
traces = []
for i in range(C):
    traces.append(np.copy(next(rw)))

traces = np.array(traces)
traces = traces.swapaxes(0, 1)
print('Traces shape:', traces.shape)<jupyter_output>Traces shape: (2, 1000, 2)<jupyter_text>Plot trace of a user<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt

%matplotlib inline

user_trace = traces[1]

df_trace = pd.DataFrame(user_trace, columns=['x', 'y'])
ax = df_trace.plot.scatter(
    x='x',
    y='y',
    ylim=(0, 1),
    xlim=(0, 1),
    figsize=(12, 12),
    marker='x'
)

cycol = itertools.cycle('bgrcmk')

for i in range(C - 1):
    if all(user_trace[i] == user_trace[i + 1]):
        continue
    x1, y1 = user_trace[i]
    x2, y2 = user_trace[i + 1]

    color = next(cycol)
    ax.arrow(
        x1,
        y1,
        x2 - x1,
        y2 - y1,
        head_width=0.01,
        head_length=0.01,
        fc=color,
        ec=color
    )

plt.gca().set_aspect('equal', adjustable='box')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14469078179696615, 'fraction_numerical': 0.03267211201866978, 'mean_word_length': 3.6226415094339623, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '261369', 'license': 'MIT', 'n_tokens_mistral': 689, 'n_tokens_neox': 651, 'n_words': 176, 'path': '07-random-waypoint-simulator.ipynb', 'repo_name': 'leopiney/tscf', 'size': '1714'}