| New Reply |
Billing and Maths |
Share Thread | Thread Tools |
| Feb21-11, 08:35 AM | #1 |
|
|
Billing and Maths
Hi All,
I'm busy trying to write a 'smart' billing system, but I'm getting a bit stuck with some of the maths and thought that if someone else looked at what I'm doing you may see a much easier solution. Background: - First, just a little explanation of how it works. A person has an account that is part of a 'plan'. A plan is made up of zero or more plan items (or options in the plan), and each plan item can provide 0 or more resources. What that means is that if I have the following 3 resources I am selling: -
And in my plan I have the following plan items (options): -
So, for example if I had 2 .com domains, and 9 mailboxes, the optimal 'PlanItems' that I should have is:
Total: $21 Hope that makes sense. Ultimately a Plan would have hundreds of these options, with the options costing different amounts and providing differing number of resources. What it means is that I work with resources (they are the service I actually provide), but my customer is given the 'PlanItems' which can provide several resources. In actual fact, the 'smart' part of the billing is that the customer doesn't know about the planitems. They just buy another resource, and the billing system works out the best options for them. My Estimate function works like this: -
I had hoped that I could simply this to some equations, but for the life of me I can't figure anything that works. What I've had to do is write a recursive function that just tries every combination of planitem in varying amounts, returning the cheapest one. That works fine if I only have a few planitems to choose from, or if the total resources I want is fairly small. Should it get large, it gets messy. For example, with just 3 planitems to choose from, if I made a request of:
Then the recursive function will loop probably (1000/4)^3 (Divided by 4 as the .com and .net provide 4 mailbox resources each, so they should max at 1000/4 worst case scenario). Soooo, looking at just 3 plan items, with the above requested resources, I have the following formulas: -
So: a = x + 4z b = y + 4z c = z Thus my ultimate formula is: - ma + nb + oc = a + b + 1000c IE, what valus of m,n and o provide that solution. And somehow this needs to be weighted so that a and b are both the same weight, with c being 1/10th of the weight (the price). Is there a simpler way? Or is the only option to recursively test every option? If recursive tests are the only way then I'll just work on trying to optimize it further. Thanks, Brendan |
| Feb21-11, 08:27 PM | #2 |
|
|
Figured out a solution. The missing piece is that I can simply split the resources I want and work on them separately as long as I follow a golden rule: -
So, in my example I would do the following: -
|
| New Reply |
| Thread Tools | |
Similar Threads for: Billing and Maths
|
||||
| Thread | Forum | Replies | ||
| Trying to understand the stucture of Maths\Further Maths A level. | Academic Guidance | 7 | ||
| Double majoring in maths/econometrics or maths/statistics better for job prospects? | Academic Guidance | 4 | ||
| Do physicist uses pure maths or applied maths? | Academic Guidance | 13 | ||
| can students taking engineering maths cope with the physics maths? | General Math | 2 | ||