Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 10, No. 1, 2024 48 Optimisation of Spare Parts Quality Inspection Cost Based on Simulated Annealing and Genetic Algorithm Yuxuan Wang *, Yi Huang †, Feng Chen † Faculty of Computer Science, Hangzhou Dianzi University Information Engineering College, Hangzhou, Zhejiang, China * Corresponding author: Yuxuan Wang † These authors also contributed equally to this work Abstract: This paper provides an in-depth study on the impact of spare parts quality inspection on production costs in the electronics industry. By establishing a model based on binomial distribution, central limit theorem and right-hand side hypothesis testing, the costs, profits and losses of enterprises under different testing strategies are analysed. Firstly, for the inspection cost problem of accessory products, the minimum number of inspections is determined by assuming the number of sample defective products using binomial distribution and approximating the probability by De Moivre-Laplace theorem. Second, the simulated annealing algorithm is combined to derive 16 decision alternatives based on the analysis of control variables, and the best decision with the lowest total cost is finally determined. Finally, for the case of increasing number of spare parts and the appearance of semi-finished products, a mathematical model with minimising cost as the objective function is developed and solved using a genetic algorithm to evaluate the total cost under different inspection strategies. The study shows that the model proposed in this paper can reasonably solve the cost optimisation problem in electronic product quality inspection with high efficiency and practicality. Keywords: Hypothesis Testing; Simulated Annealing Algorithm; De Moivre-Laplace Theorem; Genetic Algorithm. 1. Introduction As China's social and economic landscape rapidly expands and living standards improve, the consumer electronics market exhibits sustained growth and strong demand. The quality inspection of electronic parts is critical for enterprises' survival and development, consumer rights, and social responsibility, holding an essential position in the market. Developing targeted and reasonable inspection programs is therefore crucial. Existing research on electronic product parts inspection has leveraged high-performance computing and various algorithms to address this issue. While these algorithms are efficient, they often rely on general frameworks that might not be precise in specific cases, potentially affecting detection accuracy and decision-making due to limited sampling. This study aims to adopt advanced methods to create more precise models for practical enterprise challenges. By integrating statistical methods like binomial distribution, central limit theorem, and hypothesis testing with optimization techniques such as simulated annealing and genetic algorithms, we systematically analyze the cost, profit, and loss associated with quality inspections. Our goal is to provide the electronics industry with practical and efficient inspection solutions, enhancing quality management and market competitiveness. 2. Sampling and Testing Programme Design Firstly, this paper designs a sampling programme to determine whether the failure rate of spare parts exceeds a defined standard value. In this case, the failure rate of spare parts should not exceed a given threshold (e.g., 10 per cent). We need to decide whether or not to accept the spare parts at different confidence levels. 2.1. Model Design based on Hypothesis Testing In this paper, samples are taken, which contains pieces of defective products, the defective rate can be obtained as . The defective rate given by the supplier is , so this establishes two hypotheses for the right-hand side of the test, : the defective rate of parts and accessories (the defective rate of parts and accessories does not exceed the nominal value, to accept this batch of spare parts). : the defective rate of parts and accessories > (the defective rate of spare parts and accessories exceeds the nominal value, to reject this batch of spare parts and accessories). Hypothesis testing is the process of testing whether a hypothesis about the aggregate is correct based on information about the aggregate X, and deciding whether to accept the original hypothesis and reject the alternative hypothesis or reject the original hypothesis and accept the alternative hypothesis [2]. 2.2. Binomial Distribution Modelling For each spare part, the probability that each part is a defective part is p if its pass rate is 1 . Suppose we take samples from a batch of spare parts and the number of defective parts follows a binomial distribution [3]: (1) In the process of production practice there will come from many aspects of the influence of factors, the combined effect of all these factors lead to process turbulence, thus reflecting some of the quality characteristics of the instability, probability theory and mathematical statistics of some statistical techniques can help us to understand and monitor these fluctuations, to help us in the direction of favourable to our development. 49 In the total sample X drawn ( , , , , ... ) for each of these samples, the probability of the binomial distribution can be approximated by the De Moivre-Laplace theorem in the Central Limit Theorem, when tends to , using the normal distribution [4]. (2) 2.3. Confidence Interval Analysis and Calculation Methods Confidence interval is a relatively important part of statistical inference in classical statistics, which provides us with a method of interval estimation of overall parameters based on sample information, which is both reliable and has a certain degree of accuracy. In practice, confidence intervals are widely used throughout the data analysis and decision- making process in various fields such as healthcare, manufacturing and finance. In this paper, there are only two possible values for the overall X: 0 and 1. Therefore, when the overall distribution is discrete, the larger the confidence level for the calculation of the confidence interval of the parameter, the more reliable the confidence interval is. For a given confidence level, the shorter the length of the confidence interval, the higher the accuracy. In practical applications, it is often necessary to calculate and find the shortest confidence interval at a fixed confidence level. In addition, under a fixed confidence level, we can also look for the interval with the shortest length of the confidence interval to obtain the most accurate parameter estimates. This requires us to be proficient in various methods of calculating confidence intervals, such as the normal approximation method, the Clopper-Pearson method, etc. (3) Figure 1. Analysis of defective rate with different sample sizes In this paper, the overall sample X has only two possible values: 0, 1, in line with the binomial distribution law, so set when X = 0, that is, to obtain the sample for the second product, when X = 1, that is, to obtain the sample for the finished product. Let E be the confidence level, so when the confidence level is that indicates the probability of accepting the original hypothesis is established, the right hypothesis: (4) (5) As shown in Equation (4), the overall sum of in this rejection domain is expressed as the number of substandard products drawn in the sample of sampling tests. Therefore, Equation (4) is obtained by dividing up and down. (6) (7) Where, in the take to the second product for 1, the finished product is 0, so is the number of the second product in the sample taken, by C multiplied by the inverse of the number of samples, that is, the true rate of the second product of the sample taken. Shifting the terms of Eq. (7) to simplify, (8) Squaring both sides of the inequality of equation (8) simultaneously, the 50 (9) is the true rate of defective products, p0 is the rate of defective products provided by the supplier, so refers to the error between the two, substituting the data in this question is 0.05 and 0.1, from the standard normal distribution probability density curve, the rejection domain is , the acceptance domain is , when , check the standard normal distribution table can be obtained, the confidence level When , . Figure 2. Relationship between sample size and acceptance and rejection probabilities For the first case for the first case can be calculated, can be calculated, can be obtained. (10) Calculated for the second case, this gives. (11) In summary, a minimum of 98 spot tests are required for the first scenario and a minimum of 15 spot tests are required for the second scenario. 3. Enterprise Profit Maximisation Testing Programme The process of producing N products involves the procurement of spare parts, whether or not to test them, whether or not to assemble them, whether or not to test the finished product, whether or not to exchange them for non- conforming products, and whether or not to disassemble them. In order to maximise the profitability of the firm, the cost of each component, given the quantity of the finished product, should be calculated to minimise the cost. 3.1. Simulated Annealing Algorithm The simulated annealing algorithm is inspired by the annealing and cooling process of a solid, where a solid is heated to a high temperature, causing atomic disorder, and then cooled slowly to allow the particles to settle into a low- energy, ordered state. In optimization, this process is simulated by treating the internal energy as the objective function value and the temperature as a control parameter. Starting from an initial solution, new solutions are generated from the current solution’s neighborhood. The algorithm accepts solutions that may worsen the objective function within a controlled range, mimicking the solid's equilibrium state at each temperature [5]. Figure 3. Schematic diagram of simulated annealing The process involves iteratively generating new solutions, calculating objective function differences, and deciding whether to accept or discard the new solution. As the temperature (control parameter) decreases gradually, the 51 system approaches equilibrium, leading to a near-optimal solution. To apply this, we define an initial state with decision variables, such as whether to inspect specific parts, finished products, or disassemble failed products. The total cost for each decision combination is calculated, including inspection, assembly, market price, exchange loss, and disassembly costs. The simulated annealing algorithm adjusts these variables by exploring randomly at high temperatures and gradually cooling to refine the search for the optimal solution. At each step, the algorithm evaluates the cost of a new state and decides whether to accept it based on probability, allowing it to avoid local optima and converge on the lowest total cost solution. 3.2. Cost-benefit Analysis Model The core idea of this model is to select the optimal decision option by quantitatively assessing the costs and benefits of various decision options. It requires the identification and quantification of various cost and benefit factors, and the establishment of a corresponding mathematical model for calculation. The first step is to determine the cost components of each decision-making process. For the procurement of spare parts, it includes the procurement cost and testing cost; for the assembly and testing of finished products, it includes the fixed assembly cost and testing cost; for the disposal of defective products, it includes the cost of direct scrapping, the cost of disassembling and reuse, as well as the cost of the loss of the customer's return and exchange. Then, we establish a mathematical model to quantify these cost factors. For example, the purchasing quantity, testing rate, dismantling rate, etc. are used as decision variables, and the corresponding costs are calculated through the formula. Finally, we add up all the costs to get the total cost, and weigh them with the revenue indicators, such as resource utilisation, customer satisfaction, etc., to choose the optimal decision- making solution. 3.3. Procurement and Testing of Spare Parts 1 and 2 According to the number of finished products N and whether to test (x1, x2) two decisions, can be inversely derived from the required number of spare parts 1 and spare parts 2 procurement. If not tested (x1 = 0, x2 = 0), the number of spare parts need to be purchased more to make up for the possible existence of defective products; if tested (x1 = 1, x2 = 1), only the number of qualified products need to be purchased, because substandard products will be screened out. (12) From the purchase quantity and formula (12), the purchase cost can be calculated as purchase quantity × purchase unit price to calculate the total purchase cost P1: (13) For spare parts testing problem determines the existence of testing costs, so for spare parts mathematical and testing unit price multiplication should be divided by (1-a11) to obtain the final cost of testing for P2: (14) 3.4. Finished Product Assembly and Testing Costs Finished assembly cost L1: (15) Finished product inspection costs L2: (16) When the customer returns the non-conforming products, the enterprise needs to exchange unconditionally, will produce a certain exchange costs, such as logistics costs, loss of reputation and so on. This part of the cost depends on the final number of unqualified products into the market, so the final exchange damage L3: (17) The dismantling of non-conforming products can lead to the recovery of spare parts, thus reducing the total cost. However, dismantling itself entails a cost, and a balance between the cost of dismantling and the value of recovery needs to be considered. This cost also depends on the amount of non-conforming finished goods that eventually reach the market: (18) (19) Combining the above costs, we can get the formula for calculating the total cost of C. This model can help enterprises to comprehensively consider the cost of each link, and according to whether to test spare parts, whether to dismantle substandard products and other decision-making variables, to find the optimal decision-making scheme, to achieve the goal of cost control. (20) By the cost-benefit analysis model and simulated annealing can be derived, in most cases need to spare parts 1 and spare parts 2 inspection, for finished product testing can depend on the situation of the inspection, when the cost of replacement is much greater than the cost of testing, should be carried out finished product testing in order to prevent the inflow of more substandard products into the user caused by the loss of replacement, and at the same time in the majority of cases for the unqualified products need to be dismantled because of dismantling of the resulting parts Bring revenue, but the dismantling cost is too high is directly discarded. 4. Optimising Production Decisions To optimize inspection, assembly, and disassembly strategies in production, the goal is to minimize production costs and defective parts rates. Each spare part has a defective rate, and uninspected defective parts can affect subsequent assembly and final product quality. While testing at each stage can control defective rates, it also increases costs. For 52 substandard finished products, companies must decide whether to dismantle them, which allows reuse of parts but adds disassembly costs. A mathematical model is constructed incorporating variables such as defective rates, purchasing, inspection, assembly, and disassembly costs, as well as the market price of finished products. Key variables include Boolean values indicating whether to inspect or dismantle substandard products. By evaluating all strategy combinations and calculating total costs and defective rates, the strategy with the lowest total cost is selected as optimal. Total cost includes purchase, inspection, assembly, disassembly, and defective replacement costs. Effective inspection reduces defective rates and associated losses. This approach helps companies maintain product quality while minimizing costs, leading to optimal production solutions. 4.1. Genetic Algorithm Optimisation Models To optimize the production process of electronic products, a genetic algorithm model can be built. The process starts by defining a fitness function that evaluates production strategies based on factors like production cost, disassembly cost, and market price. An initial population is created where each individual represents a strategy covering spare parts procurement, inspection, and dismantling options. These strategies are evaluated using the fitness function, and the best-performing ones are selected for reproduction. Crossover and mutation operations generate new strategies, allowing exploration of more possibilities. After multiple generations, the algorithm converges on an optimal production strategy that maximizes product qualification rates, reduces costs, and increases profits [6]. Production challenges often involve complex optimization decisions across multiple processes and parts, requiring advanced models that consider interdependencies, component compatibility, and quality control. Additionally, uncertainties like equipment failures and unstable raw material supply must be accounted for. By leveraging advanced data analytics and optimization algorithms, companies can better anticipate and address these challenges, improving both productivity and product quality. Key considerations in production management include analyzing the defective rate of each spare part and understanding its impact on the overall product quality. Fine- grained monitoring and management of each part’s quality control are essential to ensure the final product meets quality standards. Let the total cost be and the cost of the process be , then we have (21) The cost of each process can be broken down into components such as raw material costs, labour costs, equipment depreciation, testing, assembly and disassembly costs. By analysing these cost components in detail and aggregating them, the desired total cost of the entire production process can be calculated. In order to calculate this total cost more accurately, uncertainties such as fluctuations in market demand, changes in raw material prices, and fluctuations in production efficiency need to be taken into account. The introduction of probabilistic and statistical methods allows these uncertainties to be modelled in order to calculate the expected value of the desired total cost. In this way, companies are able to make more scientific and rational decisions in the face of uncertainty in order to optimise the cost-effectiveness of the production process. Let be the purchase and maintenance cost of the ith spare part; be the inspection cost of the ith spare part or process; is the assembly cost of the ith spare part or process; is the cost of disassembling the non- conforming product. (22) In the production process, the defective rate of each process and spare part can be accurately calculated by a recursive formula. Assuming that the defective rate of each spare part is α at the initial stage, the defective rate of the final product can be derived through a series of calculations after processing and testing in multiple steps. The impact of each process on the defective rate can be considered comprehensively through the formula, and the recursive formula accumulates the changes in the defective rate of each process in order to calculate the defective rate of the final product. This allows effective monitoring and control of the quality of the production process to ensure that the final product quality meets the expected standards. (23) in equation (23) denotes the defective rate of the final product and is the defective rate of the ith spare part. The formula shows that if every spare part in the production process meets the quality standards, the final product will also meet the quality requirements. In other words, the finished product can only be guaranteed to pass if all the parts meet the standard. Even if there is a quality problem with one part, it may result in the final product failing because each part is an important part of the quality of the finished product. Therefore, each spare part must be rigorously inspected to ensure that it meets quality standards. The presence or absence of testing during the manufacturing process can significantly affect the cost and revenue of the final product. Expected value calculation methods can help estimate the overall cost under different inspection strategies. The expected cost of inspection is a weighted average of all possible inspection costs, which is based on the probability of each inspection result and its cost. For example, a process with a high probability of inspection failure may result in more rework or scrap costs if inspection is not performed. Performing the inspection increases the direct cost, but it can detect the problem earlier and avoid greater losses. By calculating the expected cost, the total cost under different inspection strategies can be evaluated and the optimal cost-effective solution can be selected. Let be the quantity of the ith spare part, be the inspection cost of the ith spare part, be the exchange cost of the ith spare part, and be the cost of handling the defective product when it is detected (e.g., the cost of returning and replacing the product or the loss of logistics). The expected cost of assembly is clearly known. At the assembly stage, the cost of each process of assembly is: (24) 53 Figure 4. Comparison of total cost under different strategies In addition, the finished product has a dismantling yield of 7.2 and a dismantling cost of 10, suggesting that it should be scrapped. 5. Conclusion This paper proposes a comprehensive inspection optimization model for the quality inspection of electronic product parts through cost-benefit analysis. Using statistical methods like binomial distribution, central limit theorem, and hypothesis testing, the study establishes a probabilistic model to determine the minimum number of inspections. It then analyzes production costs under different inspection strategies using simulated annealing and genetic algorithms to find the optimal, cost-effective solution. Empirical analysis and model validation demonstrate that the proposed method is highly applicable and effective in assessing total costs and providing customized inspection solutions, avoiding issues common with general-purpose algorithms. This method significantly enhances quality management, reduces production costs, and improves market competitiveness in the electronics industry. Additionally, it offers new insights and references for related research and practice, with broad application prospects. References [1] Lai Dongping. Exploration of non-destructive testing technology in quality inspection of building structure engineering [J]. Urban Construction Theory Research (Electronic Edition), 2024,(25):175-177.DOI:10. 19569/ j. cnki. Cn119313/tu.202425058. [2] Yuan Ranhui,Du Zehong,Wang Longfei,et al. A space-based goniometric-only target localisation method based on hypothesis testing[J]. Shanghai Aerospace (in Chinese and English), 2024, 41(04): 155-162.DOI:10.19328/j.cnki.2096- 8655. 2024.04.019. [3] Jiaxiang Chen. Exploring three types of probability maximum problems with binomial distribution[J]. Secondary Mathematics, 2024, (13):101-103. [4] FAN Rose, WANG Benwang. Understanding the great likelihood estimation of binomial and hypergeometric distributions from the central limit theorem[J]. Teaching Exam, 2023, (38):65-68. [5] B. Zhao,X.F. Wang. An application of scheduling model integrating heuristic rules and simulated annealing algorithm[J]. Computer Engineering and Design,2024,45(08):2540-2547. DOI: 10. 16208/j. issn1000-7024.2024.08.039. [6] Zhang Xinlin,Qu Minglu,Yu Zhen,et al. Building thermal resistance capacity model identification and indoor temperature prediction based on genetic algorithm[J/OL]. HVAC, 1-11[2024-09-12]. http: //kns.cnki.net/ kcms/detail/ 11. 2832. TU.20240909.1647.005.html.