{'fraction_non_alphanumeric': 0.02118549574060033, 'fraction_numerical': 0.002854466794522992, 'mean_word_length': 5.2266037211885585, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Model for discrete optimal control of the enterprise’s financial processes

We consider a problem of financial resources planning where the processes of financial flows coordination of an enterprise under uncertainty are described with the discrete optimal control approach and methods of dynamic programming. We give a critical survey of theoretical and methodological approaches for financial resources planning problem. The financial flows dynamics is modelled with using the methods of system analysis, control theory, optimal control and methods of data processing under uncertainty. The model for the financial flows distribution has been developed. It uses the principles of optimal dynamic control under the criterion of cumulative non-payment risks and transaction and opportunity costs minimizing. The practical significance of the developed model is in its application for the financial planning in the enterprises that allows to improve its financial planning quality and to increase its management and operational efficiency.


Introduction
One of the most important problems for the control over an enterprises operational activity is cash balancing. Latest studies have shown that cash management models are still limited to known conception over nearly five decades without significant improvement. The substantive basis of the cash balance is still limited and not regarded as an investment, which has negative profitability (defined by the cash total cost), immediate liquidity, and risk associated with cash deficit. Therefore the cash balance should be considered as financial investments and examined the investment choices according to its variable liquidity, profitability and associated risk. Another relevant aspect is the methodology for cash management models development. The modern investigations have illustrated only deterministic and stochastic models without using computer modelling methods.
The evolutionary computational algorithms in accounting and financial management systems can reduce limitations when developing more complex models, decrease the model constraints and make computer implementation easier.
A number of studies devoted to financial management have established that the most of the articles is presented in journals of economics and finance, but in the 2000s with the evolution of methods and computer applications the major publication has been devoted to the operational research and computational optimization. This demonstrates a greater concern about the method, but not with the problem's formulation.
At present the problem of financial management and particularly cash balancing is a classic problem in business, economics, accounting, and finance. The discussions focus in these areas is to be covered not only mathematical features of methods and models shifted to but also its practical application.
One of the most important fields of the stable functioning maintaining and sustainable development of an enterprise is costs reduction associated with its industrial, investment and financial activities. Cost reducing (in terms of unreasonable costs) through effective operational management of financial resources becomes extremely important in a crisis and post-crisis periods of economic development [1,2]. The inefficiency of control and financial planning being leveled during periods of favorable economic conjuncture and in a growing market can lead to budget overruns during crisis periods and put enterprises on the bankruptcy. The purpose of the operational management of an enterprise's financial resources is the redistribution of financial resources based on the operational analysis of the current situation [3][4][5][6].
Studies in the field of operational management of financial flows cover various approaches and tools [7-15] and identify two types of problems:  cash flow forecasting. The required monetary reserve traditionally is calculated using the Baumol model [16], Miller-Orr and Stone models [17,18]. The features of these models are the precondition about stability, cash flows determinism and cash flows predictability regarding these properties. All of these models are static and do not take into account the probabilistic nature of financial flows in terms of time and volume. Therefore, the predictive ability of these models is not high and does not take into account the risk factors -solvency decline and liquidity, associated with the stochastic nature of cash inflows;  cash flow forming with a minimal financial loss. The basic conditions for this problem decision are: a) ensuring the inflows and outflows balance in accordance with established deadlines; b) achieving a uniform value of accumulated funds balance when the fluctuations of this value in the context of the sub-periods of the planning period are minimal, which, in turn, allows the use of temporarily free funds for reinvestment; c) creating the maximum possible amount of cash free for further use. These models and tools all share the following assumptions. Modern software and tools for operational financial management [19][20][21] uses mathematical models for financial inflow and outflow planning and do not take into account its dynamic and stochastic nature. Therefore, the development of new approaches and methods for modeling the operational finance management mechanisms based on accounting for such properties of financial flows as uncertainty, stochasticity, and dynamicity, is highly relevant and timely.

