How Traditional Algorithms Work in Sales Reconciliation Planning




This article shares a usage scenario of a "traditional machine learning algorithm" in actual business.


foreword

If you find it troublesome, you can skip to the main topic and watch~

Whether it's the conversations at work or the news on the daily swiping screen recently, large models are overwhelming. I couldn't understand it anyway, and after a lot of effort, I finally saw two words between the words, metaphysics. It's like going back to my student days.

I still remember that when I first entered the graduate laboratory 6 years ago, my senior said to me excitedly: Young man, welcome to our world of cultivating immortals! ——At that time, the school cooperated with Nvidia and just obtained 500 Tesla graphics cards from Nvidia for application by various laboratories. This is our brand new alchemy furnace. After 3 years of postgraduate career, my understanding of deep learning is only to the extent that I can use deep learning models. There were also some small achievements during the period, including a CCF class B conference paper and a KBS journal ( impact factor 8.038 ). The content of the article is mainly to use LSTM to model user interest preferences and user interest migration, so as to build a recommendation algorithm model .

Through the stacking of various neural network models and repeated comparative experiments, we have indeed found that the LSTM model can have a relatively prominent effect on indicators such as accuracy and recall. But one big question stood in my way: how do I explain it? Indeed, we cannot explain it from an intuitive and qualitative perspective, nor can it be explained by mathematical logic. Simply, we applied everyone's unified caliber at that time, explaining that LSTM has long and short-term memory capabilities, so it can summarize data laws that change with the time axis. Fortunately, the reviewers at that time did not question our explanation, and it may not be just me, but everyone's papers did not explain it well.

Whether it is simple models such as FC, CNN, RNN, LSTM, or the most popular so-called large-model-dependent Transformer model, they are all trained based on gradient descent and backpropagation. As for why such training can make the model The parameters in the middle are automatically self-consistent, and no one has been able to prove it until now. We just know that structuring the model like this does work.

On the contrary, many traditional machine learning algorithms either have strict mathematical proofs, or the process of the algorithm can be observed intuitively. Compared with deep learning models, I think the predecessors who can propose these traditional machine learning algorithms are more admirable. Therefore, this article is mainly to simply share a so-called "traditional machine learning algorithm" usage scenario in actual business. Of course, I declare again that my understanding of deep learning is still shallow, and if there are inappropriate expressions, I can communicate with each other.


topic

In the planning domain, there are many interesting problems to be solved, including how to make medium and long-term procurement plans? How to develop a short-term replenishment plan? What should I do if the warehouse inventory is biased, how to balance it, and whether it needs to be transferred? Can I predict how much a certain product will sell in the future? Solving each problem can add enormous value to the efficiency and profit and loss of the supply chain.

Then let's take the allocation plan as an example to see how these algorithms solve this problem elegantly—the algorithms mentioned here are all traditional machine learning algorithms.

▐Model definition: how to define a transfer business with a mathematical model, and turn the business goal into a model goal function  


In order to reduce the complexity of the problem and make it easier for everyone to understand, here we have simplified the definition of the problem to a certain extent, such as not considering the possible fluctuations in future sales, the loss of sales opportunities caused by partial warehouses, and the probability of damage to goods during transportation, etc. wait. Moreover, the following case only gives one transfer-out warehouse and one transfer-in warehouse. In actual business, the problems are more complex, and there are more definition constraints, and the model to be solved may be different. Algorithm bosses lightly spray~

  • Pre-knowledge


