Knowledge-based methods for cost estimation of metal casts

The aim of the research presented in this paper was to verify the hypothesis that the problem of estimating the variable costs of metal casts can be solved by using knowledge-based systems. The estimation of variable costs determines the adequate pricing of products, which is a crucial marketing problem in enterprises. The problem of estimating the direct costs is especially important in companies whose participation in the market is defined as versatile manufacturing. This problem was the target of many studies presented in this paper. The assumptions that the direct costs of a metal cast are dependent on the physical features of the cast and the most effective method of cost estimation is an intuitive qualitative technique based on a rule-based system were considered. The nature of the relationships between the casts’ features and the direct costs of production could be effectively formed by experts as reasoning rules. In this paper, the results of experiments conducted on the basis of the example of the production program of a foundry that manufactures water-system fittings is presented. Three methods of knowledge-definition and reasoning techniques were examined: the classical method of crisp reasoning, fuzzy reasoning with the Mamdani’s method, and fuzzy reasoning with the Takagi-Sugeno model. Proper experiments were conducted. The results of the experiments confirmed the hypothesis, which allows the assessment of different reasoning methods. A. Maciol amaciol@zarz.agh.edu.pl 1 Faculty of Management, AGH University of Science and Technology, ul. Gramatyka 10, 30-067 Kraków, Poland


Introduction
The pricing of products is a crucial problem that faces enterprises. Prices of products or services must, on the one hand, guarantee success in a competitive market and, on the other hand, guarantee to cover costs in the long term. The price level is a result of the marketing strategy of the enterprises. However, decisions that concern prices are not unlimited. It is generally accepted that the price cannot be lower than the variable cost per unit. Exceptions to this rule apply to emergency situations and are stigmatised by commercial law as dumping. Thus, anticipating the variable costs of new products becomes extremely important. The problem of determining the variable cost of a product has a different character depending on the manufacturing processes and the types of products used and produced. In the case of companies that manufacture standardised products that are placed directly on the market or that are warehoused as stock to fill future orders, the preparation and implementation of a new product is a long process. Starting mass production must be preceded by precise design work and sometimes the prototyping or production of a pilot series. The exact determination of variable costs of production is not a major problem. In an extreme case, if the variable costs determined for the conditions of production do not allow for setting the price at a competitive level, the company can withdraw from plans of launching a new product. Mechanized foundries that produce parts for the needs of the automotive industry could be a good example of companies that operate in this manner.
The problem of estimating direct costs is especially important in companies that manufacture in response to the products that are ordered. This type of participation in the market is defined as versatile manufacturing. Companies that operate in the sector of industrial goods usually negotiate with clients and bid against other companies for each of the orders that they receive, and they customise the product for each client [1]. Versatile manufacturing companies include engineering-to-order (ETO) companies, which means that the client's order requires the creation of a design, and make-to-order (MTO) companies, which manufacture the product based on the design provided by the client [2]. Most foundries operate on the basis of these rules. They produce machine parts, elements of complex products, or trade products in small batches. The research was conducted in Polish foundries, which are currently dynamically developing. In a majority of foundries, the versatile manufacturing model is applied. Companies that operate on the basis of this model must be the first to negotiate the quantity, date of delivery and price with the client. This process is called request for quotation (RFQ).
The situation is simple when such products have been manufactured by a foundry earlier because the costs and profit margin are known. It is much more difficult to answer the request for quotation in the case of a cast for which a factory does not have on offer or which has not yet been produced. The traditional and lengthy procedure of product development involves the execution of a product design and the calculation of the production costs of an economical service, which is increasingly less suitable for practical use. This circumstance occurs because in a highly competitive market, a long and imprecise procedure of customer service cannot be afforded because it can lead to losing customers or an unprofitable sale of the offered product. Hence, the request for quotation process must be fast, flexible, and reliable. This method is the only way that can provide the reconciliation of the customer's and company's interests. In the literature [3][4][5][6], it is possible to find many proposals for computer support for the RFQ process. Most of these proposals do not provide adequately reliable results of this estimation due to the specificity of the foundry process.
In our research, the hypothesis that good results can be obtained due to the application of the methods of knowledge-based systems for estimating the variable costs of metal casts was verified. In our view, derived from earlier research, rule-based systems correspond with this assumption. In the first phase, a classical rule-based system that implements crisp knowledge and an inference engine based on first-order logic have been accounted for. The obtained test results were compared with those offered by the application of fuzzy reasoning systems. The two most common methods of fuzzy reasoning, the Mamdani's and Takagi-Sugeno methods, were used here.
In the case of crisp and fuzzy reasoning, the same idea of knowledge acquisition was used, namely, learning by examples, which is considered to be the method that can best reflect the reasoning of experts.

