A Decision Support System for Changes in Operation Modes of the Copper Heap Leaching Process

: Chilean mining is one of the main productive industries in the country. It plays a critical role in the development of Chile, so process planning is an essential task in achieving high performance. This task involves considering mineral resources and operating conditions to provide an optimal and realistic copper extraction and processing strategy. Performing planning modes of operation requires a signiﬁcant effort in information generation, analysis, and design. Once the operating mode plans have been made, it is essential to select the most appropriate one. In this context, an intelligent system that supports the planning and decision-making of the operating mode has the potential to improve the copper industry’s performance. In this work, a knowledge-based decision support system for managing the operating mode of the copper heap leaching process is presented. The domain was modeled using an ontology. The interdependence between the variables was encapsulated using a set of operation rules deﬁned by experts in the domain and the process dynamics was modeled utilizing an inference engine (adjusted with data of the mineral feeding and operation rules coded) used to predict (through phenomenological models) the possible consequences of variations in mineral feeding. The work shows an intelligent approach to integrate and process operational data in mining sites, being a novel way to contribute to the decision-making process in complex environments.


Introduction
Industry 4.0 is changing how businesses operate, forcing companies to compete to deliver greater customer value [1]. This will involve combining advanced production and operations techniques with intelligent technologies integrated into organizations, people, and assets [2]. At present, artificial intelligence tools are a great support to industrial processes [3,4]. Industry 4.0 is also touching on copper mining [3], which works by pyrometallurgical and hydrometallurgical methods [5], this later having the lowest environmental impact [6,7]. One method that has become established in copper mining is leaching. There are several processes to leach minerals, which depend mainly on the physical and chemical characteristics of the mineral [8] such as granulometry, the chemical composition of the mineral, and leaching kinetics, among others, which directly impacts the planning of the mode of operation to leach, and therefore in profitability. Typically, performing the task of planning modes of operation requires a significant effort in generating information, analysis, and design, where multiple factors such as those above-mentioned participate. This is why in the present work, a prototype of an intelligent recommendation system is proposed [9], which supports decision-making for the selection of modes of operation in heap copper leaching [10]. of operation before variations in the power supply. The modes of operation will be defined by a set of conditions in the planning of the feed. They will define the set of reagents to be used as leaching agents, agents that will aim to improve the leaching kinetics, maximizing the expected recovery of minerals compared to the dynamic behavior of the mineralogy of the mineral fed.
Finally, the objective of the proposed system is to complement the set of tools used in making strategic decisions in the heap leaching production process. This could lead to improved production efficiency without incurring a significant increase in investment (given the existing infrastructure for processing secondary copper sulfides).

Overview
Smart mining is the path taken by the mining industry in Chile, which implies the adoption of technologies and tools that make autonomous and more productive mining possible [3,7], technologies that aim to improve the efficiency and effectiveness of productive processes, and by considering the drop in mineral exploitation laws in the mining industry. Then, considering the fall in the exploitation of oxidized minerals in the Chilean mining industry and the subsequent increase in the extraction of sulfide minerals (both primary and secondary sulfides) [14], the opportunity arises to analyze alternatives that increase the useful life of hydrometallurgical plants by using the same infrastructure to process sulfur minerals (secondary sulfides), leachable in acidic media with the addition of chlorides [23,26,27].
Among the new technologies applied in the industrial context in recent decades, there are applications of artificial intelligence tools both for studying the dynamics of production processes and developing systems that support the making of decisions such as intelligent prediction or recommendation systems. Prediction systems are techniques that build and study new forecasts through a branch of artificial intelligence called machine learning. Machine learning offers the capacity of machine learning to achieve precise predictions on new observations by using techniques such as statistical models, neural networks, support vector machines, or clustering tools to predict situations based on the experience obtained [28]. These systems use machine learning algorithms to induce predictive models from historical data. The knowledge produced is used to help organizations make datadriven decisions. Machine learning algorithms learn prediction models by inducing a generalized relationship between a set of descriptive characteristics and one or more target characteristics from a set of specific training instances [29]. Recommendation systems, on the other hand, aim to help the user select elements from a large number of options, generating predictions of the situations with the highest probability of occurrence. A recommender system can be defined as a system that helps associate a product with a user in a personalized way. Therefore, the basic principle of the recommendation algorithms is to find the dependencies between the variables of interest and the activity carried out on or as a function of these variables. The dependencies on which the recommendation algorithms are based can be based on correlations, but they can also be deducted from the individual characteristics of each variable [30].
This document proposes generating an intelligent operating mode recommendation system that supports decision-makers in the copper heap leaching process in the copper industry. The design and implementation of the proposed intelligent system require the development of the following tasks: • Ore feed analysis: The data corresponding to the mineral feed includes the parameters of the raw feed, among which are: percentage of leachable oxides and sulfides, particle size, leaching flow rate, and level of chlorides added to the acid solution. • Domain ontology development: Representation of knowledge about the dynamics of the leaching process, mainly indicating the configurations of the assets typical of a certain mode of operation.
• Rules, facts, and knowledge base: Generation of operation rules based on a specific subset of configurations in the mineral's feed parameters that enter the process.

