<jupyter_start><jupyter_text>1+1D ParametricThe potential $V(b, d_{\perp})$ is approximated by two 1D potentials:\begin{align}    V(b, d_{\perp}) &= \textrm{SF}(b) \cdot \max(0, 1 + a d_{\perp})\end{align}where $a$ is the `asymmetry` parameter of the `PedPedPotential2D` constructor.<jupyter_code>V = socialforce.potentials.PedPedPotential2D(asymmetry=-1.0)
with socialforce.show.canvas(figsize=(12, 6), ncols=2) as (ax1, ax2):
    socialforce.show.potential_2d(V, ax1)
    socialforce.show.potential_2d_grad(V, ax2)<jupyter_output><empty_output><jupyter_text>ScenariosHere we use a combination of synthetic {ref}`Circle and ParallelOvertake scenarios `.<jupyter_code>circle = socialforce.scenarios.Circle(ped_ped=V)
parallel = socialforce.scenarios.ParallelOvertake(ped_ped=V)
scenarios = circle.generate(5) + parallel.generate(5)
true_experience = socialforce.Trainer.scenes_to_experience(scenarios)<jupyter_output><empty_output><jupyter_text>MLPNext we create a model for pedestrian-pedestrian interaction that is the product of two 1D potentials: one potential as a function of $b$ and another as a function of perpendicular distance. The potential is initialized to randomweights and biases.\begin{align}    V(b, d_{\perp}) &= \textrm{MLP}_b(b) \cdot \textrm{MLP}_{\perp}(d_{\perp}) \;\;\; .\end{align}<jupyter_code>V = socialforce.potentials.PedPedPotentialMLP1p1D()
with socialforce.show.canvas(figsize=(12, 6), ncols=2) as (ax1, ax2):
    socialforce.show.potential_2d(V, ax1)
    socialforce.show.potential_2d_grad(V, ax2)<jupyter_output><empty_output><jupyter_text>InferenceNext, we use the standard SGD optimizer from PyTorch and train the ped-ped interaction model on the synthetic data created above.<jupyter_code>simulator = socialforce.Simulator(ped_ped=V) 
opt = torch.optim.SGD(V.parameters(), lr=1.0)
socialforce.Trainer(simulator, opt).loop(20, true_experience, log_interval=5)
with socialforce.show.canvas(figsize=(12, 6), ncols=2) as (ax1, ax2):
    socialforce.show.potential_2d(V, ax1)
    socialforce.show.potential_2d_grad(V, ax2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12805755395683452, 'fraction_numerical': 0.023501199040767386, 'mean_word_length': 6.901515151515151, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '409139', 'license': 'MIT', 'n_tokens_mistral': 771, 'n_tokens_neox': 729, 'n_words': 154, 'path': 'guide/pedped_1p1d.ipynb', 'repo_name': 'svenkreiss/socialforce', 'size': '2085'}