Cost estimation methods-a review
As mentioned above, to determine what price to offer to the customer, the company must first estimate the product's manufacturing cost. However, the estimation of the costs is no trivial task. In general, versatile manufacturing companies estimate costs based on textbook specifications only in the simplest cases or as a starting point for the real estimation [1]. It is, therefore, common for estimations to be generated by experts, and parts of the said estimations are based on unwritten rules and the previous experiences of the estimator.
In the most general way, the methods of product cost estimation (PCE) can be divided into two groups: quantitative and qualitative, as shown in Fig. 1. The techniques that are qualified for the first group can be used in cases where there is a possibility of building a suitable model for a statistical or analytical procedure that allows for a procedural determination of the cost, which depends on the explicitly and formally defined features of the product. Unfortunately, in the case of most products of the metal industry, for which specific technological processes are used, it is not possible to build a statistical or analytical model that allows for the cost estimation. The presented research was focused on the latter of the above groups of cost estimation techniques, namely, the qualitative methods. The authors of [7,8] divide this class of methods into analogical and intuitive methods. The analogical methods are based on the similarity between the new product and past cases. These methods include regression analysis and artificial neural networks as well as case-based reasoning under analogical methods. Unfortunately, the use of these methods requires access to large databases of previously manufactured products, which is not always possible. They are not useful also in cases in which the features of the new product differ significantly from those of the previously produced products. In the case of versatile manufacturing foundries, we must frequently address this situation. The intuitive methods based on the use of the previous experience of technologists, but not necessarily on specific examples, are much more universal. They use expert knowledge and therefore allow us to solve the above-mentioned problems. This group of methods [7,8] includes, quite wrongly in our opinion, case-based methodology (evidently, this approach is the analogical method [9]). However, for the realization of this approach, decision support systems (DSS) based on declarative knowledge representation can undoubtedly be considered. The main purpose of these systems is to assist estimators in making better judgments and decisions at different levels of the estimation process by making use of the stored knowledge of experts in the field. For years, decision support systems based on declarative knowledge representation have successfully been used in the areas of designing production processes and estimating the cost of manufacture. In the paper [10], a rule-based expert system prototype is proposed for the selection of casting processes. The selection of the process parameters and the component features is represented by means of rules. The criterion for the selection of the technology of casting is the predicted direct cost of production. The results of similar studies are presented in [11]. However, it is rightly recognized that the choice of technology and, thereby the estimation costs, is not an easy problem to formalize. For this reason, Jahan-Shahi et al. [12] investigated the application of fuzzy logic techniques to the estimation of cost variables that are not directly related to the manufacturing process but that affect the time and the cost. Similar research was conducted by, inter alia, Mohamed and Celik [13] and Wang et al. [14]. The test results shown in [15] are especially interesting. The test results shown are especially interesting. The author developed a system for price estimation for the electroplating industry by combining rule-based reasoning with fuzzy logic. In this area, the difficulty of estimating the material weight leads to tremendous errors in the price quotations because there is no time to conduct the tests.
In many publications, we can also find information on the use of various techniques to estimate the cost of production based on knowledge-based reasoning methods. An expert rules system was developed by Kingsman and de Souza [1] for cost estimation and price setting in versatile manufacturing companies that address make-to-order systems. Similar studies have been presented, including in [16][17][18]. There have also been efforts made in an attempt to use the fuzzy-logic approach for estimating the cost [19]. This approach to cost estimation is especially helpful in handling uncertainty. However, estimating the costs of objects with complex features using this approach is quite tedious and requires further research in the area. The results presented in the cited work are conceptual, and their effectiveness has not been confirmed by the test results. Apart from the two main groups of cost estimation methods mentioned above, reports of attempts to create hybrid solutions using rulebased reasoning systems and web technologies can be found in the literature. These approaches often combine the analogical approach and the analytical approach. The solutions proposed in the studies [20][21][22][23] can be included in this group.