•
Operational parameters and expected recovery levels: Identification of the operational parameters that significantly impact the response and determination of expected recovery levels is determining or estimating a tipping point where mineral recovery is negligible or becomes asymptotic.

•
Knowledge of domain experts: Experts in the domain have the functions of generating the operating rules based on their knowledge of the dynamics of the process and the validation of the sequence of operating modes recommended by the algorithm or designed system.
Multivariate models provide a descriptive mathematical relationship between a set of independent variables and one or more dependent variables. These models can be adjusted either through regression models using methodologies such as response surface optimization [41,42] like that developed by Aguirre et al. [43], or multiple regression models adjusted through a design of experiments [44] such as those developed by Pérez et al. [45] or by Saldaña et al. [46]. Additionally, in the literature, there are phenomenological models where it is considered that the leaching dynamics can be modeled by a first-order model such as those presented by Mellado et al. [21,22,33], where it is considered that the leaching process occurs at different scales of size and time since different phenomena participate in the process [35,36].
In addition to conventional modeling techniques, there are representation approaches using machine learning techniques including techniques such as Bayesian networks or neural networks. Saldaña et al.'s [38] model makes it possible to recognize the dependency and causality relationships between the sampled variables and estimate the result with partial knowledge of the operational variables. Other machine learning algorithms that have proven to be efficient in modeling complex systems such as heap leaching are artificial neural network models, allowing them both to model, predict, or optimize the response to the sensitization of the predictor variables [39,47,48]. Additional studies have proposed a hybrid approach, incorporating genetic algorithms to the artificial neural network model to predict the optimal conditions for leaching in columns of copper oxides [49] or for bioleaching of molybdenite [50].

Rules-Based System
Rule-based systems are systems based on deductive reasoning, which use rules to represent knowledge and infer actions given certain conditions or circumstances [51]. Rule-based system definitions rely almost entirely on expert systems, systems that mimic the reasoning of a human expert to solve a knowledge-intensive problem. Rather than statically representing knowledge declaratively as a set of true things, the rule-based system represents knowledge in terms of rules that indicate what to do or conclude in different situations. The rules are expressed as a set of instructions like "If P, then Q~P ⇒ Q". A rule-based system consists of a set of If-Then rules, a set of facts, and some interpreter (inference engine) that controls the application of the rules, given the facts. When exposed to the same data, the expert system will (or is expected to) work in a similar way of the expert. The requirement is that knowledge about the problem area can be expressed in the form of If-Then rules. The area should not be that large either, since many rules can make the problem solver (the expert system) inefficient [52].
Inference engines are the main component of intelligent systems that apply logical rules to a knowledge base to make new facts and relationships emerge. An inference engine consists of all the processes that manipulate the knowledge base to deduce the information requested by the user and carries the reasoning required by the expert system to reach a solution [52]. A rules-based inference engine applies rules to the data to reason and derives some new facts (generate knowledge). When the data match the rule's conditions, the inference engine can modify the knowledge base such as the assertion or retraction of facts, or execute functions such as displaying the derived facts [53]. In other words, they are in charge of managing the process of selection, decision, interpretation, and application of the behavior that reflects the reasoning, processing, and interpreting rules that are in charge of solving a decision problem (such as the determination of a certain way of organizing the resources). In classical logic, it is possible to deduce by using rules. If its premise is true, so will its conclusion.
On the other hand, as part of the proposed framework of a decision-making support system whose framework begins with the identification and modeling of subsystems, statistical and machine learning techniques can be used to study the relationships between the variables of interest, and to use logical rules (obtained from domain experts) to capture the interdependencies between them.
Finally, an inference engine is applied to predict the possible consequences of the given triggers and advise a decision-maker. The development of the inference engine is carried out by generating a decision tree of the heap leaching process, followed by a debugging, where it is customized considering the knowledge generated through statistical analysis, and modeled based on machine techniques: learning and the conceptualization/formalization of expert knowledge through operating rules.

