Algorithms suited for Traversing locations for optimized path - algorithm

I am developing an Application which will allocate Cabs to the Employees.The pickup location will be office location for everyone and Drop Location can be any location in the City.Which algorithm like BFS, DFS can i use which will give me the optimized path which will help me to optimize the cost Expenditure.
Any Suggestion is Welcome and highly appreciated

Problem, as stated, is too short of details to be given a specific answer. Some general pointers follow that may be helpful.
There is a class of problems within Vehicle Routing Problem literature that deals with pickup and delivery problems.
Within these problems, there are problems further classified based on whether or not there exist time windows for pickup and/or delivery.
None of the simple algorithms you have in mind BFS/DFS can give you an optimized solution since the Vehicle Routing Problem is rather difficult to solve practically. It is NP-Hard. The Travelling Salesman Problem is a special case of the Vehicle Routing Problem.

Related

What is a solution for a TSP with multiple salesmen and no return but known vertices and end points?

I don't know if I worded that correctly and I am not sure if it is even a TSP problem but here is the scenario.
I am designing and trying to optimize a route planner for a delivery service. I have multiple drivers (salesmen) who are all picking up packages at a central depot (origin) and delivering them on their way home. Their home locations (end-points) are known and all the delivery destinations (vertices) on the map are also known. After finishing the deliveries, the drivers go home instead of coming back to the depot.
What kind of problem is this and what sort of solutions should I be looking into? I have been treating it as a multi-TSP without return but still can't determine any near optimum tours. I have also tried shortest length Hamiltonian path but i'm quickly running into a bloc once i introduce a second driver.
Any resources, algorithms and heuristics suggestions are also welcome.
Geoffrey is right. It is a Vehicle Routing Problem. However, it is not the classical capacitated (CVRP) one with a single depot, since your drivers probably start and end at home rather than at the depot. Therefore your problem becomes a bit more difficult and turns to a pickup and delivery problem (VRPPD).
In short: if your drivers just start and end at the depot, it is a CVRP. If they start and end at home, it is a VRPPD.
For the CVRP you can find a number of open source algorithms for example OptaPlanner which is written in Java (Geoffrey knows more about it) or VRPH which is a C++ lib. When it comes to VRPPD the number of available open source algorithms shrink. Probably you can do it with OptaPlanner (I am not hundred percent sure). But you can surely solve it with jsprit which I implemented in Java.
If your problem is large and you need fast response times (computation times), you might be better off turning your VRPPD into CVRP by assuming drivers to ride from home to depot first and finally from depot to home again. But this way you ll certainly loose optimization potential.
This is called the Vehicle Routing Problem (VRP).
There are many resources available on that topic, such as video's (capacitated and/or time windows) and docs.
The VRP web offers a good explanation of the different variants.
This article seems to consider exactly the same problem as you want, and calls it: "K-vehicles Windy Rural Postman Problem".
Authors: Benavent, Corber, Sanchis and Plana.
A few articles like this one call the no return condition variant with one salesman Open VRP (OVRP).
Authors: D Aksen, Z Özyurt and N Aras2.
2013 paper on VRP without return: http://www.hindawi.com/journals/tswj/2013/874349/
Authors: Tantikorn Pichpibul Ruengsak Kawtummachai.

Course Scheduling Algorithms: why use of DFS or Graph coloring is not suggested?

I need to develop a Course Timetabling software which can allot timeslots and rooms efficiently. This is a curriculum based routine, not post-enrollment based. And efficiently means classes are assigned timeslots according to staff time preferences and also need to minimize 1st year-2nd year class overlap so that 2nd year students can retake the courses they've failed to pass.(and also for 3rd-4th yr pair).
Now, at first i thought that would be an easy problem, but now it seems different. Most of the papers i've looked on uses Genetic Algorithm/PSO/Simulated Annealing or these type of algorithm. And i'm still unable to interpret the problem to a GA problem.
what i'm confused about is why almost none of them suggests DFS or Graph-coloring algorithm?
Can someone explain the scenario if DFS/graph-coloring is used? Or why they aren't suggested or tried.
My experience with solving this problem for a complex department, is that the hard constraints (like no overlapping of courses that are taken by the same population, and hard constraints of the teachers) are rather easily solvable by exact methods. I modeled the problem with 0-1 integer linear programming, and solved it with a SAT-based tool called minisat+. Competitive commercial tools like cplex can also solve it.
So with today's tools there is no need to approximate as suggested above, even when the input is rather large.
Now, optimizing the solution is a different story. There can be many (weighted) objectives, and finding the solution that brings the objective to minimum is indeed very hard computationally (no tool that I tried can solve it within 24 hours), but they reach near optimum in a few hours (I know it is near optimum because I can compute the theoretical bound on the solution).
This document describes applying a GA approach to university time-tabling, so it should be directly applicable to your requirement: Using a GA to solve university time-tabling

Routing algorithm for multiple vehicles with multiple drops

