Skip to content

Commit

Permalink
total_crossings modified to avoid n.lenght is not accessed randomly i…
Browse files Browse the repository at this point in the history
…n the first entry
  • Loading branch information
albertoamaduzzi committed Jun 17, 2024
1 parent cff76c3 commit 7bdb563
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ Telecom gives initial dataset day by day with a lot of fields and zipped. I have
##### COMMENT ON FUZZY ALGORITHM:
Needs to be tuned, try different `num_tm` (3 or 4 for Bologna depending on the day). Increasing the number does not uncover the slow mobility (walkers,bikers), but it finds subgroups on higher velocity group.
This bias is probably due to the sensitivity of the algorithm to the speed, giving more weight in for the separation for classes that have higher velocity.
# FOR DEVELOPERS
```std::vector<poly_base> poly``` is initialized with a null element in the position 0. Pay attention to that.
Or modify.

# LAUNCH ANALYSIS (WORK IN PROGRESS)

``` ./python/config_subnet_create.py ```
Expand All @@ -257,6 +261,7 @@ Output:
distribuzione lunghezze e tempi per ogni classe
fondamental diagram per ogni classe


#### POSTPROCESSING AGGREGATION PYTHON
COMMAND:
python3 fondamental_diagram_aggregated.py -c config_fundamental_diagram_aggregated.json
Expand Down
9 changes: 7 additions & 2 deletions source/data_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2548,11 +2548,16 @@ map<string, vector<int>> make_subnet(config &config_)
int total_crossings = 0;
for (const auto &n : poly)
{int LocalIter = 0;
if (n.flux.at(t)>0 && n.length>0)
int LocalLength = n.length; // TODO: Handle the fect that the first poly is Invalid.
if (n.flux.at(t)>0 && LocalLength>0)
{
total_crossings += n.flux.at(t) * n.length;
LocalIter++;
if (total_crossings < 0){std::cerr <<"total crossings < 0 at Iter: " << std::to_string(LocalIter); exit(1);}
if (total_crossings < 0)
{std::cerr <<"total crossings < 0 at Iter: " << std::to_string(LocalIter)<< std::endl;
std::cerr << "Length: " << std::to_string(LocalLength) << std::endl;
std::cerr << "Flux: " << std::to_string(n.flux.at(t)) << std::endl;
exit(1);}
}
}
std::cout << "Total crossings per meters: " << total_crossings << std::endl; // totale di metri percorsi dai flussi.
Expand Down
1 change: 1 addition & 0 deletions source/main_city-pro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ std::map<string, vector<int>> subnets;
std::map<int,std::map<int,double>> classes_flux;
// FCM

// NOTE: The first poly is an invalid one, pay attention
//-------------------------------------------------------------------------------------------------
void idle_cb(void*)
{
Expand Down

0 comments on commit 7bdb563

Please sign in to comment.