搜索最适合的价格为多个客户 [英] Searching for the best fit price for multiple customers

查看:173
本文介绍了搜索最适合的价格为多个客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的重述<一href="http://stackoverflow.com/questions/19204835/comparing-multiple-price-options-for-many-customers-algorithmically/19455882#19455882">Comparing为众多客户提供多种价格选择算法的没有几乎一样多克鲁夫特。

A restatement of Comparing multiple price options for many customers algorithmically without nearly as much cruft.

我们有百万客户。 货物为他们每个人的销售成本可以pssed为价格A或价B EX $ P $。

We have 1,000,000 customers. The cost of goods sold for each of them can be expressed as price A or price B.

价格A&LT;&LT;价B

Price A << Price B.

价格A和价B不是线性对方。在某些情况下,B是昂贵的2倍,在一些它是100倍。

Price A and Price B are not linear to each other. In some cases B is 2 times as expensive, in some it is 100 times.

所有的客户以成本为

min( (sum(A)/count(A)) , 100 ) * count(A)

实际上,所有的客户的A上的平均成本将四舍五入至100,如果它小于100

Effectively, the average cost of all the customers on A will be rounded up to 100 if it is less than 100.

有没有这样的限制,基于B。

There is no such restriction on B.

我想花最少的钱,自己的商品。

I would like to spend the least amount of money on their goods.

我如何最大限度地

cost=min( (sum(A)/count(A)) , 100 ) * count(A) + sum(B)

我一直看到这是一个双背包问题的一种形式,但我不能得到它的权利......

I keep seeing this as a form of a dual knapsack problem, but I can't get it right ...

我会很可能解决这个Python中,最有可能的,但我怀疑,问题太多。

I'd be probably solving this in Python, most likely, although I doubt that matters much.

我通过分配分数基于该XYZ和过滤做人工分析,我想了解更多的计算解决方案。

I've done manual analyses by assigning scores to x y z and filtering based upon that, I'm interested in more of a computational solution.

任何方法来推荐?

推荐答案

每个客户可以分配到A侧或B侧。如果我递给你最佳的解决方案,你会发现,你不能改变任何单一客户的分配改进。鉴于此,有两种情况来检查,如果我能忽略的临界情况:

Each customer can be assigned to the A side or the B side. If I handed you the best possible solution you would find that you could not improve it by changing the assignment of any single customer. Given this, there are two cases to check, if I can ignore a borderline case:

1)的最佳解决方案的A面客户的平均成本至少是100,所以最低价格不生效。如果我转一个客户从A到B,反之亦然的差别A和成本变化乙的价格为客户。因为我有一个完美的解决方案,每个客户必须分配给任何A的或B的成本较少,而你的情况是指每个人都到了。

1) In the best solution the average cost of the A side customers is at least 100, so the minimum price does not come into effect. If I switch a customer from A to B or vice versa the cost changes by the difference in A and B prices for that customer. Since I have a perfect solution, each customer must be assigned to whichever of A or B cost is less, which in your case means that everybody goes to A.

2)每位客户的最低收费100是在对一个副作用,因此改变从A和客户B或反之亦然达向他们收取的100成本答:由于我有一个完美的解决方案,为客户在A面必须是其乙的价格至少是100的客户,和客户B面必须是那些乙的价格是100或更少。

2) The minimum 100 charge per customer is in effect on the A side, so changing a customer from A and B or vice versa amounts to charging them a cost of 100 for A. Since I have a perfect solution, the customers on the A side must be the customers whose B prices are at least 100, and the customers on the B side must be those whose B prices are 100 or less.

在这里,唯一的缺点是,如果切换客户意味着100最低生效或停止开始生效。在情况(1),如果有人切换到B的价格会提高,即使没有最低进入为A的价格的效果,所以这是不可能发生的。在情况(2)如果B侧的客户切换到A这只能使事情变得更糟,因为他们B的价格为100或更少,以便他们的一口价必须小于或等于100。一个顾客必须具有100或更大的乙价格。如果他们的一口价是100或更多,他们一定要留在A作为其移动到B不能让最小值,成本停止申请。如果他们的一口价为&lt; 100,你少付随着客户的真实一口价,但你还是要至少100 A和B的价格,而不是因此有什么可以在这里获得了他们移动到B站的最低的价格踢的话无论是。

The only catch here is if switching a customer means that the 100 minimum comes into effect or stops coming into effect. In case (1) if somebody switched to B the price would increase even without the minimum coming into effect for the A prices, so this cannot happen. In case(2) if a B side customer switched to A this could only make things worse, since their B prices was 100 or less so their A price must be 100 or less. An A customer must have a B price of 100 or more. If their A price is 100 or more they should definitely stay on A as moving them to B cannot make the minimum A cost stop applying. If their A price is < 100 and moving them to B stops the minimum A price from kicking in then you pay less for As of the true A price of that customer but you still have to pay a B price of at least 100 instead so there is nothing to be gained here either.

所以,我认为你的工作的两种可能性的成本 - 案例1中可以分配给所有A和案例2中,您分配东西A,其中的B价格在100以上。之所以选择任何这些作品了最便宜的。

So I think you work out the cost of two possibilities - case 1 is where you assign everything to A and case 2 is where you assign stuff to A where the B price is 100 or more. Chose whichever of these works out cheapest.

这篇关于搜索最适合的价格为多个客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