Knowledge Representation
The representation and reasoning of knowledge are Artificial Intelligence (AI), which deals with how knowledge can be symbolically represented and manipulated in an automated way through reasoning programs. More informally, it is the part of AI that deals with thinking and contributing to intelligent behavior [54]. There are various methods to represent knowledge. We have found methods based on ontologies (used in the proposed system), methods based on rules, on knowledge networks, or methods based on graphics, among others [55].
An ontology is an explicit specification of a conceptualization [56], allowing the capture of consensual knowledge generically. A "conceptualization" refers to an abstract model of some phenomenon by having identified the relevant concepts of that phenomenon. "Explicit" means that the type of concepts used and the restrictions on their use are explicitly defined [57].
An ontological system as a tool in a certain domain relates a set of harmonized parts of a real knowledge [58] and prior conceptualization, developed by extracting knowledge from both traditional sources (databases or sensors) and informal sources (domain experts). Within the formal sources, algorithms such as phenomenological mathematical models [10,22,59], decision trees [60], regressions [31], neural networks [39], or Bayesian networks [38], among others [37], are considered. The expert knowledge base is then generated through rules and facts drawn from the expert(s).

Planning of Operating Modes
The contrast in the leaching dynamics of different copper minerals has already been studied in the literature [10], indicating the differences between the mineral recovery curves in oxidized minerals versus sulfide minerals. In work developed by [10], phenomenological models were adjusted to extract copper from oxidized minerals in acidic media and sulfurized minerals (secondary sulfides) using H 2 SO 4 and chlorides at different concentrations. This dynamic behavior of the feeding, considering the variable leaching time, to complete the process when the mineral recovery in the leaching behaves asymptotically, supposes high variations in the valid lifetimes of the heap (as shown in Figure 1a) due to lower leaching kinetics of sulfide minerals when exposed only to H 2 SO 4 , which implies increases in operating costs. Given the variation in the recovery dynamics and the efficiency derived from maintaining relatively constant battery lifetimes, introducing a system of operating modes such as the one indicated in Figure 1b, associated with the copper oxide processing (Mode A) or copper sulfides (Mode B), has the potential to introduce improvements in the responses of the heap leaching process, accelerating the leaching kinetics of sulfide minerals (by adding chlorides as leaching agent), showing that the recovery curves of secondary sulfides tend to be assimilated to those of oxidized minerals (see Figure 1c), that is, operational planning that considers the leaching of both oxidized and sulfide minerals (secondary) has the potential to contribute to improving the efficiency in the use of the assets, increasing the recovery of the mineral due to the use of selective leaching agents as organized through different modes of operation depending on variations in the feed mineralogy. The modes of operation considered as part of the proposed recommendation system are presented below:

•
Mode A: Leaching of oxidized copper ores in acidic media.

•
Mode B: Leaching of sulfide copper ores using H 2 SO 4 , and chlorides as a catalyst agent. • Mode X: Mixed leaching of oxidized and sulfurized minerals in acidic media at low chloride concentrations (This mode of operation corresponds to a transition mode, between the leaching of oxides with H 2 SO 4 and chloride-adhering sulfides).

