I need to exclude some roads from routing.
I solve this problem implementing it with EdgefFilter
Or Is it better to use Weeighting interface?
Thanks
Antonio
This example is documented in the weighting docs so Weighting is perfect. But it could be done with an EdgeFilter too, although the Weighting is more powerful and you could e.g. introduce a high penalty instead of 100% blocking.
Related
I was thinking that would be better to write on the "Application" layer (Business) the interfaces of the unit of work, and their implementations on the "Persistence" layer (DAL). The goal is to make the layers as much decoupled as possible.
Imagine the scenario where you decide to change DAL from EF core to Dapper. How this transition would be less painful? Isn' t better to have the interfaces pronouncing "I need this query, and this, and that, in order to work my business" and map it to the new Data Access Layer?
Your thoughts are correct and will put your business logic in focus and turn technical details into plug-ins to your business logic.
See also "Clean Architecture" by Robert C. Martin for even deeper thoughts into same direction.
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
I've read alot about flexible queries but unfortunatelly I couldn't find something satisfying yet.
I want the routing algorithm to ignore a street segmet, because its flooded or broken. Is that possible (maybe by putting geopoints into the GHRequest)? If it is, what is the best practice for the implementation?
update:
Do i need to create a custom Weighting and set the forbiddenEdges which i get out of OpenStreetMap.org?
Thanks for answers
Yes, a custom Weighting is currently necessary where you feed GraphHopper edgeIDs (!= OSM IDs). Get these edgeIDs via LocationIndex.findClosest.
Please create an issue if you want to have this via web API.
I am trying to develop a strategy game and i am thinking of creating the following game maps similar to below.
(source: totaldiplomacy.com)
(source: teamteabag.com)
How do i go about doing it and what kind of software to use of books/ tutorials to follow?
Thanks
Assuming that you can draw the graphics that you need, the rest is accomplished by defining the "territories".
A territory will have
a name
a location (just a simple position would probably suffice, one for each place where you want to draw the key bits of information)
a list of neighboring territories
any other game-relevant information, such as what units are there, what resources it provides, etc.
The "hard" bit may be generating the connectivity graph. It's probably easiest to refer to each of your territories by number, as in your second image. Then, the "list of neighboring territories" for territory 14 would be 13, 15, and 23. So don't try to do this automatically, it'll be much easier (as long as the scope doesn't grow too large) to just define this manually.
In the general case, ignoring language and framework, you want to have two things:
a model, which in both those examples would store all the domains, armies, etc.
a map view, which in the simple case is an image file of some kind with some kind of tagging to indicate which bits of the model go where.
If you're looking to program games, I would recommend the XNA framework. There is alot of good resources for new programmers, head over to http://msdn.microsoft.com/en-us/library/bb203893%28v=XNAGameStudio.40%29.aspx to get started on your first game!
A coworker of mine has asked me for a term (preferably an adjective) that can be used to describe a system that gets more "intelligent" as it gets more data. The example she used when asking me this question was "as Google crawls more sites, it gets smarter at searching".
Personally, the best I could think of offhand was "adaptive", but that doesn't feel right. Can anyone suggest something better?
Thanks!
Sometimes you refer to things like spam filters as "trainable". Perhaps that could apply here.
It could be a vague description of an expert system, which often have a learning aspect and use it to gain more "expertise" in their problem domain.
The domain of this kind of applications is "machine-learning". But I'm not aware of a matching adjective.
The example she used when asking me this question was "as Google crawls more sites, it gets smarter at searching".
Unlike learning algorithms, where the algorithm itself changes based on past success, Google searches get better due to improved ranking of the results bringing the best pages to the top. The quality of the PageRank algorithm's results increases due to the network effect of the input data - the more connections, the better the chance that the best connected page is the most relevant.
The rule that says the effect of a network is super-linear is Metcalfe's Law, so if the "smartness" of an algorithm relies on network effects you could call the algorithm "Metcalfian". I've no idea whether the quality of PageRank results is super-linear in the number of inputs though; if anything I'd expect it to be sub-linear, as once you have enough links in the network to get rid of noise the rankings should be stable.
What about the term "evolve" or "evolving."
How about "capable," or "robust."
Learning Artificial Intelligent software.
Skynet or Joshua/W.O.P.R.
I would call it Heuristic.
If it's a communications network, then it follows Metcalfe's law. You could call it Metcalfian. (You'd like be laughed at.)
I think the term is adaptive associative memory systems (leading to autonomy, perhaps).
Is there a way using the Google Maps API to get back an "optimized" route given a set of waypoints (in other words, a "good-enough" solution to the traveling salesman problem), or does it always return the route with the points in the specified order?
There is an option in Google Maps API DirectionsRequest called optimizeWaypoints, which should do what you want. This can only handle up to 8 waypoints, though.
Alternatively, there is an open source (MIT license) library that you can use with the Google Maps API to get an optimal (up to 15 locations) or pretty close to optimal (up to 100 locations) route.
See http://code.google.com/p/google-maps-tsp-solver/
You can see the library in action at www.optimap.net
It always gives them in order.
So I think you'd have to find the distance (or time) between each pair of points, one at a time, then solve the traveling salesman problem yourself. Maybe you could convince Google Maps to add that feature though. I guess what constitutes a "good enough" solution depends on what you're doing and how fast it needs to be.
Google has a ready solution for Travel Salesman Problem. It is OR-Tools (Google's Operations Research tools) that you can find here: https://developers.google.com/optimization/routing/tsp
What you need to do basically is 2 things:
Get the distances between each two points using Google Maps API: https://developers.google.com/maps/documentation/distance-matrix/start
Then you will feed the distances in an array to the OR-Tools and it will find a very-good solution for you (For certain instances with millions of nodes, solutions have been found guaranteed to be within 1% of an optimal tour).
You can also note that:
In addition to finding solutions to the classical Traveling Salesman
Problem, OR-Tools also provides methods for more general types of
TSPs, including the following:
Asymmetric cost problems — The traditional TSP is symmetric: the distance from point A to point B equals the distance from point B to
point A. However, the cost of shipping items from point A to point B
might not equal the cost of shipping them from point B to point A.
OR-Tools can also handle problems that have asymmetric costs.
Prize-collecting TSPs, where benefits accrue from visiting nodes
TSP with time windows
Additional links:
OR-tools at Github: https://github.com/google/or-tools
Get Started: https://developers.google.com/optimization/introduction/get_started
In a typical TSP problem, the assumption is one can travel directly between any two points. For surface roads, this is never the case. When Google calculates a route between two points, it does a heuristic spanning tree optimization, and usually comes up with a fairly close to optimal path.
To calculate a TSP route, one would first have to ask Google to calculate the pair-wise distance between every node in the graph. I think this requires n*(n-1) / 2 calcs. One could then take those distances and perform a TSP optimization on them.
OpenStreetMaps.org has a Java WebStart application which may do what you want. Of course the calculations are being run client side. The project is open source, and may be worth a look.
Are you trying to find an optimal straight line path between locations, or the optimal driving route? If you just want to order the points, if you can get the GPS coordinates, it becomes a very easy problem.
Just found http://gebweb.net/optimap/ It looks nice and easy. Online version using google maps.