Allocation of limited resources under quadratic constraints

The proper allocation/distribution of limited resources is a traditional problem with various applications. The mathematical formulation of such problems usually includes constraints describing the set of feasible solutions (feasible set), from which the (nearly) optimal or equilibrium solution should be selected. Often the feasible set is more difficult to determine than to find the optimal or equilibrium solution. Alternatively, the already known feasible set often makes it easier to select the optimal or equilibrium solution. In some other cases, any feasible solutions are the same satisfactory, additional optimization is needless. Accordingly, the main or only task in many cases is to determine the feasible set itself. In the paper, a new theorem is proved for the explicit expression of properly assigned (dependent) variables by means of the other (independent) variables in a system of inequality and quadratic equality constraints. The sum of the (nonnegative) variables can be either prefixed or not. The constraints may describe the feasible set in various resource allocation tasks (possibly in optimization or game-theoretical contexts) or in other problems. Two new lemmas are proved for supporting the proof of the above mentioned theorem, nevertheless, they can also be considered independent results, which may help future mathematical derivations. Supported by a further new lemma, a practical algorithm is derived for assigning in a feasible way the independent variables, to which (possibly limited) arbitrary nonnegative values can be prescribed. Various practical examples are provided to facilitate utilizing the results.


Introduction
In general, the proper allocation/distribution of limited resources is a traditional problem to be solved with various application fields. The importance of this issue is obvious, since at philosophical level every resource on Earth is limited. (Even the so-called renewable resources available for a given time period are limited.) From the managerial point of view, the task is to allocate some limited resource among several users while it should be also often decided which one of the users' preferences can be satisfied (without breaking the constraints/conditions pertaining to the particular task) and which one cannot.
Since the allocation problem is generally not trivial and has various particular kinds, permanent research activity is needed to develop the required solutions.
This section contains a general literature overview in connection with the topic of the present work. Furthermore, it emphasizes the contributions and gives the later organization of the paper.

Literature review
In the mathematical formulation, the general allocation task often lead to optimization problems (with optimal solutions) (see e.g. (Zelinka et al., 2013)) or, due to the conflict of interests, multi-objective or game-theoretical problems (with equilibrium solutions/strategies) (see e.g. (Forgó et al., 1999)). One of the particular but extremely important application fields of the resource allocation task is (fresh, thermal etc.) water resource management (Kicsiny & Varga, 2019;Kicsiny et al., 2021;Madani, 2010). Biology and project management are further important application fields. For example, in (Sharma & Steuer, 2019), certain enzymes form the limited resource to be allocated. In project management, the problem may be the optimal allocation of human resources. A wide range survey on this field is e.g. (Bouajaja & Dridi, 2017). A general overview on continuous nonlinear resource allocation problems is (Patriksson, 2008). The present paper advances the results of the field (reviewed in the latter survey) with solving a kind of problems under quadratic constraints.
Generally speaking, mathematical resource allocation problems are endowed with one or more objective functions to be maximized (or minimized) and constraints determining the set of feasible solutions (feasible set in short), from which the (nearly) optimal or (nearly) equilibrium one should be selected. Basically, our work deals with the derivation of the feasible set for certain cases.
Multi-objective problems are often handled with game-theoretical tools. In (Liu et al., 2019), a leader-follower (or Stackelberg) game is used to model how to allocate limited security resources (like security budget) to protect a large number of targets (servers) in a network. The players are constrained with natural inequality constraints. One of the main goals, similarly as in the present work, is to find a feasible set, from which a satisfactory trade-off between protecting the targets and consuming the resources by the defender (one of the players) can be formed. Another multi-objective optimization model can be found in (Xu et al., 2020), where the so-called dynamic vehicle routing problem is considered with respect to the refined oil allocation task. Certain time, routing and parameter constraints determine the feasible set in the problem. Pareto optimality (Forgó et al., 1999) is a frequent solution approach for multi-objective tasks. In the studies of Goel et al. (2010) and Kranich (2020), Pareto optimal or nearly Pareto optimal solutions are applied to solve different constrained resource allocation problems.
The optimization problem, including the determination of the feasible set satisfying the constraints, often remains challenging in the classical case as well, when only one objective function has to be considered. Klein et al. (1994) deal with optimization problems applied for resource allocation tasks, where each term in the objective function is a continuous, strictly decreasing function of a single variable, and the constraints are linear. In (Wang et al., 2021), a mixed integer programming model based on time cost (included in the objective function) under uncertainty is proposed, which helps to solve the emergency warehouse location and allocation problem. Different aspects are built in the constraints like location and transportation limitations. Milano and Lombardi (2014) address problems where decisions to be taken affect and are affected by complex systems. One of the suggested methods to support decision-making is machine learning. It starts with generating an (approximately) optimal solution of the so-called master problem. If the corresponding decision scenario is found feasible (satisfying the given constraints), and the estimated quality (based on objective function values) is confirmed, the iteration stops, and the result is considered optimal. Otherwise, a new iteration is generated with refreshed decision values. This is an example for the (frequent) cases when the proper determination/handling of the feasible set immediately leads to solutions that can be accepted as (nearly) optimal ones for a problem.
Our results can be applied to the analytical handling of the feasible set in various resource allocation tasks (possibly in optimization or game-theoretical contexts) or in other problems (cf. Sect. 5) under quadratic (nonlinear) constraints if the sum of the nonnegative variables (possibly control variables or strategies) is either fixed (see Sect. 4) or not.
Many times the feasible set of a resource allocation problem is more difficult to determine than to find the optimal or equilibrium solution itself (see e.g. (Kicsiny, 2017)). Alternatively, the already known feasible set often makes it easier to select the optimal/equilibrium solution of the problem. Consider the classical case of a convex objective function over the n-dimensional Euclidean space with a convex polyhedron as the feasible set (described with linear inequality constraints). It is known in advance that the optimal (maximal) solution is one of the extremal points of the polyhedron, which makes the problem much easier to solve. (Generally, the cardinality of the set of the extremal points remains exponential but finite and known linear programming methods can be effectively applied for the solution. In favourable/simplified cases, even the simple comparison of the finitely many feasible points/solutions may practically lead to an optimal one.) In some other cases, any feasible solutions are essentially the same satisfactory, additional optimization is not needed (for example, see Example 5.1a, 5.1b and 5.2 in Sect. 5). Accordingly, the main or even the only task in many resource allocation problems is to determine the feasible set itself. The kind of problems and the proposed solution algorithm in this paper also fit this case.
Similarly, an algorithm for finding a large feasible n-dimensional interval for constrained global optimization is presented in (Csendes et al., 1995). The n-dimensional interval is iteratively increased about an initial point while maintaining feasibility. The resulted feasible interval is constrained to lie within a certain level set ensuring that it remains close to the optimum. Sharma and Steuer (2019) demonstrate the potential of biochemical resource (amount of certain enzymes) allocation models of microbial growth to advance ecosystem simulations and parametrization. One of the models is a linear programming model, the solution of which is discussed as that of a feasibility problem for a given specific growth rate function determining one of the constraints. In (Nattaf et al., 2015), a scheduling problem of tasks is addressed in case of a cumulative continuous resource and energy constraints. The instantaneous resource usage of a task is limited with a minimum and a maximum requirement. The problem is to find a feasible schedule of the tasks satisfying all the constraints. The solution space is searched via a hybrid method using mixed integer linear programming. Friedkin et al. (2019) report that implicit mathematical structures (instead of explicit ones) can be relevant for group decision-making in resource allocation distributions under conditions of uncertainty, which disallow formal optimization. The group's initial distribution preferences set up a geometric feasible set (decision space) as a certain polytope of possible resource distributions. An optimal or at least satisfactory solution can be selected from this set.
The main differences between the present paper and the (cited) literature are constituted in the following: 1. the kind of the particular (quadratic) constraints, 2. the explicit determination of the free/independent variables (portions of the resource to be allocated) and the dependent ones, along with their values.