Validation Using Performance Measures
Once the models have been developed, they must be validated using different techniques. The data obtained in the experiments will generate a confusion matrix, a matrix that facilitates the necessary analysis to determine where the classification errors occur. The performance values necessary to evaluate the classifier's performance to be implemented will be calculated using this matrix. The confusion matrix is a 2 × 2 matrix with numerical values TP, FP, TN, and FN, which are the result of the classified cases, where TP is the sum of the true positive cases, FP is the true negatives, TF represents the positive ones false, and FF corresponds to false negatives [61].
The measures of merit used in this study help determine the quality of the predictive models developed and are based on data from the confusion matrix and the training result. The contrast between the outputs of the recommendation system and the planning generated by historical data and by experts is evaluated through the performance indicators confusion matrix, accuracy, precision, recall, specificity, F measure, Matthews correlation coefficient, and kappa index [52]. These merit values are as follows: 1.
Accuracy (Acc): Corresponds to the proportion of correctly classified cases from all the examples in the dataset. This indicator can be calculated with the data from the confusion matrix (see Equation (1)).
2. Precision (p): The proportion of true positives (TP) among the elements is predicted as positive (see Equation (2)). Precision refers to the spread of the set of values obtained from repeated measurements of a quantity. 3.
Recall (r): The proportion of predicted true positives among all items classified as positive (see Equation (3)).

4.
Specificity: (True Negative Rate) measures the proportion of negatives that are correctly identified (that is, the proportion of those who do not have the condition (not affected) who correctly identify as people who do not have the condition).
5. F1 score: The F1 value is used to combine the precision and recall measurements into a single value. This is practical because it makes it easier to compare the combined performance of precision and recall between various solutions. F1 score is calculated by taking the harmonic mean between precision and recall, as shown in Equation (5). 6.

Matthew's correlation coefficient (MCC): An indicator that relates what is predicted
with what is real, creating a balance between the classes, considering the instances correctly and incorrectly classified in classes that are pretty different in size and with a significant number of observations (see Equation (6)).
Kappa index: An indicator that represents the proportion of agreements observed beyond random with respect to the maximum possible agreement. It is used to evaluate the concordance or reproducibility of categorical measurement instruments and is defined as shown in Equation (7).
Po represents the proportion of observed agreements (or accuracy) and Pe's proportion of agreements expected in the hypothesis of independence among observers, that is, agreements by random.
The values of Equations (1)- (7) were calculated to evaluate the performance of the proposed model with the historical data and the expert's recommendations. This is useful to compare the goodness of the developed model. The calculations, interpretations, and comparisons are described in the next section.

Implementation
The design of the proposed recommendation system considers the generation of the planning of the modes of operation of the heap leaching phase in the copper hydrometallurgical process based on variables and/or parameters such as mineralogy, leaching agents, operational results, and databases and facts that are established based on the study of the dynamics of the process such as consultations with experts in the domain formalized through a system of rules, which together with machine learning models (such as the generation of an inference tree derived from the construction of a decision tree) have the potential to generate an optimal operation plan, which, together with generating planning modes of operation or of varying operational parameters such as leaching agents, generate response estimates, that is, together with the operation planning, an estimate of the recovery over time is generated through the application ion of phenomenological models extracted from the literature [10,21], as previously adjusted.
The scheme for the proposed recommendation model presented in Figure 2 is divided into the following sections: 3.1. Implementation of knowledge representation 3.2. Expert module 3.3. Recommendation module

Implementation of Knowledge Representation
This section describes the formalization and representation of the knowledge used in the system. The representation of part of the knowledge was carried out by studying the dynamics of the process developed by the authors in previous works and adjusting phenomenological models and models based on regressions [10,31,62] of the decision tree model fit and the formalization of expert knowledge through operating rules such as the one exemplified below: If %O > 80% and %S < 10%⇒Mode A It is indicated that if the percentage of copper oxides is greater than 80% and the percentage of leachable secondary sulfides is less than 10%, it must operate under operating Mode A, as defined previously.
The knowledge derived is part of the "Domain model" and/or the "Expert model", where the description of the entities (domain concepts), their attributes, roles, relationships, and domain restrictions are stored. The domain of the model is described through the ontology. In contrast, the expert model is given by an inference engine, derived from the generation of a decision tree and customized according to expert knowledge, formalized through operating rules.
The concepts (of the domain model) are represented using a domain ontology (see Figure 3a). The main concepts are listed below [63]: 1.
Heap/Pile: Accumulations of mineralized material carried out in a mechanized way, forming a kind of continuous cake or embankment of varying height. The piles are slightly inclined to allow the drainage and capture of the solutions and are watered with a reagent solution to extract the mineral. Mineral: Inorganic solid substance, formed by one or more defined chemical elements that are organized in an internal structure.