I'm looking to find/create a routing algorithm that can be used to manage multiple vans performing deliveries as well as the loads of each of those vans.
Here's a rough specification of what I'm looking for..
The routes should be calculated in a fast and efficient manner
100+ vans / 1000+ packages / 1000+ dropoff points could be processed in one go
Each van could be a different size and have different weight restrictions
Each package could be a different size and weight
The packages should be organised onto the vans in a fair and economical manner, taking into account the routes, weight and size restrictions
The routes the vans should take should be economical and as short as possible (or a configurable balance between the two)
Vans could be limited to certain roads (low bridges, width, height and weight restrictions)
Some packages may be given timeslots for delivery
Has anyone seen this sort of thing before, and if so, any ideas as to what algorithm could be used to do this, or an example of how it could be done? I've seen a few university papers but they're quite old (probably fairly inefficient now) and don't handle the package management - they just presume all the vans and packages are the same size.
Any thoughts would be appreciated!
Rich
My impression is that this kind of problem routinely comes up in Operations Research, and the standard approach is to use a mixed integer programming solver. Here's an example of encoding a cargo shipping scheduling problem using MIP
Apparently 15 years of recent research in MIP made modern solvers 30,000 times faster than original ones.
If you want to make a solution from scratch, you could start by figuring out what your objective and constraints are, and then use some ideas from integer programming, like approximate branch-and-bound search.
pgRouting has a new function implementing a genetic algorithm for the Dial-a-Ride Problem: http://www.pgrouting.org/docs/1.x/darp.html
It's an extension of PostgreSQL/PostGIS and you can build an application with this. It also has functions for shortest path search, etc.
Any algorithm this specific is going to be proprietary and you will probably need to buy something. However, this sounds suspiciously like a problem that could be solved with a genetic algorithm implimentation. Here is some research I found:
http://www.ijimt.org/papers/38-M415.pdf
http://www.springerlink.com/content/w3165x33n24v8610/ (A book that looks like its focused on your problem)
http://www.computer.org/portal/web/csdl/doi/10.1109/ICCIT.2008.407
Just because an algorithm is old, doesn't mean its not efficient.

Resource scheduling problem

I'm developing a motorcycle hire website. The problem I have is how to solve the problem of assignment a guest to a motorcycle in an efficient way. I know how to do it in a "silly" way, but I want to know if there is a classical algorithm that solves this kind of problem. It's the same problem as the assignment of a guest to rooms in a hotel. In this last example, the goal is to achive maximum occupancy by never rejecting a reservation due to inefficient scheduling.
I'm pretty sure that this problem has to be a classic problem that has a known solution.
Thanks a lot.
What you're interested in is called Interval Scheduling. Assuming all reservations have the same weight (none are favored over any other), you'd want a greedy algorithm.
Here (pdf) are some good slides about the topic.
Basically, you want to schedule the earliest-ending reservations first.
This is Interval scheduling but it's an online algorithm. If you want to read further you can read here:
http://www-bcf.usc.edu/~dkempe/teaching/online.pdf

Which algorithm(s) can solve this constraint programming problem?

I need to solve a job affectation problem and I would like to find preferably efficient algorithms to solve this problem.
Let's say there are some workers that can do several kind of tasks. We also have a pool of tasks which must be done every week. Each task takes some time. Each task must be taken by someone. Each worker must work between N an P hours a week.
This first part of the problem seems to be a good candidate for a constraint programming algorithm.
But here is the complication: because a worker can do different tasks they may also have preferences (or wishes). If one want to satisfy all wishes for everyone there is no solution to the problem (too many constraints).
So I need an algorithm to solve this problem. I don't want to reinvent the wheel if the perfect wheel already exists.
The algorithm must be fair (if one can define this word) so for example I should be able to add a constraint like "try to satisfy at least one wish per people". I'm not sure that this problem can be solved by Constraint Hierarchies methods described here: Constraint Herarchies. In fact I'm not sure that "fairness" and wishes can be expressed by valid constraints for this category of algorithms.
Is there a constraint programming expert to give me some advices ? Do I need to develop a new wheel with some heuristics instead of using efficient CP algorithms ?
Thanks !
Your problem is complex enough that a general solution will probably require formulating as a linear-integer problem. If on the other hand you are able to relax certain requirements, you may be able to use a simpler approach. For example, bipartite matching would allow you to schedule multiple workers to multiple jobs, and can even handle preferences, but would not be able to enforce general 'fairness' constraints. See e.g. this related SO question. Vertex colouring has efficient algorithms for enforcing job separation constraints.
Other posters have mentioned simplex and job shop scheduling. Simplex is an optimisation algorithm - it traverses a solution space seeking to maximise some objective function. Formulating the objective function can certainly be done, but is non-trivial. Classical job shop scheduling, like bipartite matching, can model some aspects of your problem, but not all. There are no precedence constraints, for example. There are extended versions that can handle some constraints, for example placing time bounds on tasks.
If you're interested in existing implementations, the Python networkx library has an implementation of this matching algorithm. An example of an open source timetabling program that might be of interest is Tablix.
I've done timetabling, which can be considered a form of constraint programming. You have hard (inviolable) constraints and soft constraints (such as interval preferences).
Linear integer programming usually becomes useless after more than 30 variables, and this can also be said about simplex.
It was trough domain-specific optimizations of heuristic algorithms that a solution was found.
The heuristic algorithms used were simmulated annealing, genetic algorithms, metaheuristic algorithms and similar, but in the end the best result were provided by an "intelligent" domain customized greedy search algorithm.
Basically, you might get some decent results with one of the heuristics here, but the main problem is being able to discern when a problem is overconstrained.
A great open-source tool for research is the HeuristicLab.
I agree with what have been proposed here. However, MIP (Mixed Integer Programming problems) of very large size (far beyond 30 variables !) are practically solved nowadays thanks to commercial codes (Xpress, Cplex, Gurobi) or open-source (Coin-Or/Cbc). Furthermore, fancy modeling languages such as OPL Studio, GAMS, AMPL, Flop ... allow to write easily mathematic models instead of using APIs.
You can take advantage of NEOS server (http://neos.mcs.anl.gov/neos/solvers/index.html) to try very esaily different MIPs available. You send your model in AMPL format . Although AMPL comes as a free limited version, NEOS can handle unlimited instances.
Modeling languages exist also for CP (COMET / OPL Studio) and Local Search (COMET).
Feel free to get in touch with me through my web site www.rostudel.com ('contact' page)
David
This sounds like job shop scheduling.

Resources