Problem formulation
Accurate prediction of variable costs with respect to new products under the conditions of request for quotation (RFQ) is a long and thus costly process. Unmistakable facilitation is the ability to use commonly available tools: CAD and CAE and simulation tools (e.g., for foundry PRO-CAST). However, obtaining reliable ratings requires the design of the manufacturing process and the assessment of the additional risks that are associated with, for example, deficiencies that could arise in the implementation phase [24]. In some cases, it is necessary to conduct complex analyses based on numerical methods or even conduct experiments on a laboratory scale. Such complex procedures still do not guarantee that the results will help to eliminate all of the risks. It can, for example, turn out that wrong numerical methods were chosen or that the transfer of laboratory experiments to an industrial scale is difficult if not impossible. On the other hand, competitive conditions limit the possibility of extending the RFQ process. Customers expect fast answers to their needs. Thus, we must address an obvious conflict between the accuracy and risk estimation of the costs and the time constraints that result from the demands of the market. This concern is especially evident in a situation in which the RFQ process is conducted in an automated way in a network of the B2B type. The results of the work that has been conducted in this area are presented, among others, in the publications of [25,26]. It appears, however, that the concept of e-marketing in the area of technologically complex and unique products is far from realised. Regardless of the innovative problem of computer support, although far from realisation of the vision, the RFQ process remains valid. The essence of the research problem that is associated with the estimation of the cost of production under the conditions of the RFQ is to find methods and principles that on the one hand will allow for a simplification (simulation) of the process of cost estimation and on the other hand will ensure a satisfactory level of accuracy and reduce the level of risk (which is possible to obtain under certain conditions). In our opinion, there is no single solution for such a task. The situation of enterprises that are producing goods with high levels of technology and high added value for a relatively small but well-recognised group of consumers is quite different from that of producers of goods that are feasible to produce by many competing manufacturers. In the first case, the recipient accepts the fact that the RFQ process must take a long time and that it is high-risk. In the other case, manufacturers are forced to make quick and high-risk pricing decisions. The problem is so serious and difficult to solve that it has become the target of many studies. Reviews of methods and techniques for estimating prices and costs in the RFQ process are presented in the publications of [7,8].
The analysis of data from Polish foundries conducted by us showed that the determination of the actual cost of implementing new and repeated orders is extremely difficult. This difficulty is due to the specific nature of the casting process. Firstly, the post facto determination of actual production costs with the existing computer systems is not always accurate. For example, the cost of the energy that is used to produce moulds and cores cannot always be properly separated into individual production orders. Even in the case in which the cost estimation before manufacturing is quite precise, the use of analogical techniques can lead to errors. The problem of the deployment of castings in a mould can be proof of that. In some cases, engineers design the process in such a way that a few castings are placed in one large mould; in other cases, they consider that this solution is not preferable. Obviously, the number of castings placed in one mould affects the cost of the production order. The problem of estimating the costs cannot be solved in the simple way suggested by the authors of the proposed analogical techniques.
Finally, the problem of estimating the costs can be defined as follows: 1. The manufacturer receives a request for quotation that concerns a not-yet-manufactured or a significantly changed product. 2. The client requests a rapid response, and the potential attractiveness of the contract and the external conditions indicate that such a decision should be taken when accepted by the customer at the lowest possible level of risk. 3. Due to the inability to implement the relevant studies and research, the only solution is to estimate the cost of production based on the more or less well-defined features of the cast and expert knowledge.
A major problem that is associated with the use of our proposed method is to determine which features of the product determine the production costs. A similar problem occurs in determining the economic aspects of the selection of the technology of castings manufacturing. Casting design involves a wide scope of expertise, which aims at the economical design of castings that achieve the desired functional performance [10,11,27,28]. Some of the main critical attributes within casting design and, hence, the cost estimation, include the following: -geometric complexity, including the casting integrity, wall thickness, internal features, fillets and radii, among others, -casting accuracy, including dimensional tolerances and surface finish, -size and weight, -casting or mould stripping, which involve aspects such as pattern, mould, casting orientation, parting planes and draft angles, -shape and size of cores, alloying elements, type of moulding sand and many others but most often only selected (significant) factors are sufficient for a reliable description of the dependency of the cost on the cast properties.
The casting accuracy and, to some extent, the casting geometric complexity are, in turn, influenced by the alloy to be cast. For example, both the dimensional accuracy and the minimum section thickness achievable with a given casting process are alloy-dependent. The selection of the appropriate features for cost estimation depends in an obvious way on the production structure of a foundry, the market requirements, the characteristics of the production processes and, above all, the characteristics of the production program. In any case, it is necessary to account for the cost model for all of the parameters.
The most natural way to solve the problem is to use the engineers who are employed in the company to estimate the cost on the basis of a description of the object (in the form of a CAD description or a less precise description), who, based on their own experience and a possibly simple preliminary analysis, determine to which cost class a specific RFQ can be allocated. It is the best solution from the point of view of confidence and credibility ratings but extremely difficult to implement. In most cases, foundries do not have an adequate number of expert engineers who could quickly solve problems of this type. The approach should also account for the fact that not all engineers have the appropriate experience (assuming that they have the appropriate knowledge), and not all can appropriately solve the problem of estimating the costs for various RFQ.
Considering previous experience [24] as the basic hypothesis, was assumed that the cost estimation could be achieved by a rule-based system. The knowledge that is necessary for decision-making will be acquired from the experts by learning from examples. The essence of this solution comes down to the following procedure: 1. The features of the castings with an acceptable production program are saved in the form of linguistic variables; experts make decisions about the method of defining variables, for example, the weight of a cast can be described by intervals (e.g., ≤ 5 kg, from 5 kg to 10 kg, and so on), symbols ('low', 'middle', 'high'), or numerically on a certain scale (e.g., from 1 to 5, 1 to 10, and so on); 2. Because a relatively large number of (not always interrelated) characteristics must be considered, it is necessary to group them by technological similarity (geometric, casting accuracy, size and weight, casted alloy, and so on); 3. Examples are generated as the Cartesian product of the values compared to the characteristics of each group separately; 4. Experts assess individual examples; they can be used as the same linguistic measures (e.g., "simple in execution," "complex," "very complex," and so on), or as a numerical measure that is related to a certain scale; 5. The next step consists of estimating the partial aggregation; if it has a linguistic character, further examples are generated, which present all of the possible combinations of the assessments of the partial values, and the experts determine the final level of the cost; in the case of a partial numerical rating, the final grade is calculated by an arithmetic formula.
The expert knowledge is coded as if-then rules, which are hierarchically organised into sub-rule bases. The need to structure a knowledge base by separating the intermediate variables is due to the phenomenon of having an exponential "explosion" of the number of rules (the number of rules grows exponentially with the number of variables that are in the premises). The introduction of intermediate criteria "artificial" or partial variables) is the only possible way to limit the complexity of description and to bring the knowledge-based model to a form that is manageable by the experts.
The problem of converting the input data for operational decision-making needs involves the adjustment of the description of the RFQ to the adopted model of knowledge. If the knowledge is based entirely on the linguistic variables and the description of the RFQ is sufficiently precise, then the pre-treatment of the data is reduced to transferring the data to the format of the knowledge base. However, in a case when some of the variables in the model of knowledge are linguistic variables or the RFQ is not accurate, it is necessary to conduct a preliminary assessment of the parameters of the casting by technologists to make it possible to draw inferences.
A meaningful advantage of the above-mentioned approach is a simple model of human reasoning, a simple algorithm of knowledge acquisition and reasoning and a partial solution of the exponential "explosion" of the number of examples and, in consequence, rules. Unfortunately, in some cases, the inference based on this concept could be unreliable. This concern applies to situations in which the knowledge about the impact of the casts' features on the production cost is very complex. The hierarchy of knowledge, which inevitably simplifies the model and thus reduces the possibility of effective reasoning, does not solve the problem of the assessment of many examples that vary by a small degree. Whenever this method is used, it is necessary to find a compromise between the detailed description of the variables and the number of examples of rules that it is necessary to generate.
This problem was noticed while working on the creation of intelligent control systems. To solve this problem, the use of fuzzy reasoning methods was accepted. Using this approach significantly reduces the number of rules in the knowledge base while maintaining a relatively high level of compliance when mapping the input variables. The concept of fuzzy models was originally created for the needs of fuzzy logic control (FLC) and was derived from control theory based on mathematical models of the open-loop process to be controlled [29]. Their essence boils down to the realisation of the following inference: one or more crisp numerical values appear on the system input, and an inference engine using a knowledge model sets the value of one or more output values, which are also crisp numerical values. The difference between the classical control systems and the fuzzy systems lies in the fact that the latter use the fuzzy inference mechanism. Therefore, the fuzzy model used in control is composed of three modules: -the fuzzification module, whose task is to transform the crisp input values into linguistic variables, -the fuzzy inference module, -the defuzzification module, which transforms linguistic conclusions into crisp numerical values.
Otherwise, it appears that the model used for inference is based on linguistic variables that are described by discrete fuzzy sets. In this case, fuzzification is not necessary. Still, depending on the needs, the conclusions can be defuzzified or not. Regardless of the treatment of inputs and outputs, the same rules of inference can be applied.
It is widely recognised that the fuzzy approach is perfectly suited to problems that have uncertainty. To a small extent, this approach concerns the problem of the RFQ valuation from the assumption that the client knows what parameters the supplier must achieve. However, these solutions significantly increase the expressivity of the knowledge base. On the basis of the same number of examples as in the case of classical rule-based methods and, as a result, the same number of rules that the reasoning engine can correctly interpret, an incomparably larger number of real cases is depicted by a combination of crisp and linguistic variables.
There are many methods of fuzzy reasoning. All of them realise the above-mentioned scheme, although they differ by the mechanism of inference. The most common methods use a relatively simple knowledge-definition model and inference mechanism: Mamdani's fuzzy inference and fuzzy reasoning with Takagi-Sugeno models. Studies on the use of more sophisticated methods such as RIMER, for example [30], are also known, but they relate to situations in which the description of the analysed cases is largely uncertain and expert opinions are contradictory, which we do not address when estimating the implementation costs of the RFQ.
Firstly, the ability to use Mamdani's Fuzzy Inference was tested. The model reasoning method used in Mamdani's is more expressive than the classical reasoning systems, but for more complex relationships between antecedents and consequences, it can give an inaccurate assessment of the production costs on the basis of the characteristics of castings. It was decided that the possibility and effectiveness of the use of fuzzy reasoning with Takagi-Sugeno models should also be explored. The essence of the concept of Takagi-Sugeno is to present the conclusions in the form of determining the value of the output variable as a function of the antecedent variables' values. This solution can be especially useful in the case in which the antecedents are undoubtedly numerical values.
Regardless of the model of the knowledge and inference methods, the learning by examples approach to knowledge acquisition was used. In addition, for the Takagi-Sugeno model, a simple algorithm that allows us to generate a function based on examples of the relationship between the premises and conclusions was used.