Contributions and organization of the paper
Apart from the heat management problem with political requirements in Example 5.1a, 5.1b or the feeding problem of conservation biology in Example 5.2, our results can be applied to find feasible solutions or check the feasibility of solutions in resource allocation problems if the sum of the nonnegative problem variables is either fixed or not and there are further quadratic constraints. Even more generally, the results can be applied in case of any (not only resource allocation) problems which can be described with the basic system of constraints (1a), (1b) and (1c) or (26) (see Sect. 2 and 4 and Example 5.3). The contributions of the present paper are the following in more detail: (a) A new theorem (Theorem 2.1) is proved for the explicit expression of properly assigned (dependent) variables by means of the other (independent) variables in a system of inequality and quadratic equality constraints (1a), (1b), (1c). The sum of the (nonnegative) variables can be either prefixed (with Eq. (26)) or not. The solved system (1a), (1b) and (1c) or (26) has comprehensive applications, mainly in the field of allocating (limited) resources. (b) Two new lemmas (Lemmas A1 and A2) are proved for supporting the proof of Theorem 2.1, nevertheless, they can be considered also as independent results, which can be hopefully applied in future works (as a part of future mathematical derivations). (c) A practical algorithm is derived, supported by the new Lemma A3, on how to assign in a feasible way the independent variables, to which (possibly limited but otherwise) arbitrary nonnegative values can be prescribed, and with which the remaining dependent variables can be expressed explicitly. From the managerial point of view, the algorithm helps in the decision making process of allocating limited resources among several users. This help includes the support in deciding which one of the users' preferences can be satisfied (without breaking the constraints) and which one cannot.
The organization of the paper is the following: Sect. 2 presents the mathematical model of the system of constraints along with the proved theorem on the explicit expression of certain variables. In Sect. 3, the algorithm for assigning the independent and dependent variables is proposed. In Sect. 4, the direct applicability for limited resources is discussed in detail (here the sum of the variables is prefixed). Section 5 presents practical examples from various application fields, which hopefully help the Readers in utilizing the results. Section 6 serves with conclusions and a future research proposal. The Appendix contains the supporting Lemmas A1, A2 and A3 and Fig. 1 on the algorithm.
In the present work, n, m ∈ N and n, m ≥ 2 always hold.
Then the expression of m 3,1 can be substituted into those of the remaining ones (into Eqs. (10)), and so on. Finally, such a system of equalities is resulted, where Eq. (5a) stands form 1,1 , (6) stands form 2,1 , (9) stands form 3,1 , and similar relations stand for the variablesm 4,1 , …, m n−1,1 with decreasing numbers of terms in their numerators and denominators. In particular, Eqs. (11) are gained: Now substitute the expression of m n−1,1 into that of m n−2,1 (see Eqs. (11)). This case is in accordance with the conditions of Lemma A2 in the Appendix (considering (1b) and m n,m > 0) with the following correspondences: The expression of m n−2,1 in (11) corresponds to (A3a), the expression of m n−1,1 in (11) In the next step, substitute the above expression of m n−1,1 + m n−2,1 into that of m n−3,1 (see Eqs. (11)). This case is also in accordance with the conditions of Lemma A2 with the following correspondences: Now substitute the expression into that of m n−4,1 (see Eqs. (11)), and so on. All substitutions are in accordance with the conditions of Lemma A2, and finally, similarly simple equalities are gained for all corresponding variables (m n−1,1 ,m n−2,1 , …,m 1,1 ): Then let us handle and simplify Eqs. (4.2) in the same way as we did with Eqs. (4.1) above, expressing the n-1 variablesm 1,2 ,m 2,2 , …,m n−1,2 (with the other relevant ones). Similarly, express proper variables from Eqs. (4.3), …, (4.m-1). Finally, the following system of equalities (including Eqs. (16) and similar ones) is resulted: Eqs. (18) give the concise form of Eqs. (17.1)-(17.m-1): As it has been mentioned above (before Eqs. (3)), the indices of the variables of Eqs. (1a) can be always renamed in order that m n,m > 0 holds. Accordingly (without renaming the original indices), the more general form of Eqs. (18) is the set of Eqs. (2).
Theorem 2.1 has been proved.

