THECNICAL PAPER: SISFLOR: A COMPUTATIONAL SYSTEM TO DETERMINE THE OPTIMAL TREE BUCKING

1 Bachelor’s in computer science, Assistant Professor at UFES/Alegre-ES, rodrigo.f.silva@ufes.br 2 Systems Analyst Technologist, Assistant Professor at UFES/Alegre-ES, marcelo.aguiar@ufes.br 3 Forest Engineer, Assistant Professor at UFSJ/São João Del-Rei-MG, PQ scholarship holder of CNPq, mayralmsilva@ufsj.edu.br 4 Forest Engineer, Associated Professor at UFES/Jerônimo Monteiro-ES, PQ scholarship holder of CNPq, fernandes5012@gmail.com 5 Forest Engineer, Associated Professor at UFES/Jerônimo Monteiro-ES, PQ larship holder of CNPq, ribeiroflorestal@yahoo.com.br

The diversity of multiproduct produced by the forestry activity depends, among other factors, on the management plan to which the forest has been submitted. This plan is aligned with the needs of the consumer market, which, governed by the law of supply and demand, has great influence on which products will be produced, in addition to bringing dynamism to the enterprise (SILVA, 2018). As for forestry, it is necessary to have planned how the raw material will be mapped. The objective is to maximize financial yields by optimizing the use of available forest resources, considering production costs, market demands and marketing values for the multiproducts.
The cut pattern, or forest assortment, is the sequence of products that can be obtained from a given bole, which may be the same or different from each other (SILVA et al., 2015a). Such products are generally logs of different lengths and diameters of the fine point (fpd). The cut pattern can vary, mainly depending on the products that will be removed and the dendrometric variables (diameters, height and volume) of each felled tree.
Determining the optimal assortment of trees is one of the main challenges faced by the managers, considering the individual characteristics of each bole. According to Arce et al. (2004), this task is performed almost exclusively by the chainsaw operator, based on his or her intuition, which can compromise the profitability of the forestry business.
This motivates researchers to develop analysis and simulation systems that help decision making, which is fundamental in determining the most profitable assortments. Studies in search of optimal assortment solutions in the face of a combinatorial explosion with several alternatives are part of a specific category of Operational Research (OR) problems known as the Cutting and Packing Problem (PCE) (SILVA et al., 2015 b). Such a problem still fits into a general class of problems known in the complexity of algorithms as NPdifficult (CORMEN et al., 2012).
Considering that the current lack of modern information systems, compatible with the currently available technologies in the forestry area, aimed at solving the problem of forest assortment, the objective of this work was to implement a computational system for calculating the Forest assortment (SISFlor), capable of determining the optimum assortments of the boles in order to maximize the revenue according to the commercialization of harvested forest products.
The optimization method implemented in SISFlor was the Dynamic Programming (DP) (MEENAKSHI and RAWAT, 2017). The problem of forest assortment was modeled at the level of an individual tree in order to maximize the value of the stem (bucking-to-value) (LAROZE, 1999;NYBAKK et al., 2008). The mathematical model used was based on Arce (2000). The built application also has a friendly and intuitive interface, in order to facilitate the configuration of the input data and the system parameterization.

MATERIAL AND METHODS
The study of the forest assortment quantifies the multiproducts that can be obtained from a bole (KOHLER, 2013). Thus, the trees were characterized by their Diameter at Breast Height (DBH), their height and a function that describes the diametric reduction from the base to the top (tapering function). The logs (marketable products), in turn, were defined by their length, fpd and sales value (R$.m -3 ). The height of the stump was placed as a configurable parameter in the system, although the value of 0.1 meters is commonly stipulated. SISFlor was implemented in the Java programming language (DEITEL, 2010) using the integrated environment of Netbeans development (DANTAS, 2011).
The total height of the trees, if it has not been Engenharia na Agricultura, v.28, p. 192-201, 2020 informed, is measured using the DBH and an adjusted hypsometric relationship and inserted in the system. The hypsometric relationship is a mathematical equation that enables to estimate the height of other trees using the information (DBHheight) collected from some trees (SHARMA and BREIDENBACH, 2015;ÇATAL and CARUS, 2018). The profile of the tree trunk was adjusted according to a tapering model (SILVA et al., 2011), whose coefficients are informed by the user. The hypsometric relationship and the tapering model implemented are described below.
= diameter i estimated over the bole, and h i = height i over the bole.
The total volume of the bole was calculated from the integral of the tapering function considering the height of the stump and the total height of the tree. In this sense, the system also allows to calculate the volume of any log from the initial and final heights of the bole informed by the user.
The information regarding the marketable products are the following: log length, minimum fpd, maximum fpd and value (in R$.m -3 ). SISFlor allows the user to insert, remove and edit the multiproducts considered for cutting during harvest. The number of marketable products can be high, such as 23, 42 or even 106, as shown by the works of Santana (2013), Menon (2005) and Wang, Ledoux and Mcneel (2004), respectively. This highlights the importance of developing a computational system capable of finding the optimal assortments, given the practical difficulties pointed out by chainsaw operators when determining such assortments through simple field experience with harvesting.
The optimization strategy adopted was the DP. It is an algorithmic technique that has been successfully applied in solving optimization problems originating from the most diverse areas, including PCE. This solution method consists of decomposing the original problem into a set of smaller and simpler problems to be solved, therefore, it is considered a technique to optimize multistage decision processes. The objective is to store the results of the subproblems already solved and, when they appear again, its results will be simply retrieved. Hence, this repetitive calculation is avoided, since the subproblems will be processed only once (PAPADIMITRIOU and STEIGLITZ, 1998;GOLDBARG and LUNA, 2005).
The implemented DP algorithm is based on the methodology of Arce (2000). From the base towards the tip of the bole, the algorithm continuously evaluates several stages, solving each one of them through recursive equations. Several cutting alternatives (states) in each of these stages are compared and only the most valuable is stored. By the principle of optimality, further decisions for the remaining stages will constitute an optimal policy, regardless of the policy adopted in the previous stages (TAHA, 2016).
The first step is to define all the cutoff points (useful numbers) in the bole from which the different assortment strategies will be evaluated. The pseudocode of the algorithm used to find the useful numbers is shown in Figure 1.
The recurrence equation used by Arce (2000) to maximize the gross revenue of the bole is given below. The order in which the different products are examined is established arbitrarily, without affecting the optimality of the result. In addition to the gross revenue accumulated in each of the useful numbers, other variables are also stored in order to control the remaining useful length, and the diameter of the bole corresponding to the height indicated by the state. Where, x = cutting point on the bole. l k = length of the k product. F k (x) = accumulated gross revenue of the best product combination up to x length using the first k products. P k = gross revenue of the log of the evaluated k product, and F k (x -l k ) = accumulated gross revenue of the best combination of the products obtained up to the length (x -l k ) using only the first k products. Figure 2) the formation of a network after the execution of the DP algorithm. In this case, the tree bole was divided into N segments, each with the length q. At each stage k (k = 0, 2, ..., N), all the m lengthable cutting products (L 1 , L 2 , ..., L m ) are tested and only the most valuable accumulated log combination is stored. In the end, the optimal assortment is the combination of products that have the highest value.

