C# ordered combinations algorithm
I'm trying to develop a c# application that will generate a list of all possible permutations, within a limit, and cost. For example, I have a list of 80 jobs. Each job has a value (1-5) (typically 3) and each engineer has a limit of how much they can do, typically a value of 20.
At the moment I've started by producing a list of all possible combinations (n! / (k! * (n-k)! where n is the total number of jobs and k is 2). The link between each job should be weighted with the distance between each job.
From here I would like to pick an initial start job and produce a list of all possible combinations of jobs (from the start job) up to the limit of 20 and then ordered on the sum of the weight. The lowest weight route would win and be allocated to the engineer. My problem is that I don't know how to approach this - what data structure would be best?
Typically there are approx 6-8 engineers (depending on workload), I had planned on routing each engineer one at a time - once a route had been allocated to another engineer, those 开发者_如何学Gojobs would be removed from the list and a new start job selected with a new set of combinations generated. Does this sound like an acceptable approach?
Any assistance would be welcome.
I would try simulated annealing, an algorithm to find a global optimum by testing configurations randomly according to the energy of the system.
http://en.wikipedia.org/wiki/Simulated_annealing
Check the article for the pseudocode.
You could look at Microsoft Solver Foundation: http://msdn.microsoft.com/en-us/devlabs/hh145003.aspx
Also, look at Bart de Smet's Linq to Z3 if you are into Linq to Anything :) http://channel9.msdn.com/Shows/Going+Deep/Bart-De-Smet-LINQ-to-Z3
There is no efficient algorithm to solve this problem. I would use a genetic algorithm (does not necessarily find the optimal solution but finds an acceptable solution).
精彩评论