Algorithm for assigning independent and dependent variables
Let us arrange the nm variables of Eqs. (1a) according to Table 1. The question is arisen whether the values of which variables (called independent variables) in Eqs. (1a) (or in Table 1) can be set freely such that the values of the remaining variables (called dependent variables) are uniquely (completely and without contradiction) determined by them. Parts 1-3 below give the answer along with the related selection process.
Part 1 Firstly, fix and place in a set L those indices l (l ∈ {1, . . . , m}) for which the equality m 1,l + · · · + m n,l 0 (equivalently m 1,l · · · m n,l 0) is required (because of any specific reasons). According to the form of Table 1, it means that the value of each variable in the l-th column of the table is set zero. That is, L : l ∈ {1, . . . , m}|m 1,l + · · · + m n,l 0 . |L| · n variables have been fixed in this way.
Without loss of generality, it can be assumed that L ∅ or L contains just some of the last indices (from the second ones), that is, (It is considered here that there is at least one index i (i ∈ {1, . . . , m}) for which m 1,i + · · · + m n,i 0 according to (1c).) Otherwise, the variables can be reindexed (reordered and  renamed) properly to fulfil this requirement. (Such a reindexing corresponds to changing the proper columns in Table 1.) From now on, let r denote the biggest (second) index i (i ∈ {1, . . . , m}) for which m 1,i + · · · + m n,i 0 holds. That is, 1 ≤ r ≤ m is as follows: Eqs. (20) give the restricted version of Eqs. (1a) containing the not yet fixed variables:  Similarly as above, it can be assumed without loss of generality that can be assumed that S ∅ or S contains just some of the last indices (from the first ones), that is, S {s ∈ {1, . . . , n}|t < s ≤ n; t ∈ {1, . . . , n − 1}}. (It is considered here that there is at least one index k (k ∈ {1, . . . , n}) for which m k,i 0 for some index i (i ∈ {1, . . . , r }) according to (1c).) Otherwise, the variables can be reindexed properly to fulfil this requirement. (Such a reindexing corresponds to changing the proper rows in Table 2.) From now on, let t denote the biggest (first) index k (k ∈ {1, . . . , n}) for which m k,i 0 holds. That is, 1 ≤ t ≤ n is as follows: Part 3 Now arrange the tr variables of Eqs. (24) in accordance with Table 3. Eqs. (24) (or Table 3) contain tr variables and t(r −1) equalities, among which (t −1)(r −1) are independent (equalities). Accordingly, tr − (t − 1)(r − 1) t + r − 1 variables can be considered independent, that is, the (positive) values of so many ones can be set freely (after selecting the variables with zero value in Parts 1 and 2 above). Now the task is to assign these (independent) variables such that the values of the remaining (dependent) variables are uniquely determined by them.
Based on (24), the following holds for all indices k 1 1, . . . , t; i 1 1, . . . , r ; k 2 1, . . . , t; i 2 1, . . . , r ; k 1 k 2 ; i 1 i 2 : Accordingly, if we fix the values of more than one variables in the i 1 -st column (i 1 ∈ {1, . . . , r }) of Table 3, then we also fix the ratios of the values in the corresponding rows in all columns of the table. For this reason, in the course of selecting the independent variables, more than one variables can be selected in any column only in such a way that they are not contained in such rows the ratios of which (the ratios of the variables in which) have been already fixed (in a direct or indirect way) during our former selections (corresponding to other columns). (If we select only one variable in a given column, it can be in any row since the already fixed ratios among the rows cannot be violated by fixing the value of a single variable.) Remark 3.2 In fixing the ratios of two rows in a direct way, we mean that the corresponding rows (that is, the variables in them) are selected in the same column. In fixing the ratios of two rows in an indirect way, we mean that although the corresponding two rows are selected in different columns, there is a (finite) sequence of different columns in the following way: One of the (above two) rows is selected in the first column, the other one is selected in the last column, and for any neighbouring two columns in the sequence (not necessarily neighbouring in Table 3) it holds that among the selected rows in the neighbouring two columns exactly one row is the same in the two columns.
As for an example, assume that Table 3 has at least three rows and at least two columns. Select the first and second rows (variables) in the first column, through which the ratio of the first and second rows is (directly) fixed. Select the second and third rows (variables) in the second column, through which the ratio of the second and third rows is (directly) fixed. In addition, the ratio of the first and third rows is also fixed (indirectly) with these selections since the ratio of the first and second and the ratio of the second and third rows together determine this ratio as well.
In sum, the values of the corresponding variables of (1a)-(1c) can be set (freely) in the below way of Steps 1-3 (in accordance with the process given above in Parts 1-3).
Step 1 0 ≤ |L| · n (m − r )n ≤ (m − 1)n Variables are selected in Table 1 such that they cover whole columns. The values of these variables are set zero. Then Table 2 is formed from Table  1 by means of deleting the concerned columns.
Step 2 0 ≤ |S| · r (n − t)r ≤ (n − 1)r Variables are selected in Table 2 such that they cover whole rows. The values of these variables are set zero. Then Table 3 is formed from Table 2 by means of deleting the concerned rows.
Step 3 t + r − 1 Variables are selected in Table 3 such that the selected variables in any column are contained in such rows the ratios of which (the ratios of the variables in which) are not fixed (in a direct or indirect manner) by the selected variables in the other columns. Then the values of these variables are set arbitrary positive numbers.
That is, arbitrary positive values have to be assigned to exactly t + r − 1 (independent) variables in the above Step 3 such that it does not lead to contradiction with respect to the value of any other (dependent) variable. The below process of Steps 3.0-3.r (as the detailed description of Step 3) is suggested for this purpose.
Step 3.0 Place the indices of the rows of Step 3.1 n 1 (1 ≤ n 1 ≤ t) variables (rows) as independent variables from the first column of Table  3. It is equivalent to that n 1 elements (sets) are selected from set I . The ratios of the selected n 1 rows (that is, the variables in the selected rows) are fixed in this way in all columns of the table likewise. Then delete the selected sets from set I , and place the union of the deleted sets in I as a new element. (If, for example, we select the second and third variables in the first column of  {4}, . . . , {t}}.) In this way, set I has n 1 − 1 less elements than at the end of Step 3.0 (namely it has already t − (n 1 − 1) elements).
In the remaining part of the process, t + r − 1 − n 1 variables have to be still selected in Table 3.
Step 3.2 Select n 2 (1 ≤ n 2 ≤ t − (n 1 − 1)) variables (rows) as independent variables from the second column of Table 3 such that at most one element (one index of rows) is selected from each element (which is also a set) of I . In this way, the ratios of those rows are fixed in the whole table the indices of which are contained in any of the sets concerned with the selection. Then delete the sets concerned with the selection from set I , and place the union of the deleted sets in I as a new element. ( Table 3 (see also Remark 3.2). In this way, set I has n 2 − 1 less elements than at the end of Step 3.1 (namely it has already t − (n 1 − 1) − (n 2 − 1) elements).
In the remaining part of the process, t + r − 1 − n 1 − n 2 variables have to be still selected in Table 3. . . .
Step 3.i n i (1 ≤ n i ≤ t − (n 1 − 1) − (n 2 − 1) − · · · − (n i−1 − 1)) variables (rows) as independent variables from the i-th column of Table 3 such that at most one element (one index of rows) is selected from each element of I . In this way, the ratios of those rows are fixed in the whole table the indices of which are contained in any of the sets concerned with the selection. Then delete the sets concerned with the selection from set I , and place the union of the deleted sets in I as a new element. In this way, set I has n i − 1 less elements than at the end of Step 3.i-1 (namely it has already t − (n 1 − 1) − (n 2 − 1) − · · · − (n i − 1) elements).
In the remaining part of the process, t + r − 1 − n 1 − n 2 − · · · − n i variables have to be still selected in Table 3. . . .
Step 3.r Now select (the maximally possible) n r (1 ≤ n r t −(n 1 − 1)−(n 2 − 1)−· · ·−(n r −1 − 1)) variables (rows) as independent variables from the r -th (last) column of Table 3 in such a way that at most one element (one index of rows) is selected from each element of I . In this way, the ratios of all rows are fixed in the whole table.
Finally, assign arbitrary positive values to the (independent) variables selected above in Steps 3.1-3.r.

Remark 3.3
1. It can be proved that at least one variable (row) has to be selected in all Steps 3.1-3.r above in order that the required t + r − 1 positive independent variables are fixed entirely (see Lemma A3 in the Appendix). Therefore we have assumed well above that 1 ≤ n 1 , n 2 , . . . , n r . It can be also seen from the above process that t + r − 1 − n 1 − n 2 − · · · − n r −1 variables have to be still selected in the r -th (last) step, where n r t − (n 1 − 1) − (n 2 − 1) − · · · − (n r −1 − 1). These two values are equal, so the process provides just as many (t + r − 1) positive independent variables as needed. In assigning the variables (in Steps 1-3), altogether (m − r )n + (n − t)r + t + r − 1 (1 ≤ r ≤ m, 1 ≤ t ≤ n) (independent) variables have taken their (zero or arbitrary positive) values. Now we can determine the values of the remaining (dependent) variables (remained from the all nm ones) with Eqs. (2), which is a rather simple thus practically usable formula.

Application for limited resources
Assume that system (1a-1b) is completed with the condition of m 1,1 + · · · + m n,1 + · · · + m 1,m + · · · + m n,m R for some prefixed positive numberR. (From (26), (1c) follows.) It is a rather natural requirement if R represents the available amount of some limited resource (fresh water, food, financial support etc.), andm 1,1 , …,m n,1 , …,m 1,m , …, m n,m represent its parts provided for some agents/stakeholders. For assuring the fulfilment of Eq. (26) when assigning the values of the variables in the course of Steps 1-3 above, we can proceed as follows: The (basically arbitrary) positive values fixed in Steps 3.1-3.r cannot be considered as the final values of the independent variables only fixed proportional numbers among them. That is, only (final) proportions can be allocated among the corresponding variables not final values in Steps 3.1-3.r. After fixing these proportions for the independent variables, let us determine the proportions for the dependent ones by means of Eqs. (2). Then denote the fixed/gained proportions with m 1,1 , …, m n,1 , …, m 1,m , …, m n,m with respect to the variables m 1,1 , …,m n,1 , …,m 1,m , …,m n,m , respectively. (If, for example, m 1,1 1 and m 2,3 2 are resulted in this process, it means that the ratio between the (still to be determined) final values of m 1,1 and m 2,3 will be 1:2.) Now let us form the ratio K : R m 1,1 + · · · + m n,1 + · · · + m 1,m + · · · + m n,m .
To our knowledge, besides the here proposed method (with the algorithm of Sect. 3 and Eqs. (2) in Theorem 2.1), there is no similarly direct and fast way (with similarly low computational demand) to assign (or check) the independent/free variables (without generating contradiction) and set their values in case of resource allocation problems under the constraints (1a), (1b) and (1c) or (26). Without this method, the feasibility of any (suggested) assignment of the variables could be checked only with the direct substitutions into system (1a) of n − 1 equalities. Furthermore, the determination of the values of the dependent variables would require to solve the same system of (nonlinear) Eqs. (1a) completed with (26), instead of some simple substitutions into Eqs. (2), (27) and (28).
In sum, compared to the known (ordinary) way, the method proposed in the present paper decreases considerably the computational demand (number of calculations/operations to be executed) of both assigning/checking the free variables and setting the values of the variables, in case of the studied kind of resource allocation problems.

Practical examples
In this section, practical examples are presented on how to utilize the above worked out mathematical process in various application fields mostly for allocating limited resources. Nevertheless, in Example 5.3, it is shown that the results can be applied not only for allocation problems but more generally for any problems which can be described with the basic system (1a), (1b) and (1c) or (26).

Example 5.1a
Let us have three towns (Town 1, Town 2 and Town 3) in a region. Each town runs four operating sectors. Sector 1 is the public service sector (which includes the medical institutions, kindergartens, schools etc.), Sector 2 is the civil sector (including the citizens' houses, flats etc.), Sector 3 is the industry (with factories, warehouses etc.) and Sector 4 is the agriculture (including greenhouses, storing and service buildings). Assume that the three towns have similar working profile, that is, the importance of any sector (compared to the other ones) is about the same in all towns.
In the region, utilizable geothermal heat is available in the form of thermal water, which is allocated among the sectors of the towns in the heating season (winter) by means of the hydraulic network maintained by the regional government. After the usage, the cooled down water is pumped back deeply in the soil, in order to make the hot water utilization completely renewable and not to charge the surface waters at all (GEOSZ, 2014;Nagygál & Tóth, 2017.). As the (yearly) amount of the thermal water (R in (26)) is limited, each town has to appoint (independently of the other towns) those two sectors, along with their heat demand, the heating with thermal water (which is free of charge for the town) is the most important for it. Since the still missing heat (in any sector) has to be supplied at the expense of the corresponding town, each town should appoint those two sectors the heating of which would be the most expensive for it. These sectors may be different in different towns. For example, the industry of a certain town may produce enough waste heat to meet its own heat demand while in another town, the private buildings may have better thermal insulation and/or more solar building heating systems, which brings about a negligible cost with respect to the heating of Sector 2, etc.
It is assumed that the regional government allocates the thermal water provided for a given town among the different sectors according to the same proportions in all towns for maintaining the overall political balance. In this way, the stakeholders of neither sector should feel suffering from any negative discrimination (compared to the other sectors) more in any town than in any other one. It is assumed as well that all sectors of all towns are supplied with a positive (not zero) quantity of thermal water (also for avoiding the dissatisfactions).
Assume that Town 1 prefers the heating of Sectors 1 and 2, Town 2 prefers the heating of Sectors 1 and 3 and Town 3 prefers the heating of Sectors 2 and 3 with the thermal water, see part a) of Fig. 1. Furthermore, if it were possible, Town 3 would appoint Sector 4 in the third place. The towns also specify their particular heat demands (that is, thermal water quantities), from which not only variables m 1,1 , m 2,1 , m 1,2 , m 3,2 , m 2,3 and m 3,3 (as independent variables) themselves but also their values are fixed. The fixing of m 1,1 and m 2,1 can be considered such that the first and second elements in the first column of Table  3 are selected in Step 3.1 (that is, n 1 2, see Sect. 3), from which set I {{1, 2}, {3}, {4}} is resulted. In the next step (in Step 3.2), the elements from the second column should be selected in such a way that at most one element is selected from each element of this set I (that is from sets {1, 2}, {3} and {4}). The fixing of variables m 1,2 and m 3,2 satisfies this requirement since they are the first and third elements in the second column, that is, only element 1 is selected from set {1, 2}, and element 3 is selected from set {3}. From these selections, set I is modified to the following: I {{1, 2, 3}, {4}}. In the last step (in Step 3.3), the second and third variables are selected from the third column (which are m 2,3 and m 3,3 , respectively), that is, indices 2 and 3 are selected in the elements of set I . However it is not a feasible selection as both of 2 and 3 belong to the same element of set I (namely, to set {1, 2, 3}).
Therefore the appointed demands of the Towns cannot be met such that the political balance is assured, that is, such that (1a), (1b), (26) hold.
One of the solutions of the problem can be the following: If the cost of heating Sector 3 in Town 3 were decreased enough (for example, by means of the improvement of the thermal insulation of the industrial buildings possibly with governmental support), then heating Sector 3 could become less expensive than heating Sector 4. In this case, Town 3 would specify the required values of variables m 2,3 and m 4,3 (instead of m 3,3 ) to the regional government, see part b) of Fig. 1. In Step 3.3 above, this requirement can be already satisfied while maintaining the political balance, because the fixing of variables m 2,3 and m 4,3 means the selection of only one index from each element of set I (in a feasible way). Namely, indices 2 and 4 are selected from set {1, 2, 3} and {4}, respectively. Then the values of the remaining six (dependent) variables m 3,1 , m 4,1 , m 2,2 , m 4,2 , m 1,3 and m 4,3 can be determined with Eqs. (2). If the resulted overall quantity of the needed thermal water is more than the (yearly) available amount R (basically, this case is assumed), then the values of the variables can be decreased proportionally in accordance with the process given in Sect. 4.
We could (temporarily) solve the problem if, for example, we (Town 8) selected Sector 10 instead of Sector 11 (that is, m 10,8 instead of m 11,8 ). It is possible if the heat demand of Sector 11 can be decreased (by means of better insulation) or satisfied from another (renewable) heat resource. Nevertheless, the algorithm gets stuck again after step 9, when I {{1, 2, 3, 4, 5, 6, 7, 8, 10, 11}, {9}} and Town 10 would like to assign Sectors 2 and 7 (that is, m 2,10 and m 7,10 ). It is not feasible since the corresponding indices 2 and 7 are from the same element of set I . We could completely solve the problem if, for example, we could make Town 8 (in step 8) select Sector 9 instead of Sector 11 or 10 (that is, m 9,8 instead of m 11,8 or m 10,8 ).
Finally, the values of the remaining tr − (t + r − 1) 90 (dependent) variables can be determined with Eqs. (2), conveniently, by means of the used computer program. If the overall quantity of the needed thermal water is more than the available amount R, then the values of the variables can be decreased proportionally according to the process given in Sect. 4.
Example 5.2 Let us have a country region (a village near a wetland) with three artificially made nests for white storks (Ciconia ciconia (Linnaeus 1758)) relatively far from one another in order that any of them does not disturb the others directly. A clutch size of storks is observed in each nest continuously. It is assumed that (on the average) four nestlings per year hatch out in each one of the three different nests. In order to maintain the population size and the genetic variability of the species, it is desired that all four nestlings reach the adult age (in an average year) in the nest the (permanent) male parent (Vergara et al., 2006) in which has the more advantageous/rare genetic feature (let it be called Nest 1). It is also desired (for the same purpose) that in the other two nests, called Nest 2 and Nest 3, at least three and at least two nestlings reach the adult age. It can be assumed (based on (Kwieciński et al., 2006)) that a nestling needs minimum 40 kg feed (in the form of large insects, mice, lizards, frogs etc.) to grow up during the whole feeding period (5-6 weeks).
It is assumed that the given region can maintain at most three couples of parents along with their nests in its present form. Furthermore, the couples (at least the male parents) return to the same nest every year. The (yearly average) carrying capacity of the whole region, that is, the overall feed amount available for the nestlings is known. The feed is assured partly in natural way by the region itself and partly from (continuous) additional feed provided for each nest separately (similarly as in (Moritzi et al., 2001)). The overall quantity of the additional feed is fixed, but its ratios allocated among the particular nests can be changed.
Based on observations, the parents provide different proportions of the available feed for the nestlings. Accordingly, the earlier hatching means an advantage in this respect as well as a higher capability of living (Tortosa & Redondo, 1992). It can be also assumed that these proportions are the same in the different nests. Furthermore, it has been assessed that Nest 1 receives 220 kg feed (in a year on average) while Nest 2 and Nest 3 receive 176 kg and 152 kg, respectively, according to the present allocation of the overall feed.
Our task is to check whether the required number of nestlings in each nest reach (expectedly) the adult age in case of the present allocation of the feed. If not, it should be examined if the feed (its artificially provided part) can be reallocated such that this requirement is already fulfilled.
For discovering the consumed feed amounts corresponding to the hatching order, the feed consumed by each nestling in Nest 1 is observed (measured) in a particular year. Assume that these observed values are m 1,1 : 70.8 (kg), m 2,1 : 58.8, m 3,1 : 49.2 and m 4,1 : 41.2 (in sum 220 (kg)). It can be considered such that all elements in the first column of Table 3 are selected in Step 3.1 (that is, n 1 t 4, see Sect. 3), from which set I {{1, 2, 3, 4}} is resulted.
Since we can select variables (rows) in each step only in such a way that at most one index is selected from each element (as a set) of set I , exactly one arbitrary variable should be selected from each one of the second and third rows (in Steps 3.2 and 3.3). As it is desired that at least two and three nestlings grow up in Nests 2 and 3, let us assign the corresponding minimal value (40 kg) for the third nestling of Nest 2 and for the second nestling of Nest 3, considering that Nest 2 possesses basically more feed (176 kg) than Nest 3 (152 kg) (according to the present allocation), that is, m 3,2 40, m 2,3 40.
In this way, we have fixed the values of all (six) independent variables. Now the values of the remaining (dependent) variables can be determined with Eqs.
(2). The following is resulted with respect to Nest 2: (in sum 149.2 kg). From these numbers, the overall required feed amount is resulted as m 1,1 + . . . + m 4,1 + . . . + m 1,3 + . . . + m 4,3 543.2 (kg), which is less than the whole available feed amount of the region, that is, R 548 (kg). Therefore the feed (more precisely, its additionally provided part) can be redistributed such that the required number of nestlings reach the adult age in all nests. It has to be assured only that after the reallocation at least 214.8, 179.2 and 148.8 kg feed fall to the share of Nests 1, 2 and 3, respectively.