Payment calendar: features and modeling methods
The payment calendar is a detailed operational plan for the financial inflows and outflows; it interconnects all sources of cash receipts and expenses for a certain period [22]. It fully covers the enterprise's cash flows, makes it possible to link cash inflows and payments (in cash and non-cash) and ensures enterprise constant solvency and liquidity. The payment calendar is a monthly budget of positive and negative cash flow divided into days (weeks, decades). The main purpose of the payment calendar is to provide a maximum balance of positive and negative cash flows in each moment of the planned period, as well as to ensure the enterprise solvency. The system of receipt and expenditure of financial resources is stochastic since payment flows are uncertain both in terms and resources value. Therefore, the planning of the financial inflow and outflow by traditional methods based on deterministic forecasting schemes is not rather effective and does not does not match the financial system properties.
We assume the following futures of payment calendar: a) cash flows through various cash accounts are non-delimitated; b) accounts repayment plan is receivable.
As a rule, these futures are not used in the payment calendar designing. However, to ensure a required level of enterprise' solvency, it is necessary to take into account that the daily balances should be receivable and payable.
Any payment has two characteristics -the date of receipt and value of required funds. Payments (cost items) are divided into two categories: with a fixed date (salary, taxes and fees, repayment of accounts payable for raw materials, materials, electricity, water, repayment of a bank loan) and with a flexible date (premiums and fees, payments to other creditors, non-core purchases). The cash need with a fixed date is ensured by forming the necessary minimum cash balance. Expenditures with a flexible date can be made according to the following scheme. Expenditures are fully met with free cash resources. If all items of expenditures for the current day are satisfied and the remaining cash are non-zero, it is necessary to determine the direction of this balance spending. The distribution of free cash balance is based on the use of an optimization model of cash distribution. If at a certain period of time there is not enough free cash to cover some expenditure, the total amount of borrowed funds is formed.
Under our assumptions, distribution of funds for expenditure and sub-periods will be done according to the model of discrete optimal control.

Limits of model applicability and adequacy
The financial flows management is a sub-problem of the enterprise resource management problem. In turn, an enterprise's operational management problem aims at the study and modeling of the resource subsystem. We consider the transformation of resources into results, and the management aim is to ensure the most rational resource allocation for the production and sale and ensure the effective enterprise development. For this purpose, a variety of models have used that address specific private sub-problems. An integrated approach to enterprise resource management was proposed, for example, in [20]. In the problem of efficiency management, the required level of production efficiency is achieved based on the adaptation of the parameters of production and economic activity -production volumes, production costs. The focus is on the study of resource productivity and its impact on the production function and situational analysis of the economic behavior of the enterprise. In the problem of financial flow management, the optimal financial strategies of an enterprise are determined, ensuring the coordination of its economic interests with financial possibilities. Here an operational financial plan is formed, ensuring the required levels of liquidity and solvency of the enterprise.
The system for production, economic and financial activities management has two levels. Operational management level of the enterprise is indented for indicators monitoring, assessing of financial and operational efficiency, ensuring the products competitiveness. Strategic management level is exercised over the enterprise's investment attractiveness and its long-term growth. At the same time, the processes and relevant indicators considered at these management levels are strongly interrelated.
Since the results of the financial activity of an enterprise are directly related to its production and economic activities, the problem of optimal distributing and balancing cash inflows and outflows is solved taking into account the enterprise's production technologies its human potential. Therefore, the limits of applicability of the model proposed below are determined by the production capacity of the enterprise, the cost of production, its complexity, and capital productivity, as well as the maximum possible profitability at a given production level.