The formulation of a numerical example
A wider use of the proposed approach requires research to find the answer to the question of what can be achieved by accurate cost estimation. Preliminary studies were conducted on the example of the production program of a foundry that produces water-system fittings from grey iron and ductile iron in sand moulds in a weight range from 4 to almost 500 kg. The preliminary analysis provided by the manufacturer's product descriptions and price lists allowed to us to assume that the catalogue unit price (and thus the unit cost) depends on the geometric complexity of the cast, the type of iron and the weight of the cast. In turn, the geometric complexity depends on the shape complexity, the compactness and the number of cores. Other factors, i.e., the shapes and sizes of the cores, alloying elements, the type of moulding sand and so on, do not differentiate the set of examples that are taken into consideration. The concept of the shape complexity and compactness is illustrated by examples of the products presented in Fig. 2. The shape b a c Fig. 2 Examples of products of varying shape complexity and compactness: a middle shape complexity, middle compactness, b high shape complexity, middle compactness, c low shape complexity, low compactness complexity and compactness are related to the number of types of faces, the different face orientations, the levels in the face hierarchy and many other geometric futures and can be formally defined [31]. In the presented research, it was assumed that due to the specifics of the method and the limited availability of the data under the RFQ conditions, the experts' intuitional assessment presented in the form of the linguistic values is sufficient.
The aim of the study was to formulate models of knowledge that would allow us to determine the unit cost based on the description of the listed features using an inference mechanism. Due to the lack of studies that directly focused on the unit costs as a measure of the diversity, the resulting variable adopted a unit list price. In some ways, this approach could affect the quality of the estimation because the seller could also include a marketing policy in the price. However, for a simple product such as castings, it can be assumed that the list price is directly proportional to the unit cost, and the marketing policy is implemented by the manufacturer by means of an independent system of rebates, discounts, and commissions. To assess the quality of the cost estimation, experiments were conducted that involved determining the expected cost of using three mechanisms of inference for 57 representative products. These products are the hatches, the cast iron boxes for plumbing fittings, the two-flange knee, the four-terminal network, and the twoflange reducer. The Example Set exhausts almost all of the space of the premises rules. The estimated results on the prices are compared with the prices that were declared by the manufacturer.
The examples used in our experiments are presented in Table 1. The character of the production program of the foundry, which was used as a source of data for the tests, naturally does not cover all of the possible combinations of the input factors taken into account in the knowledge model formulation, but it is a sufficient testing set.
Due to the character of the variables, it was possible to automatically generate the examples in the form of a Cartesian product. Then, based on the experts' judgment using the real examples presented in the description of the manufacturer's offer, the crisp values of the expected unit price were assigned. The knowledge model can be presented in the form of two decision tables (Tables 2 and 3).
The reasoning is realised in two stages (steps). During the first stage, the geometric complexity is established as a result of the relations between the shape complexity, compactness and cores number, as defined by the set of rules ( Table 2). During the second stage, the cost is established on the grounds of previously evaluated geometric complexity as well as the type of iron and the weight of the cast ( Table 3). The reasoning mechanism is shown on the flowchart (Fig. 3).

