Artificial Intelligence in Die Casting How Artificial Intelligence and Game Theory Can Help to Reduce Scrap in Metal Casting
The initial question in the title of this article might seem a bit odd at a first glance as it is probably rarely the case that the terminologies "game theory" and "metal casting" are used together in one sentence. So, how can both be brought together so that one serves as a baseline to optimize the other?
The answer to that question lies in data science, machine learning and the increasingly arising field of explainable artificial intelligence (XAI). If you are curious how it works, then take a few minutes and read on!
Game Theory - Contribution of Individual Players to a Result of a Game
Let's first clear the dust a bit and have a short look at what "game theory" actually is.
"The branch of mathematics concerned with the analysis of strategies for dealing with competitive situations where the outcome of a participant's choice of action depends critically on the actions of other participants." 
Well, the definition from Oxford Dictionaries doesn't seem to help much for our understanding, so let's visualize it with the following example:
Consider you have a football game with 11 players in each team. After thrilling 90 minutes of high-class football, both teams split up 2:1. The principles of game theory could now be used to find out how much each of the players contributed to the end-result. (Basically, how valuable were the individual players for their team.)
There are various approaches to calculate the contributions of the individual players. The specific approach we will have a look at in the following lines of this article are Shapley Values (invented by Lloyd Shapley in 1951). Shapley values are used to calculate the average marginal contribution of each individual player - basically the average contribution of each player across all possible orders in which they can be brought into the match. 
Machine Learning in Production - Quality Prediction in Aluminum Casting
Further, let's take the use-case of quality prediction in the casting of aluminum wheels with the low-pressure die casting process. In this, molten and degassed aluminum is stored in the holding furnace of a low-pressure casting machine. The casting process takes place in 3 steps:
a) The pressurization in which pressure is applied to the holding furnace which causes the molten aluminum to rise through the riser tube into the mold
b) Filling up the mold during which the pressure is increased to fill the mold in a controlled and uniform way
c) The solidification in which a high pressure is applied to prevent shrinkage in the casted wheel.
The problem faced by our customer in this case were microporosities, blow holes and shrinkage which lead to an increased cost & remelting, excessive emissions and reduced OEE.
To enable operators, shift supervisors, process engineers and foundry managers to proactively take corrective actions in order to avoid scrap, a machine learning (ML) based model can be developed to predict the quality of the casting during the LPDC process. This model then takes real-time data collected within the production process (e.g. temperatures, air cooling rates, pressures etc.) to continuously monitor the casting process in near real-time.
The predictive quality model helps to detect quality deviations as early as possible and enable the engineers to make adjustments and to eliminate the root-causes of the quality deviations. But what if the root-causes and measures to be taken are unknown?
Explainable Artificial Intelligence (XAI) - Determination of the Most Influential Parameters
That's exactly where both of the terminologies "game theory" and "process optimization" come together and the connection of these is explainable artificial intelligence (XAI).
Explainable Artificial Intelligence (XAI) describes a field of research for the development, advancement and improvement of methods to make predictions or classifications of ML-based models interpretable and/or functionally comprehensible.
Given a ML-based model which predicts the product quality based on the collected process parameters, technologies such as SHAP (SHapley Additive exPlanations; based on the above-mentioned Shapley-Values) can be used to determine the most influential process parameters (players) with regard to their effect (contribution) on the product quality (result of the match). This is achieved in the form of so-called feature importance scores which assign a value to each of the input parameters of the model depending on their effect of the output of the model.  A visualization of SHAP-values can be seen in the following extract from the TVARIT Industrial AI Software (TiA) for the quality prediction in the aluminum casting process (please note that the concrete parameter names and values have been changed due to data privacy reasons):
With the help of SHAP-Values in the form of feature-importance scores, manufacturing engineers receive information on the most influential parameters for achieving the target product quality based on the collected data from their production processes.
Prescriptive Dynamic Recipes – Recommendations on Optimal Casting Set-Points to Reduce Scrap
Now – given that quality deviations of castings are known in real-time and game theory helps to understand the root-causes of casting errors, the remaining question is still: How do the casting set-points need to be adjusted dynamically to avoid casting errors?
In this case, we have to go one step further than “conventional game theory” but modern AI technology also provides a solution here: So-called “prescriptive dynamic recipes”. These give dynamic recommendations for optimal casting set-points.
The methodologies used here are advanced clustering methods that determine how the various influencing factors (data such as set-points, pressure and temperature curves in the casting machine and ambient conditions in the foundry etc.) play together to create a good (or rejected) casting.
If you have difficulties in following the last sentence, don’t worry – let's break it down step-by-step:
Clustering: "Cluster analysis is the name given to a set of techniques which ask whether data can be grouped into categories on the basis of their similarities or differences” .
This time, the definition of Andrew M. McIntosh gives us pretty concrete hints on how this might work – put into manufacturing practice: The clustering is applied to group castings by their similarity. The metrics used to measure the “similarity” here are the influencing factors (data such as set-points, sensor values etc.) for that particular casting (or that particular batch).
Prescriptive analytics then identify which of these groups (called “clusters”) have the best quality results which then can be used to identify the optimal values for the influencing factors. This can be seen below in the “Principal Component Analysis” (basically a 2-dimensional representation of the influencing factors for the sake of visualization). Here, the green group has been identified as the optimal group (cluster) of influencing factors as the castings (the red crosses) that lie in that area have the best quality results. The gradient of the crosses indicates the timing (the darker crosses are the most recent castings).
Okay – now that we got pretty technical and understand that prescriptive analytics define the optimal values of influence factors: How can this be used to reduce scrap?
Put in practice, the knowledge of the optimal values of influence factors can be used to define how the set-points need to be adjusted so that the casting process lies within these optimal cluster. These recommendations are then called prescriptive dynamic recipes (shown in the screenshots below).
To get back to the initial question of this article: Artificial intelligence and game theory help to optimize casting processes in the following way:
- Quality predictions help to react as fast as possible by detecting scrap as soon as it is casted
- Game theory helps to determine the most important casting parameters that cause scrap
- Prescriptive dynamic recipes give recommendations on how to optimally adjust the casting set-points to reduce scrap
 Curtis, S. (2013). The Law of Shipbuilding Contracts (4th ed.). Informa Law from Routledge. Definition of game theory. (2018). (Oxford University Press) Retrieved May 2018, from Oxford Dictionaries: https://en.oxforddictionaries.com/definition/us/game_theory
 Shapley, Lloyd S., und Alvin E. Roth, Hrsg. The Shapley Value: Essays in Honor of Lloyd S. Shapley. Cambridge [Cambridgeshire] ; New York: Cambridge University Press, 1988.
 Lundberg, Scott M., Gabriel Erion, Hugh Chen, Alex DeGrave, Jordan M. Prutkin, Bala Nair, Ronit Katz, Jonathan Himmelfarb, Nisha Bansal, und Su-In Lee. „Explainable AI for Trees: From Local Explanations to Global Understanding“. arXiv:1905.04610 [cs, stat], 11. Mai 2019. http://arxiv.org/abs/1905.04610.
 Andrew M. McIntosh, ... Stephen M. Lawrie, in Companion to Psychiatric Studies (Eighth Edition), 2010