minor fixes

This commit is contained in:
lbaumberger
2026-04-26 20:01:14 +02:00
parent 2ca70ae7fa
commit b2b5f9f863
4 changed files with 13 additions and 6 deletions
+2 -1
View File
@@ -130,7 +130,8 @@ F_{\alpha B} = w(e_\alpha,\; -f_{\alpha B}) \cdot f_{\alpha B}
\qquad \text{(team convention; not explicit in paper)} \qquad \text{(team convention; not explicit in paper)}
$$ $$
> **Note:** Paper Eq. 8 only defines $w$ weighting for ped–ped $F_{\alpha\beta}$; applying it to border $F_{\alpha B}$ is our extension. > **Note:** Paper Eq. 8 only defines $w$ weighting for ped–ped $F_{\alpha\beta}$; applying it to border $F_{\alpha B}$ is our extension. (Reason see page 6, top: "However, the formulas above for attractive and repulsive effects only hold for situations that are perceived in the desired direction e_alpha(t) of motion.")
### 2.8 Total force — Eq. 9 (p. 6), no attractors (Eq. 6) / fluctuations ### 2.8 Total force — Eq. 9 (p. 6), no attractors (Eq. 6) / fluctuations
+8 -2
View File
@@ -72,7 +72,7 @@ void compute_repulsive_effects_from_pedestrians(Pedestrian *pedestrians, Pedestr
} }
// # Assume that the four borders are also 4 obstacles // # Assume that the four borders are also 4 obstacles
// # 36 n_obstacles flops = 144 flops // # 48 n_obstacles flops = 192 flops
void compute_repulsive_effects_from_borders(Board &board, Pedestrian *p) { void compute_repulsive_effects_from_borders(Board &board, Pedestrian *p) {
Obstacle *obstacles = board.obstacles; Obstacle *obstacles = board.obstacles;
@@ -89,6 +89,12 @@ void compute_repulsive_effects_from_borders(Board &board, Pedestrian *p) {
Vector2d f_obst = (r_aB / r_aB.norm()) * (U0_AB / R) * std::exp(-r_aB.norm() / R); Vector2d f_obst = (r_aB / r_aB.norm()) * (U0_AB / R) * std::exp(-r_aB.norm() / R);
// # 2 ADDs // # 2 ADDs
p->f_i += f_obst; // p->f_i += f_obst; //commented since this version dont takes the field of view / angle to the border into account
// I have read the paper again and on page 6 they say
// However, the formulas above for attractive and repulsive effects only hold for situations that are perceived in the desired direction e_alpha(t) of motion.
// I assumed that with formulas above its also meant for equation 8 (even though not explicitly mentioned their)
// # 14 flops: 9 MULTs, 4 ADDS, 1 SQRT
p->f_i += f_obst * w(p->e, f_obst * -1);
} }
} }
BIN
View File
Binary file not shown.
+3 -3
View File
@@ -56,7 +56,7 @@ int main(int argc, const char *argv[]) {
// # Start here or right after function signature // # Start here or right after function signature
uint64_t start = start_tsc(); uint64_t start = start_tsc();
// # (8 + 55N - 55 + 144 + 4 + 8 + 4 + 10)*n_p*n_iter // # (8 + 55N - 55 + 192 + 4 + 8 + 4 + 10)*n_p*n_iter
for (int t = 0; t < n_iter; t++) { for (int t = 0; t < n_iter; t++) {
// Pass1: conmpute all forces from the current state // Pass1: conmpute all forces from the current state
for (int i = 0; i < n_p; i++) { for (int i = 0; i < n_p; i++) {
@@ -71,7 +71,7 @@ int main(int argc, const char *argv[]) {
// # 55N - 55 flops // # 55N - 55 flops
compute_repulsive_effects_from_pedestrians(pedestrians, &p, n_p); compute_repulsive_effects_from_pedestrians(pedestrians, &p, n_p);
// # 144 flops // # 192 flops
compute_repulsive_effects_from_borders(board, &p); compute_repulsive_effects_from_borders(board, &p);
} }
// Pass2: integrate the forces and update the current state // Pass2: integrate the forces and update the current state
@@ -92,7 +92,7 @@ int main(int argc, const char *argv[]) {
p.e = (p.destination - p.curr_pos) / (p.destination - p.curr_pos).norm(); p.e = (p.destination - p.curr_pos) / (p.destination - p.curr_pos).norm();
} }
} }
long long W = (long long)(8 + 55 * n_p - 55 + 144 + 4 + 8 + 4 + 10) * n_p * n_iter; long long W = (long long)(8 + 55 * n_p - 55 + 192 + 4 + 8 + 4 + 10) * n_p * n_iter;
std::cout << "W(n): "; std::cout << "W(n): ";
std::cout << W; std::cout << W;
std::cout << " flops\n"; std::cout << " flops\n";