The solution to the problem using conventional (crisp) reasoning
In the case of the conventional approach, crisp linguistic variables were used to describe the characteristics. The variables assume the values of the domain {low, middle, high}. The values of the shape complexity and compactness variables were assessed directly on the basis of drawings of the castings. The cores number of variables was determined according to the following principles: no cores -cores number = low; one or two cores -cores number = middle; more than two cores -cores number = high. In the case of the weight, the following rule was adopted: ≤ 10 kg -weight = low; > 10 kg and ≤ 60 kg -weight = middle; and > 60 kg -weight = high.
To conduct a simulation, the original rule management system REBIT [24], which is based on a language that is an extension of propositional logic with types and variables, was used. REBIT is equipped with tools to facilitate the generation of examples and acquisition rules on their basis. Based on the decision tables, two sets of rules were generated. A comparison of the obtained results with the prices declared by the manufacturer is presented in Fig. 4.
The mean absolute percentage error of the prediction was 9.14 %. The maximal relative deviation of the predicted price value in relation to the actual value was 22.89 %.

Mamdani's Fuzzy Inference method
Mamdani's method requires that all of the input variables are either directly presented in the form of fuzzy linguistic variables or transformed into this form. In the presented example, we must address the input variables, which are presented in different forms. For this reason, it is necessary to transform some of them into a form of linguistic fuzzy variables. For all of the linguistic variables (outside of the type of iron), the same linguistic domain {low, middle, high} was assumed. In the case of the type of iron, the crisp values were addressed, but due to the formal requirements of Mamdani's inference method, they were converted into a form of linguistic variables based on the domain (grey, ductile), where the membership function is binary.
The weight values are crisp values and, in Mamdani's approach, must be fuzzified. It is well known that the performance of a fuzzy reasoning tool depends on the selection of a membership function. They might be linear (i.e., triangular and trapezoidal) or non-linear (i.e., sigmoid, Gaussian, bell shaped). It is assumed that a linear function (trapezoidal) represents the variability of the weight variable sufficiently.  The proof can be found in the literature [32]. In these studies, it has been shown that in the case of a manually constructed fuzzy logic system, the type of membership function is negligible (in contrast to some other approaches, e.g., adaptive network-based fuzzy logic systems).
The following principles were assumed for the formulation values of the variables to describe the respective properties of the casts: -the values of the shape complexity and compactness variables were evaluated similar to in the conventional  approach, i.e., directly based on the drawings of the castings, where the experts determine the value of the membership function, -for the cores number, the method of determining the value of the variable was the same as for conventional reasoning; the difference was only the method of saving it -as a fuzzy set on the domain low, middle, high with a binary membership function, -in the case of the weight, input membership functions are trapezoidal functions; they can be represented in the Fig. 5 or in the following form: T low (0, 0, 4, 10) T middle (4, 10, 10, 100) T high (10, 100, 500, 500) The values of the logical variables that are necessary to calculate the value of the membership function were set according to the formulas presented in [33].
To estimate the prices, the mechanism described in [33] was used. Fuzzy reasoning by Mamdani's method can be explained by the example of a box for an underground hydrant (the first row of Table 1).
In the first step, an inference is aimed at determining the membership function of the conclusions to the output set (geometric complexity -y) which is presented in tabular form based on similarly presented membership functions of antecedents: To determine the degree of membership of the conclusions to the low, rules for which the conclusion indicates that value are searched for. These rules are the following: IF shape complexity = low AND compactness = middle AND cores number = low THEN geometric complexity = low IF shape complexity = middle AND compactness = middle AND cores number = low THEN geometric complexity = low In the above set of rules are omitted for clarity these ones, in which at least one of the values of antecedents membership function is 0.
With the PROD operator, the membership of the y conclusion to the 'low' value was determined: μ low (y) = 0.90 · 0.95 · 1 + 0.1 · 0.95 · 1 = 0.95 We proceed similarly for the conclusions "middle" and "high" and obtain the following result: In the second step, the inference is aimed at determining the membership function of the conclusions to the output set (cost). For the antecedents, we have the following membership functions for geometric complexity and weight: After the defuzzification, the cost is equal to 6.43 (see Fig. 6).
To accomplish a simulation, the original program that was adapted to the specific of problem was used. First, the value of the geometric complexity was deduced and then the predicted price value. A comparison of the obtained results with the prices declared by the manufacturer is presented in Fig. 6.
The mean absolute percentage error of the prediction was 8.02 %. The maximal relative deviation of the predicted price value in relation to the actual value was 21.29 %.

