Can SUMO choose best paths for cars automatically? - simulation

how can I automatically select the best paths for a car in a manually created network in SUMO with edges and nodes.
I have created a network manually with 15 nodes
and Edges. The cars that I have drive simultaneously when departing. How can SUMO automatically choose the best paths for these cars.
I'm new to SUMO found something about "darouter" if that gets me to my goal.

It certainly depends on your definition of "best" but if you mean the path with the smallest travel time, then this is what sumo automatically does if you give it trips (only start and end edge) as input.

Related

Anylogic: How to get the distance of the route pedestrian choose

I am using the PedGoTo block in Anylogic pedestrian library to direct pedestrians to the nearest exit (TargetLine). But since there are walls between pedestrians and exits, I can't just calculate straight line distance. In PedGoTo Anylogic official reference guide, it says
In Reach target mode the path is automatically calculated by the library.
I wonder if there's a function to calculate this path like path = getPath(ped, targetLine), and I can get the distance of this route, like path.getDistance()?
Afaik there is no such method. The reason is that the Ped library constantly re-evaluates the path taken and adjusts it based on new conditions.
So if you want to compute the nearest exits, you have to do it manually. Easiest would be to use paths, as Jaco-Ben suggested.
However: This may not actually be a good idea, depending on your actual scenario. In reality, people also do NOT know the nearest exit, typically (unless it is trivial).
PS: Also check the example model on fire exit behavior
I don't think there is an API for the pedestrian library similar to what you have with the GIS map.
You can however record the distance as the pedestrian is traveling - and once you have these distances you can perhaps use them in a future scenario? You will need to manually record all the distances in a separate run and then store the values to be used in a next run.
Here is a simple examplke in case it helps you.
What I would do then is to run this for a number of locations that pedestrians will be at when they need to choose an exit. Store the final distance in a separate txt file with a starting location as the key... and then in the next run of your simulation, you use these distances as an approximation of the distance to the exits and let the pedestrain then decide where to go to based on their current location and shortest distance to the exist...
So for every agent, you find the nearest point you have a distance to exists for and then use that, plus the distance to the exists
This seems like a lot of work... but for now I don't see any other way. Would love to see if anyone gets a better solution!

Finding the shortest path in NetLogo

How to build a NetLogo agent who must try to find the shortest route between all of the given locations whilst also avoiding the given patches as those represent solid impassable objects.
If you google "shortest route algorithm" you'll find many, for example: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
But you have massively under-specified the problem you are trying to solve. You want a single agent to solve this? Why not a swarm or class of agents? If just one agent why are you using NetLogo as a tool? Are the agents smart? Do they get smarter over time? Can 3 agents work together on exploring the terrain? Does this have to get solved just once or many times?
How much information is available to the agent? The whole world? Just the nearest radius R? Does the agent know in advance what the "given locations" are and what the obstacles are? Does the order in which the given-locations are visited matter?
This could be the classic "travelling salesman" problem, having to visit each of N cities with costs of travel between each pair being given. See https://en.wikipedia.org/wiki/Travelling_salesman_problem
Can the agent find ANY route, and then keep trying to improve it? Or must it work on the first pass? What's the stopping condition? How do you know when the best route you've found is the best possible route?
You should also look at the A* algorithm. https://en.wikipedia.org/wiki/A*_search_algorithm
There's a huge amount of prior work done on solving this class of problem but they're mostly computational -- ie, your agent could simply sit and plug numbers into software and compute an answer and never move. I don't think that's what you had in mind. But what DID you have in mind?

simulation of creation of social network graph given present snapshot

I am using http://networkrepository.com/socfb-B-anon.php dataset for my analysis. I would like to do some analysis of how this present graph is formed from scratch. Is there any existing social network simulation framework for this kind of problem?
I am also open to use any other dataset if available. I would need the timestamp for every edge( nodes connected at).
The Barabási–Albert (BA) model describes a preferential attachment model for generating networks, or graphs. It iteratively builds a graph by adding new nodes and connecting them to previously added nodes. The new node is attached to some other nodes with a probability proportional to the degree of the old node with relation to the total number of edges in the graph.
This algorithm has been shown to produce graphs that are scale-free, which means the distribution of degrees follows a power law, which is a typical property of social networks.
This can be seen as a 'simulation' of a growing social network, where users are more likely to 'befriend' or 'follow' popular existing users. Of course it's not a complete simulation because it assumes a new user is done befriending or following other users right after they created an account, but it might be a good starting point for your exploration.
A timestamp for each edge or node creation can be generated by maintaining one during the creation process and increment it as you add more edges or nodes to the graph.
Hopefully this answer gives you enough terminology to further your research.

How to make Anylogic simulations run faster?

I have a model with agents: cars, passengers and petrol stations. The population size of the cars is 500 and there are 5 petrol stations. The passengers here are generated randomly and I have capped the passengers on the map to be at a maximum of 500 at any point in time (the limit here is set to be the same as the population size of the cars).
However, the simulation speed is running really slow (like 1-2s/sec) on virtual mode. Could this be due to the complicated model built or are there any ways on how we can speed up the running time of the simulation?
Many factors can slow your model, here are just some ideas:
Do you use Pedestrian agent types for your passengers? Try not to, unless ped dynamics are crucial
do you use conditional transitions? They are evualated at every event in the model and can slow it. You can always replace them with message-based transitions easily
Do you use the road traffic library? Again, only apply it if car dynamics are really necessary, else revert to the process library
Do you read/write a lot of data during the sim run to the dbase or an external file? Avoid that and do it at the start/end
Also, it could just be inefficient coding. You can check that using a Java profiler. Easiest is to use the one that comes with any Java JDK.
Good luck

iPhone network node library

I'm trying to find a library for iPhone app that can represent a network with an arbitrary number of nodes and distances between the nodes. I need to then calculate shortest path between the nodes. Does anyone know if such is available for objective-c or c++ in general that can be used in an iPhone app?
Thanks
If it's a simple enough network, you can just do a normal BFS (Breadth-First Search) or DFS (Depth-First Search) and compute all the possible paths. Then just select the fastest one. Remember, for graphs you have to store a list of nodes that you've already visited, otherwise you'll end up going in circles forever.