Example 5.3
In the stubble-field of a plough-land, the spatial distribution of four weed species is studied. More particularly, it is examined if there is any scale dependency (if yes, to what extent) of the relative coverage of the different species, that is, the size of the relative area covered by the different species (measured in m 2 /m 2 ). (Similar problems on scale dependency, regarding especially the biodiversity, can be found e.g. in (Tóthmérész, 1995a(Tóthmérész, , 1995b. Scale dependency can be inferred from that the values of the relative coverage of a given species are not the same for the different quadrat sizes (see below). If no scale dependency is experienced in case of a given species, it is considered that the spatial distribution of that species is homogeneous. The studied species are the red-root amaranth (Amaranthus retroflexus L.) (Species 1), the knotgrass (Polygonum aviculare L.) (Species 2), the ragweed (Ambrosia artemisiifolia L.) (Species 3) and the goosefoot (Chenopodium album L.) (Species 4). (These particular species have considerable international importance, see e.g. (Makra et al., 2015).) Three sizes of square quadrates (10 m × 10 m, 5 m × 5 m, 1 m × 1 m) are applied, that is, square areas of sizes 10 m × 10 m ( 100 m 2 ), 5 m × 5 m ( 25 m 2 ) and 1 m × 1 m ( 1 m 2 ) are assigned randomly in the plough-land, and the surfaces covered by all weed species are measured in them. Finally, the measured values are divided by the area of the corresponding quadrates. More particularly, five quadrates are assigned randomly in each size, and the average of the values measured in them is considered as the corresponding (measured) value for the given quadrate (with respect to each species separately). (Similar examinations of weeds with quadrates are widely used in the field of agriculture and nature protection, see e.g. (Pinke & Pál, 2008).) Let us introduce the following variables: m 1,1 , m 2,1 , m 3,1 , m 4,1 denote the relative coverage (in m 2 /m 2 ) of Species 1, 2, 3, 4, respectively, in case of the 100 m 2 quadrate size, m 1,2 , m 2,2 , m 3,2 , m 4,2 denote the relative coverage of Species 1, 2, 3, 4, respectively, in case of the 25 m 2 quadrate size, and m 1,3 , m 2,3 , m 3,3 , m 4,3 denote the relative coverage of Species 1, 2, 3, 4, respectively, in case of the 1 m 2 quadrate size. With these definitions, the variables satisfy system of conditions (1a)-(1c), if the spatial distributions of all four species are homogeneous.
Assume that we have the following measured data: For the biggest quadrate size, the relative coverage of Species 1, 3 and 4 are m 1,1 : 40 (m 2 /m 2 ), m 3,1 : 10 and m 4,1 : 5. For the 25 m 2 size, the relative coverage of Species 2 and 4 are m 2,2 : 5 and m 4,2 : 1.25. For the 1 m 2 size, the relative coverage of Species 1 is m 1,3 : 0.4. The fixing of these (positive) values can be considered as selecting all (six) independent variables in Table 3 (of  Sect. 3) in a feasible way. In particular, the first, third and fourth variables are selected in the first column, from which set I {{1, 3, 4}, {2}} is resulted. In the second column only one element is selected from each of the sets {1, 3, 4} and {2} (in accordance with the prescription of Sect. 3). Finally, only one variable is selected from the last column, which cannot be a problem.
The remaining (dependent) variables can be (uniquely) determined with Eqs.
(2), if the mentioned homogeneity holds for all species. However, assume that there is one more measured data: For the 1 m 2 quadrate size, let the relative coverage of Species 2 be m 2,3 0.5 (m 2 /m 2 ). This value is not in accordance with the one that can be calculated (in two steps) with Eqs. (2), which is Thus it has been resulted that the spatial distributions of the species are not homogeneous. More precisely, Species 2 presents a considerably higher value (0.5 m 2 /m 2 ) than that corresponding to the homogeneity (0.2 m 2 /m 2 ) in case of small quadrate size. It suggests that Species 2 has (relatively large) clonal patches, from where the other species are obviously excluded. However, the sizes of such spots are limited since the anomaly takes place in the smallest quadrate size (if the cardinality of the (measured) sample is relatively low).

Remark 5.1
1. Extended versions of Example 5.2, 5.3 which could be solved practically only with a computer, could be provided similarly to the extended version of Example 5.1a (which is Example 5.1b). 2. Similar flow charts to the one in Fig. 1 could be attached to Example 5.1b, 5.2 and 5.3 as well.

Conclusion
The proper allocation/distribution of limited resources is a traditional problem with various applications. From the managerial point of view, the task is to allocate some limited resource among several users while it should be also often decided which one of the users' preferences can be satisfied and which one cannot.
Mathematical resource allocation problems are usually endowed with constraints determining the feasible set, from which the (nearly) optimal or equilibrium solution should be selected. Often the main task is to determine the feasible solutions. Then their knowledge makes it much easier to select the (nearly) optimal or equilibrium solution of the problem. In some cases, any feasible solution is the same acceptable and the task is "only" to check the feasibility of particular/desired allocations.
In the paper, a practical algorithm is proposed based on a new theorem and supporting lemmas on the feasible allocation of a limited resource among several users under quadratic constraints. In more detail, the free/independent variables (portions of the resource) are assigned first then their values determine directly those of the other, dependent variables. In this way, feasible solutions can be produced or the feasibility of a given/desired allocation can be checked.
Without our proposed method, the feasibility of any (suggested) allocation of the resource could be checked only with direct substitutions into the system of equations expressing the (nonlinear) constraints. This would imply a much higher computational demand.
From the managerial point of view, the proposed algorithm helps in deciding which one of several users' preferences can be satisfied (without breaking the constraints/conditions of a given task) and which one cannot, while allocating some limited resource among the users. The sum of the variables, that is the overall amount of the resource, can be either prefixed or not.
Practical examples have been also presented from various application fields, which hopefully help the Readers in utilizing the results.
Future researches may deal with the possibility of extending the results for modified or less strict constraints. In particular, the values of the variables in Eqs. (1a) might be any real numbers (not only nonnegative ones). Although this case would not go well with real resource allocation problems (where negative values are not realistic), on the whole the field of applications could be increased.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
Proof Substituting the expression of m k,l into that of m i, j , it is resulted that. That is, Lemma A2 has been proved.
Lemma A3 At least one variable (row) has to be selected in each one of Steps 3.1-3.r in Sect. 3 (that is, in each column of Table 3) in order that altogether t + r − 1 (positive independent) variables can be selected from Table 3 in a feasible way (according to Step 3 in Sect. 3).
Proof Without loss of generality, it can be assumed that no (independent) variables are selected from the first w (1 ≤ w < r ) columns of Table 3, but at least one variable is selected from each of the remaining r − w columns. (Otherwise, this requirement could be assured with reindexing the variables properly.) Thus our selection starts from the (w + 1)-st column (from Step 3.w + 1 in Sect. 3), the steps of which are detailed below (in accordance with the process in Sect. 3).
Step 3.w + 2 Select n 2 (1 ≤ n 2 ≤ t − (n 1 − 1)) variables from the (w + 2)-nd column such that at most one element is selected from each element of I . Then modify set I accordingly (cf. Step 3.2 in Sect. 3). In this way, the cardinality of I has changed to t − (n 1 − 1) − (n 2 − 1). Further t + r − 1 − n 1 − n 2 variables have to be selected in the remaining part of the process. . . .
Step 3.r Select (the maximally possible) n r −w (1 ≤ n r −w t − (n 1 − 1) − (n 2 − 1) − · · · − (n r −w−1 − 1)) variables from the r -th (last) column in such a way that at most one element is selected from each element of I .
In the last step (Step 3.r) of the above process, t +r − 1 − n 1 − n 2 −· · ·−n r −w−1 variables should be selected in order that the needed t + r − 1 variables are entirely selected throughout the whole process. However, (at most) t − (n 1 − 1) − (n 2 − 1) − · · · − (n r −w−1 − 1) t − n 1 − n 2 − · · · − n r −w−1 + r − w − 1 selections are possible, which are w (1 ≤ w) less than needed. It means that at least one variable has to be selected from each column of Table  3 in order that altogether t + r − 1 variables can be selected from Table 3 in a feasible way.
Lemma A3 has been proved.