4.
Reagent: A chemical element that establishes an interaction with other substances in the framework of a chemical reaction, generating a substance with different properties called a product.

5.
Operating conditions: State of the variables of interest in a given mode of operation. Some variables are days of operation, irrigation ratios, type of reagent, total reagent added, mineral recovery, and update of the amount of mineral extracted from the heap. 6.
Mineral recovery: Output variable or ore recovery function.
The relationships between classes were defined to identify the most appropriate operation modes for a heap and the characteristics of the material, heap size, etc. Examples of the relationships considered are listed below (see Figure 3b).

1.
it_is_a_type: is the relationship between concepts that belong to the same hierarchy.

2.
depends_on: is the relationship established between the concepts involved or influence in copper recovery. 3.
leach: is the relationship between leaching agents and the type of material. 4.
operates_according_to: is the relationship between the heap and the operation mode. Sets the operating mode to be applied to a stack according to its characteristics.
Considering the simplifications applied to the production process, axioms have been defined that express restrictions or specific characteristics of the heap leaching process applied (generally) by the mining companies that apply this process. Some of these axioms are described below. The implementation of the expert model, on the other hand, was carried out by generating an inference engine, after generating a decision tree that models the studied process, developed using the "sklearn" library in Python 3.7.10. The inference engine can also be conceptualized as a sequence of rules that model the knowledge of the heap leaching process, and can indicate a course of action or some recommendation of the response variables before the entry of one or the other more sequences of records of the independent variables. The complete set of rules that model the system is obtained by considering the largest number of rule combinations that can be theoretically established (or by adjusting using classification algorithms such as decision trees). However, among all these theoretical rules, some do not make physical sense or do not conform to the characteristics of the problem to be solved, which are in contrast to expert knowledge. Due to the complexity of the proposed model, it is necessary to reduce the number of combinations made by adjusting the algorithm. The most frequent cases or combinations of variables are used as a rule base to achieve this reduction. Another essential element in the formulation and design of the expert module, which is a fundamental part of the declarative knowledge of the system's behavior, is the availability of data to generate the recommendation prototype (database of recovery results). The selection and subsequent categorization of the variables involved in the heap leaching process were determined from the practical study of the process and its theoretical basis. When the characteristics that govern the process are theoretically defined, several variables are presented that are involved and act with each other as the process is carried out. When comparing the information obtained from the theory with the observation and analysis of the practical execution, the most relevant variables are identified, highlighting those that can significantly interfere with the final result if there is no control over them. In this sense, historical data are available for the heap leach's assembly, seasonal, and disposal phases. Additionally, there is the experience of experts in the domain for the generation of rules.
The feeding into the process is given by a set of variables whose impact is widely documented in the literature [21,22,33,35,36,38,64,65]; however, to model the dynamics of the process in the proposed recommendation system considering the sampling restrictions (variables not sampled under operational conditions), the following independent variables are considered:
While the process responses are given by: • Operation mode; and • Copper recovery.

Cl/Sulfides Non-Existent Medium High
Cl20 Additionally, the presentation model was given by designing the recommendations generated by the proposed recommendation system. For this, the generation of sequences of periods that share similar feeding characteristics was considered, that is, sequences of periods in which a single mode of operation is maintained; the duration of the period, the suggested mode of operation, and the average expected recovery are presented. The presentation model contains the knowledge of the recommendation prototype (recommendations and conclusions based on abstractions), the representation of historical episodes (data and events) of the assembly, seasonal, and disposal phases of a heap leach, in addition to the process responses.
Finally, to estimate the expected recovery of mineral per period, phenomenological models were applied to estimate the recovery of minerals against a certain mode of operation. For calculation purposes, it is considered that the input of the feeding data contains all the values of the variables indicated in the previous subsection.

