diff --git a/Overview_Formulas_Variables.md b/Overview_Formulas_Variables.md index 017077f..2c07f76 100644 --- a/Overview_Formulas_Variables.md +++ b/Overview_Formulas_Variables.md @@ -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)} $$ -> **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 diff --git a/forces.cpp b/forces.cpp index 5911909..0e4b548 100644 --- a/forces.cpp +++ b/forces.cpp @@ -72,7 +72,7 @@ void compute_repulsive_effects_from_pedestrians(Pedestrian *pedestrians, Pedestr } // # 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) { 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); // # 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); } } diff --git a/main b/main index 6df5076..8c5c77c 100755 Binary files a/main and b/main differ diff --git a/main.cpp b/main.cpp index 295c668..05dc0f3 100644 --- a/main.cpp +++ b/main.cpp @@ -56,7 +56,7 @@ int main(int argc, const char *argv[]) { // # Start here or right after function signature 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++) { // Pass1: conmpute all forces from the current state for (int i = 0; i < n_p; i++) { @@ -71,7 +71,7 @@ int main(int argc, const char *argv[]) { // # 55N - 55 flops compute_repulsive_effects_from_pedestrians(pedestrians, &p, n_p); - // # 144 flops + // # 192 flops compute_repulsive_effects_from_borders(board, &p); } // 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(); } } - 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; std::cout << " flops\n";