Kivinen (2007) exemplifies (
As an example, consider a fictitious 10-m bole to be drawn according to the sale of the following products (logs): 2.2 m for R$ 58.00 m -3 ; 2.6 m for R$ 65.00 m -3 and 2.8 m for R$ 71.00 m -3 . The network formed is illustrated in Figure 3. It is a targeted network with no cycles. The objective is to determine the optimal assortment among several alternatives, that is, the longest path between the origin (base of the bole) and the destination (tip of the bole). The last edges created with zero cost do not constitute a new log, but rather a necessary link to form the network and allow the processing of the solution method (SILVA, 2018).

RESULTS AND DISCUSSION
SISFlor, a computer system developed to optimize the forest assortment, presents a simple, intuitive and friendly graphic interface, which can also be used by users with little experience in forest harvesting. The input parameters are: DBH, height of the stump, height of the bole or the coefficients of the hypsometric relationship to calculate the height, the coefficients of the tapering function used and, finally, the characteristics of the products sold. The application screen can be seen using Figure 4.
The system calculates the optimal assortment per individual shaft. Thus, first, the user must inform the DBH and the height of the bole stump. If the height has been inventoried, it must also be informed. Otherwise, it must be calculated using the hypsometric relationship. By default, the Prodan (1965) model is suggested, in which only the values of the coefficients β 1 , β 2 and β 3 are informed. However, the system also allows the choice of other models.
The total volume of the bole is calculated based on the DBH, total height and tapering function of the bole. It is worth noting that the useful volume of the bole is usually lower than its total volume since the commercialized products have specific characteristics and may result in the failure of part of the bole stump. The tapering function configured as standard is the Schoepfer model (1966), therefore, it is necessary to inform the β 1 , β 2 , β 3 , β 4 and β5 coefficients of the model. In addition, it is also possible to calculate the individual volume of the logs removed at any point of the bole desired by the system user. This functionality allows different cuts to be simulated, removing parts that have defects or anomalies such as knots, protuberances and resin bags from the bole. Figure 5 shows the parameterization of dendrometric variables of the SISFlor. The model coefficients were obtained from Menon (2005).
The products are inserted in the system one by one, informing their respective identifications (ID), length, minimum and maximum fpd and commercial value. If many products are commercialized, they can be loaded into the system from the information available in a text file. Figure  6 illustrates the registration of some products. All fields mentioned above are editable.
Finally, SISFlor informs the optimal assortment as a result from the available data and calculated through the DP. All products that must be removed from the bole are made available sequentially, from the base towards the top of the bole. In addition, the Source: authors. amount collected from each log and its respective volume is reported, as well as the total amount collected from the bole and its useful length. The system internally uses 4 decimal places to calculate the value and volume of the logs supposedly produced, thus avoiding loss of precision in the rounding. The rounding strategy adopted was the round-half-even (IBM KNOWLEDGE CENTER, 2014), often referred to in the literature as "banker rounding". An example of an optimal assortment resulting from a bole with 30 meters in height and a 40-cm DAP is shown in Figure 7.
DP was proved to be an efficient and extremely fast method to find the optimal assortments, since   all the processing was done in just one second. Meenakshi and Rawat (2017) state that, among the methodologies traditionally used in the literature to determine the optimal assortment of the stems, DP has been predominantly used. In general, DP is considered more efficient because it significantly reduces the number of calculations to be made.

CONCLUSION
• A computational system denominated SISFlor was developed. This system is capable of quickly finding, through the DP, the optimal assortment of traced boles; • DP proved to be an efficient method to solve the problem of forest assortment at the individual tree level as it obtained the optimal result in just one second in all tests performed.
• The system was considered by users as easy to be used, intuitive and with a modern graphic interface, which can be easily used to assist decision making during forest harvesting.  Engenharia na Agricultura, v.28, p. 192-201, 2020