Expert Module
As explained in Section 2.3, the expert module is part of the recommendation model in charge of extracting or capturing human knowledge to solve problems that generally require human experts. A well-designed expert system mimics the reasoning process of domain experts to solve specific problems, serving as support mechanisms to be used by non-experts to improve their problem-solving or decision-making skills. Additionally, these systems have the potential to outperform any individual human expert in making decisions in a given domain [66].
The components that comprise the developed expert module consider the acquisition, representation, treatment, and use of knowledge from the domain model, the expert model, the feed data, and the mineral recovery results.
The acquisition of knowledge was carried out by extracting knowledge from both formal sources (databases of operational parameters of a mining worksite in the Antofagasta region, Chile) as well as knowledge from experts in the domain to generate an inference engine, previous representation of the knowledge, that allows one to obtain the planning of recommendations of modes of operation. The formalization of this knowledge is in the "Domain model" and "Expert model". The representation has been made using ontology (detailed in Section 3.1), while a system of rules formalizes expert knowledge.
The treatment of knowledge, on the other hand, was generated by adjusting machine learning techniques. The logical rules of operation obtained from expert knowledge were formalized through an inference tree (base of the inference engine), which is expressed through a set of operating rules that determine the most suitable mode of operation in the face of variations in the power supply. The outputs of this process correspond to the planning of a sequence of operating modes.
Finally, knowledge was used to generate abstractions related to the mode of operation, its characteristics, and results. They are partial results that add more atomic interpretations that result from applying the rules described in the "Expert model" such as the duration of each operating cycle, the average mineral recovery, and the assignment of the operating mode to the percentage dynamics of the types of minerals in food. In other words, the use of knowledge refers to the incorporation of the expert module in the recommendation system, the formalization of knowledge, food data, and methods based on statistical techniques and machine learning to estimate the deliverables of the modeling process.

Recommendation Module
The recommendation module is in charge of interaction with the user, receives the user's request, and delivers a recommendation plan as a result. This module uses the knowledge base "Presentation model" to generate the recommendations, which in turn also uses knowledge of the "Domain model" and the "Expert model" to detail aspects of the domain and the rules that model the dynamics of the process (i.e., characteristics of the feed). The interconnection between the recommendation module and the expert module allows us to refine the power data, generating abstractions about the planning of the sequence of operation modes and planning in herself.
The acquisition of knowledge about the representation of the recommendations was carried out, on one hand, through interviews with an expert planner, who said or gave the guidelines of (a) what planning of the operation mode should carry (indicate) and (b) what an expected planning sequence should indicate. He also received requests for (c) refinement from the human planner.
In summary, the outputs of this module will be recommendations for (a) planning the operating mode and (b) explanation of the expected recovery sequence, according to the suggested plan.

Results and Discussion
This section is broken down into three subsections: the implementation of the recommendation system; the results of the proposed system, where the results of both the analytical models generated to represent the dynamics of the studied system and the recommendation of modes of operation are indicated (including the validation of the recommendations against historical data and experts in the domain); and finally, the discussions and analysis of the findings of the work carried out are presented.

Implementation of the Recommendation System
The implementation considered the generation of an expert module (whose function is the acquisition, representation, and treatment of knowledge) and the inclusion of this in the recommendation system including the knowledge base, represented through an ontology of the domain and the predictive response analysis, in order to deliver a sequence of operating modes and an estimate of the expected mineral recovery. After having the input variables (feeding the statistical or phenomenological models), in addition to the knowledge of the expert (through operating rules), the treatment of knowledge was formalized through the generation of an inference tree, in charge of the process of selection, decision, interpretation, and application of the behavior that reflects the necessary reasoning to induce a certain mode of operation in the face of certain feeding conditions.
The development of the inference tree was adjusted by developing a decision tree using the sklearn library in Python, while the criterion for the quality of the divisions was entropy. The pruning of the decision tree and its pruning parameter (α) is shown in Figure 4a, indicating that for a range of 0.01 ≤ α ≤ 0.011, the accuracy of the decision tree in the training set is maximized a priori. In contrast, the range 0.011 ≤ α ≤ 0.25 maximizes the accuracy of the test set. Figure 4b shows that using different training and testing data with the same α resulted in different precisions, suggesting that alpha is sensitive to the datasets. Therefore, instead of choosing a single training dataset and a single test dataset, cross-validation was used to find the optimal value for α. Using cross-validation, as shown in Figure 5, we can conclude that the pruning parameter α should be close to 0.015. Then, the ideal value of α to maximize the statistical accuracy to build the best tree is 0.0152. Finally, incorporating the operation rules generated by the experts into the decision tree, the inference engine shown in Figure 6 is obtained. The confusion matrix presented in Table 2 indicates that the inference engine is relatively accurate to estimate the modes of operation of the heap leaching phase, which was confirmed by the performance statistics of the classification of the modes of operation shown in Table 3, corresponding to the classification of the data used for the generation of the decision tree.   An example of the dynamics of the inference engine shown in Figure 6 is presented below: If sulfides percentage > 0. 6 Where, if the following conditions are met: percentage of sulfide minerals is greater than 60%, the percentage of oxidized copper minerals is less than 20%, no chloride concentration is applied at 20 g/L, but if chlorides adhere to 50 g/L, independent of the leaching flow rate and granulometry, the recommended operating mode is Mode B, leaching of sulfur minerals in acidic media with the addition of chlorides at high concentrations.
From the historical data, it is not possible to appreciate a direct impact of the superficial velocity of the leaching flow or the granulometry in the mode of operation of the hydrometallurgical phase studied in the inference engine. This is explained because said variables impact mineral recovery (estimated from phenomenological models), depending on the conditions or mineralogical distribution of the feed.

