选择交易以最大化各种买/卖加权字段之间的所有权

时间:2013-08-21 01:31:07

标签: c++ trading

假设我有四个(或更多)项目:beer, cheese, milk, and honey

我可以将这些物品换成其他物品,每次损失百分比(由于努力)。如何选择最佳方法来最大化一个项目?

beer->cheese    :: buy: 10  sell: 1
beer->milk      :: buy: 5   sell: 9
beer->honey     :: buy: 4   sell: 8

cheese->beer    :: buy: 20  sell: 10
cheese->milk    :: buy: 1   sell: 15
cheese->honey   :: buy: 8   sell: 34

milk->beer      :: buy: 10  sell: 13
milk->cheese    :: buy: 7   sell: 3
milk->honey     :: buy: 8   sell: 3

honey->beer     :: buy: 110 sell: 1
honey->cheese   :: buy: 28  sell: 9
honey->milk     :: buy: 43  sell: 0.2

在这种情况下,我想获得最多的啤酒,因为我口渴,在另一天,我可能只想拥有一个最有价值的贸易链。我认为我可以通过查看我能够做的所有有利可图的交易,然后从那里进行分支来强制它。我只想做一次交易(例如,不能卖啤酒买牛奶来回买牛奶,虽然卖啤酒和买啤酒只要不是重复的交易类型就可以了)还有更好的方法吗?是否存在最大化价值或啤酒的一般方法?

0 个答案:

没有答案
相关问题