The statement of the problem
The decision of financial flows management problem using the priority of certain payment items is not correct, as enterprises always have the opportunity to change the payments maturity, for example, it can use deferred payment to gain additional benefits. Besides inflows are not deterministic. To solve this problem, we assume to involve other methods that allow planning dynamic outflows.
The problem of payment calendar management is dynamic, and should include not only optimization the funds distribution over the time, but also detection the optimal solution over a long period of time (week, month, quarter). When forming daily optimal plans it is very important to take into account the payments in previous periods, since the monthly (annual) optimal plan is a result of optimal decisions taken for all previous periods.
The dynamic programming method ensures the optimality of the whole process as a series of consecutive decisions. Dynamic programming is a powerful algorithmic paradigm for optimizing sequential decision-making processes that are of a decomposition nature [18]. The algorithmic scheme of dynamic programming consists of immersing the solvable complex problem in a parameterized The principle of optimal control is reflected in the Bellman functional equation, which set a connection between control in the t and the ( t -1) steps. Optimal control has the following property: whatever the initial state at any step and the control chosen at this step, subsequent controls should be chosen optimal concerning to the state to which the system will come to the end of this step. This means that the maximum benefit (risks) from the t step process is equal to the sum of the incomes (risks) from the first and ( t -1) next steps, provided that the next steps left after the first step are best allocated. Such a step-by-step decision-making process is consistent and consists of three components: a set of steps (steps) of decision-making; sets of states and sets of solutions (controls).
The inflows distribution can be represented as a discrete dynamic process, for which it is necessary to find a strategy for allocating funds sequentially for each sub-period of the planning period, ensuring the minimum costs. This strategy is a multi-step decision-making process. In this sense, the financial flows distribution problem is the essence of the discrete optimal control problem, and the method for solution is the dynamic programming method.
We propose to distribute the financial resources of the enterprise by item of expenditures (that is, to design a payment calendar) that is ensured the minimum total costs associated with paying for late payments. We consider only payments with a flexible date.

The formal model
We introduce the following notation: -value of distribution of funds available by the end of the period


-total costs from underfinancing payment calendar items in the The mathematical model of the problem has the form: (1) We use the dynamic programming method to solve the optimal control problem (1) over period T for find the funds allocation by necesary expenditures. General scheme for optimal control * it u determination, transferring the system from the initial state   Step 4. Valid scope for control variables is as: (3) Step 5. Whole process efficiency whose solution allows to determine the optimal plan * it u for fund distribution over time and by cost items.

The algorithm to determine the cash balance
To ensure enterprise solvency as well as to form an insurance reserve in case of unplanned operations and to maintain compensation balances determined by agreement with credit organizations, we establish a target cash balance. For this purpose, the problem of optimizing the average current balance is put and solved, providing the solution to two contradictories, but related problems to maintain the current level of solvency and liquidity, on the one hand, and to obtain additional profit from investing free assets, on the other. When planning cash flows, a balance of input and output funds must be ensured, so in the modeling process, synchronization of payments and receipts is achieved, at which the cash balance is kept at a certain acceptable level [24][25][26][27][28].
The value of current and insurance funds depends on the turnover of the enterprise, the uncertainty of the forecast regarding cash flows and the conditions for obtaining short-term loans. Depending on the degree of determinism-stochasticity of the values of the enterprise's assets need, the target balance can be determined using one of the methods listed below. If cash payments are deterministic, then the intensity of cash payments b preserved at a certain level, then the management consists in determining the optimal amount of assets -the target balance at which the total costs L, associated with the shortfall in income from the provision of available credit assets (opportunity costs) 1 с и with the maintenance costs for obtaining a loan (transaction costs, or a penalty for the deficit) 2 с will be minimal. In this situation, the target residue can be defined In the case of stochastic cash flow, the assessment of the minimum cash balance becomes more complicated. The dynamic problem of optimal control of the remainder is not posed since the magnitude of the need for resources has different values of distribution parameters at different points in time. If it has the same distribution density, it would be possible to find such an optimal strategy for the formation of a cash balance during T time - , , 2 , 1  , to ensure the outflow with minimal cost. Therefore, the problem of managing the cash balance with a discrete random outflows is solved by the criterion of minimum costs associated with a shortage of resources excess.
We proposed the following scheme for estimation the target assets balance in a specific period for stochastic cash flows.
Step 1. The loss function L is as a piecewise linear function of the required assets t out : where t out -variable unknown in advance.
Step 2. Based on statistical observations, we obtain the a posteriori distribution of the required assets t out . In case of discrete t out and distribution law   t out f , the expectation of total costs is as: . The problem of managing the cash balance is to find such balance t s , at which the mathematical expectation (7) takes its minimum value.
Step 3. Using the distribution function  