Partial position: There is an imbalance in the distribution of various warehouses across the country in the warehouse. The criterion for judging whether it is balanced is whether the potential purchase volume within the coverage of the warehouse matches the existing inventory in the warehouse
Allocation: transfer the goods from warehouse A to warehouse B
Delivery: out of warehouse + transportation + terminal delivery to consumers
Cross-regional delivery: The warehouse in the consumer's area is out of stock and needs to be exchanged to deliver to the consumer from warehouses in other regions


  • business analysis


  1. 当在仓库存偏仓的时候,会造成跨区发货,跨区发货的快递成本比非跨区发货高
  2. 如果能提前通过集中调拨的方式将货物配平(即批量的将货物先配送到用户所在的地区的仓),且满足:单件集中调拨成本+单件发货成本 < 单件跨区发货成本
  3. 仓库的出库能力、收货能力、干线运输能力有上限限制
  4. 调出仓需要优先满足本仓覆盖范围内的潜在消费者

  • 建模



业务目标:我们要最小化货物从仓库到消费者手中的物流成本
成本函数:发货成本

  1. 假设有N个货品货品

  2. 调出仓A

  3. 调入仓B

  4. 约束1:对任意一个货品,从A仓调出量小于A仓库存-A仓自身需求量,即,其中表示货品从A仓的调出至B仓的量。表示货品在A仓的库存,在仓库A覆盖范围内的预计售卖量表示货品

  5. 约束2:对任意一个货品,调入B仓的量小于B仓覆盖范围内的预计售卖量-B仓已有的在仓库存,即,字符含义同上。

  6. 约束3:一次调拨的量,要小于A仓到B仓的干线运输能力,即 ,其中 是一个常量,表示最大的干线运输能力
  7. 目标函数:

    其中是个常量,表示货品通过跨区发货到消费者手中的发货成本,是个常量,表示货品从A仓调拨到B仓的调拨成本,表示提前将货品从A仓调拨到B仓,避免跨区发货而节省的成本。因此,我们要「最小化货物从仓库到消费者手中的物流成本」,即,最大化节省的金额


宗上所述,模型定义如下:

到这里,整个建模过程就结束了。实际上我们忽略了很多细节,但是并不影响我们理解这个调拨模型。至于模型怎么求得每一个调拨量 以保证最大化收益,就要对这个模型进行求解了。

  模型求解:怎么才能算出目标函数最优时的参数解


  • 明确求解目标


既然要求解,我们就要明确到底要求解什么?即,在上面定义的数学模型中要明确哪些是常量哪些是变量。

很明显,我们需要求解的变量是 ,即每个货品需要从A仓调拨多少件到B仓。这 里为了方便解释,我们就假设一共就两个货品 ,相应的我们需要求解的变量就

  • 求解算法



根据约束条件看,解空间就在坐标轴圈定的阴影范围内。实际上,最简单的求解方法就是暴力枚举所有可能的结果,然后求出函数值最大时对应的参数即可。


当然了,现实的问题中求解的参数量一定是远远大于2个的,因此参数求解的时间复杂度呈指数级上升,以当前的算力,可能直到生命的尽头可能都得不到答案。生命是宝贵的,对于这种问题,有没有快速的解法呢?有,这里我们就要引出一个算法概念——启发式搜索算法,这是一种算法理念的统称,具体的实现有很多种,比如模拟退火算法、遗传算法、蚁群算法等。宗旨就是在有限的时间内,得到一个近似的最优解。


这里以遗传算法为例,我们来学习它的求解过程:

遗传算法(Genetic Algorithm)遵循『适者生存』、『优胜劣汰』的原则,是一类借鉴生物界自然选择和自然遗传机制的随机化搜索算法。遗传算法模拟一个人工种群的进化过程,通过选择(Selection)、交叉(Crossover)以及变异(Mutation)等机制,在每次迭代中都保留一组候选个体,重复此过程,种群经过若干代进化后,理想情况下其适应度达到近似最优的状态。算法具体逻辑可参考: https://zhuanlan.zhihu.com/p/460368294 这类算法不仅很有效,而且是可理解可证明的。记得多年前,第一次接触到这种算法类型的时候,深深地感受到了前人的智慧。

在实际应用中,我们可以使用一些现成的算法求解器,例如cplex。至此,通过问题定义、建模、求解。调拨模型中,从A仓到底要调拨多少量到B仓才能节省更多的成本的问题就解决了。