Ontology Modeling
The ontology was implemented in the OWL language with the use of the Protegé Software (version 5.5.0) [67] since it facilitates the creation of classes, the instantiation of individuals, the implementation of properties, both of objects and data types, in addition to offering the inclusion of rules on which it is possible to infer knowledge. Ontology management, on the other hand, was developed using the "owlready2" library. In line with the significant variables identified to generate predictions of the operating mode recommendation system in the heap leaching phase, the modeled ontology, presented in Figure 3, was composed of the following entities:

Evaluation of Recommendations
For the analysis of the operational information, it is possible to generate processing plans optimized to the operational conditions at the mining sites, adjust models based on machine learning, and incorporate expert knowledge to generate recommendation modes that improve the mining phase's operational indicators of heap leaching, considering a smoothing of the variations that avoid continuous variations in short periods. On the other hand, after generating the operation plan, estimates are generated for mineral recovery in % for each block of the operation sequence through process models extracted from the literature, mainly phenomenological models.
The incorporation of different modes of operation in the processing of the leaching phase in copper ore heaps gives greater flexibility to the production process to adapt to changes in the feed, which is proven by analyzing the deliverables that consider the display of the comparison between the expected recovery mode generated by the recommendation system (see Figure 7a) and the actual recovery mode (see Figure 7b). The validation of the recommendations of the recommendation system was carried out by contrasting the outputs of the proposed system against the operational data and the expert, showing the confusion matrices of both contrasts in Table 4, wherein 87.3% of the cases, the model correctly predicted observations compared to historical processing modes. In comparison, 77.8% correctly predicted observations compared to the recommendations of a domain expert.  Different decision metrics were considered to evaluate the effectiveness of the classification system, that is, the frequency with which the system makes correct recommendations (both according to the operation history and with the contrast with the experts' recommendations).
The metrics used to evaluate the recommender's performance included accuracy, precision, recall, F1 score, and kappa index. The contrast between the modes of operation recommended a priori by the proposed system (see Figure 7a) and the historical modes of operation (see Figure 7b) indicates that the inference motor tends to be sensitive to variations in power supply. However, the performance indicators of the model presented in Table 4 indicate that the intelligent system is efficient in generating a recommendation plan for operating modes in contrast to the historical operating modes, despite the potential costs associated with the variation of the use of assets as a result of continuous variations in the recommended mode of operation. On the other hand, to avoid continuous changes in the operating mode, the recommended outputs were smoothed (see Figure 7c) to obtain planning that optimized the recovery of minerals in the heap leaching phase, thus minimizing the number of changes in the recommended mode.
The performance statistics of the system shown in Table 5 indicate that, in general, the model was quite accurate to model and recommends a certain mode of operation in the event of variations in power. The contrast between the values of the performance statistics compared with the historical data and with the expert showed that in the case of the historical data, the modes of production tended to be smoothed so as to not present constant variations in the use of data assets (see the comparison between planning in Figure 7a versus Figure 7b). In contrast with the expert, there was a tendency to further smooth the planning to minimize changes in operating modes. Finally, the use of different modes of operation can improve the strategic planning of the mining plan, making the value chain more flexible by making better use of assets and improving mineral recovery, regardless of the mineralogical characteristics of the mine feeding.

Discussion
In this subsection, the key challenges faced, and lessons learned from building the decision support system based on prior knowledge for heap leach phase management in copper hydrometallurgy are discussed, and the advantages and limitations of the proposed framework.
The implementation of innovative tools applied to support modes of operation such as those based on recommendation systems can improve the operational indicators of the mining sector. Still, it will not provide all of the potential advantages if they are not integrated with existing systems. The interoperability of the different systems allows the information management to be sustainable and with a satisfactory level of quality, which will benefit companies adopting the technological revolution as the central axis of their strategic planning. To predict the future behavior of the assets in the face of variations in the supply of minerals, the dependencies of the assets were captured using rules in this work. However, creating a comprehensive rule base for heap management is not feasible, especially when working with few domain experts whose time is extremely valuable. In this work, a rule base with three possible scenarios/outputs was created to demonstrate the applicability of the proposed reasoning and the decision support framework. Different experts or organizations can create rule bases for different scenarios/applications in a distributed manner for larger-scale applications, incorporating a more extensive set of power variables or a larger set of asset use distributions. It is important to highlight that tools such as ontologies can provide a common language to handle the modeled process's knowledge to complement the recommendation generated by the expert system.
In this research work, a recommendation prototype for modes of operation in the heap leaching phase in copper mining was presented. This takes into account the context and is fundamentally based on content from both the analysis of historical data (from of a mining site) using statistical techniques (for predicting the expected recovery of mineral) and machine learning (by adjusting a decision tree, the base component of the inference engine) as well as knowledge extracted from experts in the domain (through operation rules incorporated into the inference engine dynamics). The prototype presented in this work was designed to support decision-making.
The use of fuzzy information (coming from the power supply) is exciting since it allows the operator to specify their preferences (of operating modes) with a relatively broad degree of freedom. It is essential to bear in mind that for this system to work, a previous compilation of both modes of operation and the operating conditions where a specific mode of operation was put into operation and the experts' evaluations. However, as more data become available, especially in the context of the Internet of Things, and more intelligent sensors are installed to monitor production processes, information will no longer be fuzzy, and handcrafted rules could be used to guide the learning of quantitative/logical rules using tool applications such as big data and validate existing domain experts' existing rules.
Systems such as the one proposed in this work will facilitate the companies and organizations to obtain more detailed knowledge about the dynamics of the studied process and efficiently learn the impact on the responses of the variation in the variables and/or explanatory parameters. The validation through case studies (historical data) and comparison against the experts were used to evaluate the correct operation mode or configuration of assets or resources in the copper heap leaching process.

Conclusions and Future Works
In this work, a novel knowledge-based decision support system was presented to integrate recommendations for operating the hydrometallurgical heap leaching process. A recommendation system for selecting operating modes was generated, inspired by intelligent recommendation systems, by modeling the dynamics of the process through statistical techniques and machine learning, techniques that have been widely applied in business processes as described in [37], mining, and the modeling of expert knowledge through operation rules.
Then, the main tasks performed by the proposed system are the selection of the operating plan and the recommendation of said plan in a given period, together with the prediction of the expected recovery. For the selection task, there are rules to identify the best operation plan, according to the characteristics of the materials and the leaching process described above. For the recommendation task, a model was designed to show the recommended operation plan (output from the first task). The feedback collected from external experts in the domain suggest that the reasoning processes (rules) and the estimated consequence are appropriate for current practice, that is, to generate an operation plan that improves operational indicators, which was validated by the performance statistics, accuracy, or precision, among others.
In summary, the article has made the following novel contributions: • The first decision support system was presented that allows decision support to the hydrometallurgical phase of heap leaching. • An inference system was formalized and developed to recommend a mode of operation based on variations in feeding.

•
This inference engine was integrated into a recommendation system that generates predictions of the responses.
Finally, as future work, the current system will be expanded considering additional scenarios and/or variations such as an extension of reagent concentrations or the impact of variables such as porosity or the level of carbonates in the feed.