Takagi-Sugeno model
The structure of the knowledge base in the case of the Takagi-Sugeno method is the same as when Mamdani's method was used; the difference is only the formula of the rule conclusions. The Takagi-Sugeno approach requires the presentation of input values in a numerical form. Because only the weight of the cast and the number of cores can be directly saved in a numerical form, the other features were transformed into a numerical form by the experts. All of these variables are described on a scale of 0 to 10. It was also assumed that a value of the shape complexity, compactness and geometric complexity in the range of 0 to 3 corresponds to the linguistic variables "low", while the range of 4 to 6 corresponds to the variable "middle", and the range of 8 to 10 corresponds to the variable "high".
Although the cores number is a numerical value, it was considered that due to the insignificant differences in the technological difficulties, a projection of this variable on the domain (1, 2, 3) will be more favourable for a larger number of cores. It was assumed that the cores number variable will be described as follows: (no cores -cores number = 1, which corresponds to the value "low"; one or two cores -cores number = 2, which corresponds to the value "middle"; more than two cores -cores number = 3, which corresponds to the value "high").
In the case of the type of iron, we address crisp values (grey, ductile) that are converted into the values 1 -grey and 2 -ductile.
In the case of the weight, it was assumed that the crisp weight value will be included directly in the formulas. This value of less than 10 kg corresponds to the linguistic variable "low", between 12 and 60 kg to the variable "middle" and above 65 kg to the variable "high".
For intermediate values, a measure of belonging to neighbouring sets will be determined. A function that describes the dependence of the output variable on the input variables is set for each rule. This procedure is based on solving a set of equations that present the impact of the extreme values of the input variables on the appropriate output variable and the equation that describes an intermediate case. This approach can be exemplified by a rule that is used for determining the geometric complexity: IF shape complexity = low AND compactness = low AND cores number = 1 THEN geometric complexity = middle The equations that describe the dependence of the geometric complexity on the input variables have the following form: 0a 1 + 0a 2 + 1a 3 = 4 3a 1 + 3a 2 + 1a 3 = 6 3a 1 + 0a 2 + 1a 3 = 5 After solving the set of equations, we obtain the following form of the first rule: In a similar way, the functions for determining the value of the cost were generated, depending on the geometric complexity, the type of iron and the weight. An example of the set of equations for the following rule: IF geometric complexity = low AND type of iron = grey AND weight = low THEN cost = 9 has the following form: 0a 1 + 1a 2 + 0a 3 = 9.5 3a 1 + 1a 2 + 10a 3 = 8.5 In this case, the output variable is exactly the estimated price (cost).
After solving the set of equations, we obtain the following form for the rules: R x : I F (x 4 = approximately low) AND (x 5 = grey) AND (x 6 = approximately low) T H EN (z = −0.33x 4 + 9.50x 5 + 0.00x 6 ) To estimate the prices, the method presented in [33] was used. The application process was conducted in the same way as in the previous examples. First, the value of the geometric complexity was deduced and then the predicted price value.
The same case as before can be used to explain the mechanism of the Takagi-Sugeno method. The input parameters for the first step of reasoning are established as follows (the values of the shape complexity and compactness within the range from 0 to 10): the shape complexity (x 1 ) − 0.5, the compactness (x 2 ) − 4.75, and the cores number (x 3 ) − 1.0. Because all of the input variables are within the ranges that correspond exactly to the linguistic variables (respectively, the shape complexity -low; compactness -middle; and cores numbers -low), only one rule is necessary to use for the reasoning: where y is geometric complexity. Hence, the calculated value of the geometric complexity (x 4 = y) is equal to 0.81 and is used in the next step of reasoning. The other antecedents in the rules used at this stage are established directly (iron type x 5 = 1 and weight x 6 = 20.5). Similar to in the first step, only one rule is necessary to use in this reasoning: where z is the cost, and its calculated value is equal to 5.35 (see Fig. 7).
To accomplish a simulation, the original program was used. A comparison of the obtained results with the prices declared by the manufacturer is presented in Fig. 7.
The mean absolute percentage error of the prediction was 6.51 %. The maximal relative deviation of the predicted price value in relation to the actual value was 17.00 %.