展望

面对一个需要优化的业务问题,传统的思路是从问题定义、建模再到求解。而深度学习模型的思路是:
  1. 向量化:无论什么类型的数据,文字、图片、视频、声音,首先是将数据向量化,比如文字可以使用word2vec转换成一串01向量。
  2. 将训练数据的目标结果也向量化:一般来说输入的数据和目标结果是同一种数据类型,也可以不一样。
  3. 选定目标函数:一般来说目标函数针对不同的任务类型有其固定的目标函数。比如常见的RMSE、Cross-Entropy、Categorical-Cross-Entropy等等。
  4. 训练模型:将模型输出的结果向量与目标结果向量代入目标函数,计算loss。同时计算梯度值,调整模型参数。直到在训练集上的loss足够小或者每次迭代的loss不再变低为止,训练结束。

可以理解为,无论什么问题只要将数据向量化,就可以通过深度学习模型求解。其中建模的过程可以省略,模型求解也是固定的范式。然后问题就解决了,我对这种神经网络模型也大为震撼。

人类的很多发明创造,都是从自然中学来的。比如机翼模仿的是鸟的翅膀,让上下两侧的气流速度不一样来形成向上的气压差;疏水材料模仿的是荷叶表面纹理仿制的。前面提到的启发式搜索算法,也是对自然界动植物等的模拟衍生出来的算法,原来很多问题在没有数学的时候,就能够通过生物本能的解决这个问题。同理,现在的深度学习模型,大家都说这是对人脑神经元与神经突触的模拟,同样的,我们接触的声音、视觉画面、文字等等都是通通转换成电信号,经过重重神经元之后,变成了我们可以理解的一个个具象的东西——一首歌、一部电影、一只小狗...... 神经网络模型跟这确实也有异曲同工之妙。

所以我并不觉得神经网络模型不对,只是我们对模仿的本体——大脑的科学认知都不够,那么通过模仿出来的神经网络模型让人更加不可理解,不可证明、也不可证伪。或许,现在所谓的神经网络模型压根就是错误的?或许等我们的脑科学有更大进步的时候,会有一种全新的能够科学证明的神经网络模型出现?

现在很多人把深度学习当做一个框,什么都往里装,以为深度学习就是万能解药,特别是一些神奇的大V发的文章,看多了总归有些不适。我们现在使用大模型的过程,就像三体里的火鸡科学家一样,在黑夜中不断摸索规律。至于这个规律是真理还是深坑,不得而知。大模型能发展到什么地步,那就要看后人的智慧了。

团队介绍


我们是大淘宝技术-品牌供给技术部,目前主要负责消费电子、家装家居、天猫优品等行业的供应链业务。团队致力于解决采购、调拨、仓储、履约等多环节的业务优化问题,为平台商家和集团自营业务提供极致的供应链体验。将仿真优化、运筹学、机器学习和智能AI算法与实际业务场景相结合,为供应链降本提效、提升消费者物流体验提供一站式解决方案。


¤  拓展阅读  ¤

3DXR技术 |  终端技术 |  音视频技术
服务端技术  |  技术质量 |  数据算法



本文分享自微信公众号 - 大淘宝技术(AlibabaMTT)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

Redis 7.2.0 发布,影响最深远的版本 中国程序员拒写赌博程序被拔 14 颗牙,全身损伤达 88% Flutter 3.13 发布 System Initiative 宣布将其所有软件全部开源 字节首个大模型独立 App 亮相,Grace 更名“豆包” Spring 6.1 已兼容虚拟线程和 JDK 21 Linux 平板电脑 StarLite 5:默认搭载 Ubuntu、12.5 英寸 Chrome 116 正式发布 红帽重新部署桌面 Linux 开发,主要开发者被调离 Kubernetes 1.28 正式发布
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4662964/blog/10097885