Numerical experiments
In our financial management system we model separately the financial receipts and expenditure. This approach allows to analyze the cash flows from their inflows in the short term till forming a payment plan. The purpose of modeling cash inflows is to determine the potential solvency of an enterprise during the operational management period, which characterizes the maximum available amount of cash in each sub-period used to ensure payments under cost items in this sub-period. Indicators of potential solvency are increasing cash inflows devided into sub-periods, supplemented by the balance of accumulated cash at the beginning of the study period. The purpose of simulation of outflows is information support for decisions taken in the formation of a payment plan for the above criteria of economic efficiency. Between the inflow and outflow models, there is a feedback, which is used to transmit information about the failure to comply with the outflow model limitations due to the excess of the number of required payments over receipts and to support decision-making on raising debt financing.
To manage the financial resources of the enterprise, we suggest the model implemented in the Anylogic environment using the system-dynamic modeling approach, which incorporates the optimization schemes and algorithms described above. We use the folowion input parameters in the model: revenue, cost and its components, tax payments, accounts payable and receivables, profit. The output indicators are liquidity, solvency, profitability, sustainability, and competitiveness of the enterprise. Modeling is carried out by days. All variable in the models are conected by complex causal, structural, and temporal relationships.
To assess the effectiveness of the developed optimization models and modeling schemes, we use data from the machine-building enterprise of Ufa city. Modeling process has several stages. First, we form the financial input flows. Second, we allocate the financial flow into expenditure item over time. The input cash flow has a stochastic character, therefore, the formation of cash flow is based on a triangular distribution, which is a continuous distribution, limited on both sides. The triangular distribution is used to model stochastic quantities under uncertain information conditions (insufficiency, incompleteness, absence), described by the triangular (min, mode, max) function, which assigns a variable a value belonging to the interval (min, max) with probable value (mode). Data on cash inflows and the formation of receivables are given in table 1. To model the output flow of financial resources, we set initial values for requied monetary resources and then distribute it according to cost items. Requied expenditure items are given in table 2.
We realize a number of experiments: 1) assessment of the effect of changes in the outflow parameters depending on changes in inflows; 2) assessment of the cumulative effect of changes in variables on output parameters; 3) assessment of the elasticity of the output parameters for the input variables. Evaluation of the effectiveness of models and algorithms for managing financial flows was carried out by comparing the output parameters of the model with the included models of the optimal distribution of financial flows and the algorithm (scheme) of determining the target cash balance (experiment 1) with the simulation results without using the model and algorithm (experiment 2), as well as with the included model, but without using the algorithm (experiment 3   The results of simulation experiments demonstrate that cash flow, economic value-added and net profit has the best values in terms of the application of the developed model and algorithms. The developed model and algorithms for managing financial resources provide effective plan of payments distribution, balance the inflows and outflows of financial resources, and ensure the enterprise's solvency and its development.

Results and conclusion
In this work we have considered the system of operational financial planning under conditions of inflows stochasticity and dinamicity. We have established that the financial inflows and outflows planning system when is being constructed by traditional methods and deterministic predicting schemes is not rather effective and does not correspond to the fitures of enterprises' financial system.
We have constructed a model of finantioal resourses destribution planning based on the methods of discrete optimal control to modeling the the synchronization of cash flows and to justification the cash outflows rational strategy. This model provides, firstly, the determination the requied and sufficient value of cash resources in the enterprise. Secondly, the model gives the necessary recommendations to financial analysts to ensure control over cash payments, to cooperate with creditors and debtors. Thirdly, the model is garantiee minimum risks of financial losses due to inefficient finantial management. We have proposed the stochastic model for cash balance optimization, which use the concept of random nature of cash flows and, differ from others that is based on the criterion of cost minimization. We have obtained an analytical dependence of the optimal cash balance from alternative costs, related to short-received income after repayment all expenses and transaction costs for additional loan service.