We have a unique problem that not even large telecom carriers have solved yet. I am hoping I could get some insights from the community on potential solutions since it is probably a weighted distribution problem with matrix multiplication or something else. Either way, I think it is a math question and there is no better place to look for math related programming solutions than here. :) Thank you ahead of time!
We need a mapping algorithm that takes X number (lets say 500,000) of Customer Contact Records and figures out the best X number (lets say 1,000) of Virtual Phone Numbers to buy and assign to the contacts.
The assignment follows this order of priority: area code, zip code, city, state and country.
The customer contacts have numbers from all types of area codes. Mainly the quantities follow city population for the cities in or close to the area codes.
So, of the 500k contacts, usually no single area code has more than 10% representation. Normally its only about 1-4% of any customer list is in a single area code.
So, the challenge is to create an algorithm that looks at the frequency of area codes in the 500k list and chooses the 1k best area codes to buy virtual numbers in.
Here is where it gets hairy.
No virtual number can be assigned to more than 250 contacts in the same area code. So, the algo needs to tell us how many of each area code we need to buy numbers in.
Area code: 951 may have 600 contacts in it. In that case, we need to buy 3 numbers in that area code. That means 3 of the 1,000 are a single area code. That type of thing has to be calculated in the 1k virtual number buy recommendation algo.
If there is no geo match possible and all contacts are in the same country, the contact is assigned to a random virtual number.
So, we need a buy algo and a mapping algo.
To make things more complicated, if there is an existing mapping but user buys more numbers, we need to allow the user to remap all contact to virtual number relationships in a way that maps the closest geo relationships.
As always, if you need a bounty to provide me a solution, please let me know. I have always paid immediately in the past.