Assessment and comparison of the results
The obtained results of the cost prediction are very promising and demonstrate the effectiveness of all of the analysed methods. What is disturbing is only the high level of the maximal relative deviation. This concern could be due to the above-mentioned error, which could be associated with the need to adopt the assumption that the list price is a true reflection of the cost of production. Such large deviations apply to few cases, regardless of the prediction method that is used. Another possible cause of these variations can be   Table 4. As expected, the fuzzy reasoning methods gave significantly higher prediction accuracy. Due to the nature of the problem, it should also be expected that the Takagi-Sugeno model will give better results than Mamdani's method. This finding is caused by the higher expressiveness of the Takagi-Seguno method, which arises from the more detailed scale of the variables' description. Thus, a detailed description used with other approaches (crisp and Mamdani's) would lead to an exponential explosion in the number of rules (the number of rules grows exponentially with the number of variables in the premises). Because the relationships between the antecedents and conclusions are described with a function, the capabilities of the differencing of the reasoning results between so-called important significant points constitutes a model in which the rules increase. Note, however, that the fuzzy reasoning methods are computationally more complex and the knowledge acquisition rules are more complicated.
Unfortunately, in the literature, there are no relevant data that would allow for a comparison of the effectiveness of these methods with other experiences. The only publication that presents the results of such research is a system developed by Chan [15] for price estimation in the electroplating industry by combining case-based reasoning, rules and fuzzy logic. Their system yielded results that had an average error of 14.72 %, which was smaller than that of 20.05 % for a person in their case studies. Unfortunately, the methodological assumptions and the method of conducting the research presented in the above-mentioned paper do not allow us to draw far-reaching conclusions.

Conclusions
The aim of our research was to verify the hypothesis that for the estimation of the variable costs of metal casts, appropriately good results can be obtained by using knowledgebased systems that map not only knowledge but also a method of inferencing by experts. From this perspective, which was derived from the earlier research, rule-based systems correspond with these assumptions. In the first phase, the classical rule-based system, which implements crisp knowledge and an inference engine based on firstorder logic, was accounted for. The obtained test results were compared with those offered by the application of fuzzy reasoning systems. The two most common methods of fuzzy reasoning, Mamdani's and Takagi-Sugeno, were used here.
In the cases of crisp and fuzzy reasoning, the same idea of knowledge acquisition was used, namely learning by examples combined with an analysis of observations (real examples).
The formulated hypotheses were verified based on industry data. The obtained results of simulations show that in the case of the least accurate method of crisp reasoning, the maximal relative deviation of the prediction was close to 9 %, and the absolute percentage error of the prediction value was close to 23 %. As expected, the most accurate results were obtained with the Takagi-Sugeno method (6.51 and 17.00 %).
Undoubtedly, the results obtained by us confirmed that the rule-based approach and, especially, fuzzy logic reasoning systems can be used to estimate the cost of the products (in our case, the metal casts). It turned out that such good results can be achieved using intuitive techniques that are only possible to use in the case of the lack of an appropriate database of comparative data necessary to implement the analogical methods. Another important conclusion is associated with the formulation of universal knowledge about the cost of the casts, which is based only on certain a priori principles. It was found that at least based on earlier experience, such rules cannot be formulated. The dependence of the cost of production on the features of the casts is significantly conditioned by the specifics of the program and the production process. It follows that the formulation of a knowledge base for cost estimation must be conducted separately for each case of the program and the production process. However, some general methodological rules can be universal. Furthermore, extended research requires a solution to the problem of how to pursue knowledge acquisition, especially for fuzzy-logic methods. What is alarming is also the fact that although the average error of the cost estimation has reached a level that can be considered to be satisfactory, it can be a risky level of maximum error. This circumstance leads us to seek methods, especially in the area of fuzzy-logic reasoning methods, that will allow us to reduce the maximum error by better fitting the model of knowledge to the real dependence between the production costs and the casts' features. Creating and implementing the business practice of knowledge-based cost estimation techniques requires the execution of detailed research based on data from the foundry while considering such an intention. Only this type of research enables managers to estimate the risks that are associated with an approximate assessment of the production costs and, hence, the profitability of the implementation of a request for quotation. Managers and sellers will be able to consider the conditions under which taking such a risk is acceptable.