Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Every combination of a list of choices
Message
De
08/05/2007 14:22:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01223417
Message ID:
01223525
Vues:
18
>Hi!
>
>Say I've got a list of calls I want to make in a day.
>
>Say I have ten calls, I want to work out every combination of order of visits.
>
>Has anyone any ideas on how I would achieve this?
>
>Any help extremley appreciated

First of all, you should be aware that the number of permutations increases rapidly - even worse than an exponential function.

For 10 calls, you have 10! = 1 * 2 * 3 * ... * 10 = 3628800 permutations.

For 30 calls, the number of calls is 30! = 2.65253E+32.

What you describe, I think, is called the "travelling salesman problem", and you can search algorithms for that. AFAIK, no algorithm exists that is optimal (guaranteed to give the optimal result) and that also gets the work done, in a reasonable time, but I think algorithms exist if you assume the triangular inequality (which is a sensible assumption for travel - the asumption being that for any three points A, B, and C, distance AC <= distance AB + distance BC). Also, near-optimal algorithms exist.

You can find more details at http://en.wikipedia.org/wiki/Travelling_salesman_problem
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform