heuristic solutions for leveling problems

1 downloads 0 Views 46KB Size Report
Julián Aráoz. Edgardo Broner. Departament d'Estadística I. Departamento ... Universidad Simón Bolívar. Pau Gargallo, 5. Valle De Sartenejas. 08028 Barcelona.
HEURISTIC SOLUTIONS FOR LEVELING PROBLEMS Julián Aráoz

Edgardo Broner

Departament d’Estadística I

Departamento de Computación Y

Investigació Operativa

Tecnología De la Información

Universidad Politécnica de Catalunya

Universidad Simón Bolívar

Pau Gargallo, 5

Valle De Sartenejas

08028 Barcelona

Caracas 1080-A

España

Venezuela

[email protected]

[email protected]

+34 93 490 4483

+58 212 761 0511

Abstract Leveling Problems are a class of problems where programming decisions have to be taken during an established period of time, with the purpose of keeping one or some parameters as smooth as possible through the interval to be analyzed. Direct and inverse problems are introduced into this class. In both cases, the generating unit concept, basis of the objective function to be levelized, is included. A general model is proposed, over which the A* Algorithm is used. Successive approximations techniques are also used.

Key Words: Algorithm A*, Heuristics, Estimation Functions, Digraphs, Generating Units.

Planning the reserve of electrical energy or the allocation of resources, either human or material, are problems of high complexity due to the great variety of alternatives to consider. Because of this, it turns out impractical to use traditional optimization techniques. The previous are examples of the class of Leveling Problems, in which the objective is to maintain the parameters as leveled as possible during the planning interval. The decisions in each period of time generate a great number of states in which this proximity to the desired values is giving high priority. The electrical reserve or the number of workers is the type of parameters that should vary as little as possible, that is should be leveled. We proposed a general model is proposed, on which the A* algorithm is used. This results in a considerable improvement, as was observed in particular problems of this type.

1. Model 1.1 Definitions G1,G2,...,Gn are the generating units of the project. A generating unit can be a machine or an activity, for example, which produces or requires some resource. For each generating unit Gi we define: FTi

earliest possible activation date of Gi

FLi

latest possible activation date of Gi

Di

time required for the activation of Gi

Ri

amount of resources by unit of time of Gi

m

the number of periods of the planning interval.

We have a set of states related to the period, numbered 0 to m. In each state a certain amount of resources is required, in addition to those used by each active generating unit.

The controls will determine the active generating units in the following period, subject to the restrictions of the problem which determine when they must be active or inactive. Let s(k) = [x(k),y(k)] state vector in the period k, where: x(k) = [x1(k),x2(k),…,xn(k)] with xi(k) the initial period for the activation of the generating unit Gi, xi(k) ≥ 0. xi(k) will be 0 if it is inactive until period k. y(k) = [y1(k),y2(k),…,yn(k)] where yj(k) keeps count of the previous conditions required before is possible to activate Gi Let u(k) = [u1(k),u2(k),…,un(k)] be the control vector where ui(k) = 1 indicates that Gi will be activated in the k period. ui(k) = 0 otherwise.

1.2. Process Formulation Given s(0) = [x(0),y(0)]. with xi(0) = 0, yi(0) the total of preconditions to activate Gi, for all i, 1 ≤ i ≤ n ui(k) = 0 ⇒ xi(k) = xi(k-1) ui(k) = 1 ⇒ if xi(k-1) = 0 then xi(k) = k otherwise

xi(k) = xi(k-1)

yi(k) = yi(k-1) – Fi(x(k),u(k),k) being the subtracting factor the total of preconditions corresponding to Gi that were completed in period k.

1.3. General Restrictions 1) The activity of the generating unit initiated previously must be completed. 2) A generating unit must be activated at most on its latest date. 3) A generating unit does not have to be activated before its earliest activation date. 4) A generating unit cannot be activated if all its previous requirements have not been fulfilled. These restrictions can be formulated as follows: 1) k < xi(k) + Di ⇒ ui(k+1) = 1 2) xi (FLi) > 0 3) k < FTi ⇒ xi(k) = 0 4) yi(k) > 0 ⇒ ui(k+1) = 0

1.4. Objective Function The objective is to minimize the function that measures that the resources are kept leveled during an interval of m periods. For each period k this is expressed as: J [s(k), u(k), k] = r(s(k), u(k), k) – RP Where r(s(k), u(k), k) are the necessary resources for period k, according to the state s(k) and the desired average resources RP, which are computed as: n

r(s(k), u(k), k) = ∑ ui(k) Ri – ck, i=1

where ck is the estimated demand for period k, or the maximum load in the case of energy. In order to calculate RP, define: n

RT = ∑ Di Ri i=1

the total of resources to plan for each time unit, and m

CT = ∑ ck k=1

the total demand considered in the interval. Then RP = (RT - CT)/ m The optimal program requires the selection of an admissible optimal control sequence {u*(k)} admissible. The accumulated minimum cost is: k

I[s(k),k] =

Min u(1),…,u(k-1)

∑ J[s(j),u(j),j]

j=1

where u(j) is admissible and s(0) is given. According to how it was defined, the objective function is additive and optimality is verified.

2. Representation through a digraph The model can be seen like a directed graph, by levels, where the states x(k) are the nodes corresponding to level k and the controls u(k) the arcs. These arcs have its initial vertex in level k-1 and its terminal vertex in level k. The costs of each arc correspond to the deviation between the generating resources produced by the active units with respect to the desired average, in the state derived from the decisions of that arc. To solve the problem corresponds then to finding the minimum cost path from the initial node to the set of nodes corresponding to the objective, that is to say, the last period of the planning interval. The minimum cost path will be that which, in the total of periods, is closed to the desired average of resources.

3. A* Application The algorithm A* is based on an estimation function h(.) of the distance between each node and the objective to define the most promising element between the opened paths in each iteration (Hart, 1968) This distance is approximated by means of a heuristic, defined according to each problem. The quality of this estimation is fundamental in order to obtain solutions near the optimal one in reasonable time. Being an informed algorithm, it will be able to obtain solutions faster than the traditional paths search methods, depending on the estimation function that is used. While the algorithm of Dijkstra chooses to always explore the path of lowest cost, A* chooses the one of lowest expected cost, which is obtained adding the last known cost to the expected cost of the future route. If the estimate is always below the real cost it is known as admissible, which guarantees that the first path closed with terminal node in the objective set, will be an optimum path. If it always fulfills the following condition: For all pairs of nodes n, m ∈ V, we have h(n) < c(n,m) + h(m), with c(n,m) cost of the arc (n,m), then the estimate is said to be consistent. A consistent estimate that in addition is admissible guarantees that each closed path will be of minimum cost (Hart, 1968). In order to apply A* to this problem, we propose a consistent estimation function, which guarantees optimum when choosing the first path with terminal node in the objective set. This estimation function calculates the deviation to compensate, considering the preceding deviations and their signs. It is based on the fact that all deviation of the desired average will have to be compensated in the future. Let n be the terminal node of the path that is being explored. We define

J(n) if r(n) > RP J´(n) = -J(n) otherwise and k

J*(n) = ∑ J’(ni) i=1

being (ni)’s the previous nodes of the path being explored, which ends in n. J*(n) is the minimum future deviation, the one that must be compensated. h(n) = J*(n) is admissible and consistent estimate. Admissible being always underestimating the future cost, that in addition fulfils the condition of consistency (Aráoz, 1982). With this estimation function, Algorithm A* guarantees the optimum when choosing a path with terminal node in the objective set, that is to say, when selecting for the first time a state corresponding to the last period of the planning. From that path an optimum policy is obtained and it is not necessary to continue exploring other alternatives.

4. The Inverse Problem: Deactivation Of The Generating Units In certain applications, like the planning of maintenance, the generating units need to be active permanently, except in the periods in which they must stop to be maintained. In these cases, the period of activation can be variable, since the maintenance can be delayed until a latest date. However, the duration of the period of deactivation is known previously. In this variant of the problem the earliest and latest dates, as well as the duration corresponds to the maintenance interval and the adaptation to the model is done in the following way. For each generating unit Gi we define: FTi earliest possible date for deactivation of Gi FLi latest date for deactivation of Gi Di duration of the deactivation of Gi

xi(k) is the initial period for the deactivation of the generating unit i. xi(k) will be 0 if generating unit i were not deactivated until period k. yi(k) a counter of required previous conditions to deactivate the generating unit i ui(k) = 1 indicates that the generating unit i will be deactivated in period k. ui(k) = 0 otherwise. The restrictions are equivalent, only that its interpretation corresponds to the deactivation instead of the activation. In order to determine the objective function, the resources calculation is done as: n

r(s(k), u(k), k) = ∑ (1-ui(k)) Ri – ck, because the generating unit i will be activated when i=1

ui(k)=0. n

Thus RT = ∑ (m-Di) Ri, being (m-Di) the number of periods in which the generating unit i will be i=1

activated. The rest of the calculations do not change, and the same heuristic is apply for A*. Another example of the inverse problem is the planning of vacations for the personnel of a service company, where the capacity of respond to the demand must be kept leveled.

5. Applications 5.1. Allocation Of Resources After PERT/CPM. In a project, once the PERT has been obtained, there are a great variety of alternatives to assign the time of the noncritics activities. When the objective is to maintain the use of resources as leveled as possible, that is a problem with the characteristics of this class. The activities are the generating units, having a generation in fixed periods for the critics, which, because they cannot be altered in his dates, are not considered in the planning, but only the resources that they consume. The total of such resources allows calculating the desired average of resources and we can apply the model (Aráoz, 1984).

The preconditions related to an activity are represented by the number of activities that end in the event that precedes it and is part of the state. The PERT provides the initial and final event of each generating unit i, EIi and EFi. A precondition fulfilled for the generating unit i will be detected when a generating unit j has completed its activation and it is a requisite to activate i. The following three conditions must be satisfied: EFj = EIi uj(k) = 1 k = xj(k) + Dj – 1 The first condition indicates that the final event of j is the initial of i, the second condition indicates that i is activated in the period k, and last one that corresponds to its last period. If the standard valuation for a logical condition (a=b) is used ( 0 if it is false and 1 if it is true), then: a i

Fi(x(k),u(k),k) = Σ (EFj = EIi) ∧ (uj(k) = 1) ∧ (k = xj(k) + Dj –1) j=1

is the sum of the fulfilled preconditions, with ai the total of activities that precede i, and yi(k) = yi(k-1) - Fi(x(k),u(k),k) In case that the objective is to maintain the resources leveled throughout the interval, we consider ck=0 for all the periods. The model also applies when it is desired to keep leveled the reserve of resources over a given estimated curve, in which case ck will correspond to the values of that curve in every period.

5.2. Generation Power Units Maintenance Planning. This is an example of the inverse problem. The units are required to leave the production system for an annual maintenance, which can be advanced o delayed by a maximum number of months. When retiring a unit, the capacity of generation of the system is reduced.

On the other hand, a maximum load ck is considered for every period, which must be satisfied by the generation. Then, the objective is to maintain a leveled reserve throughout the year. The reserve is the difference between the capacity of generation and the considered load. Knowing the estimation of load, the capacity of generation of each unit and the time in which each one must be out of service for maintenance, we compute the total reserve and the desired reserve average, using the general model and the proposed algorithm (Aráoz, 1982). It was following the version of A* of Clovis Gonzaga (Gonzaga, 1978) and its application in power systems problems in Brazil (Gonzaga, 1981). The preconditions used to determine that a unit can leave for maintenance are based on the number of units of similar characteristics that had to leave previously. This is also handled using the concept of events, like in the application of PERT. Also, a variant was used, in order to mantain leveled the percentage of reserve over the demand, for which the objective function is defined as: J[x(k),k] = |r(x(k),k) – COEF ck|, with ck the load in period k and COEF the coefficient that should be kept leveled which is calculated as RT/CT.

6. Experimentation Results In both applications the use of A* against Dijkstra have been compared, computing the paths explored and the run times until obtaining a path with minimum cost. Let CCD

the number of paths closed by Dijkstra until obtaining the one with minimum cost.

CCA* the number of paths closed by A* until obtaining the one with minimum cost. TED

the running time of Dijkstra

TEA*

the running time of A*

NG

number of generating units of the problem

k, q

constants

From the experimental result one may conclude that: CCD = CCA* x 2 ** (NG / k) ± 15 % TED = TEA* x 2 ** (NG / q) ± 15 % This has allowed to reduce the times drastically, in the order of the number of explored paths. When discarding a great number of paths that the informed algorithms do not consider, planning problems much greater can be solved.

7. Successive Approximations Although a considerable improvement has been obtained on the traditional methods, the great dimensions of these problems require to combining the algorithm A* with other techniques, being successful the use from successive approximations (Larson, 1978). The problem is divided in subproblems, which does not guarantee optimum, but converges to a local optimum. The division for the Leveling Problems is made in the following way: Groups of generating units GG1, GG2, …, GGp are formed. Let GGj be the jth group conformed by the generating units Gj1 ,Gj2,…,Gjtj An initial trajectory s0 is defined, we then run each one of the subproblems with groups CG1, CG2,…, CGp, fixing the trajectories corresponding to the generating units that do not belong to the group being considered and incorporating to new trajectories s1, …, sp the result of each iteration. We repeat these runs from the first group until the minimum of the objective function does not improve in p iterations, that is to say, when it is tried to plan a group per time v, with values obtained in v-1 differing in a given small epsilon. In order to apply the method of sucessive approximations, a grouping criterion must be chosen as well as a trajectory or initial solution.

The best results have been obtained organizing the groups in descendent order of resources by generating units and in descendent order of duration, since in addition they simulate the heuristic form to make an allocation, where first are located the heaviest elements first (greater duration or requirements). When it is possible we form groups of generating units of equal number of resources, which simplifies the calculations and the decisions. In this case, a model by groups is considered, where the state vector can be represented, in simplified form, as: X(k) = [XG1(k), XG2(k),…,XGr(k)] where XGi(k) are the state variables, Cartesian product of the variables that represent each generating units of group i, U(k) = [UG1(k), UG2(k),…,UGr(k)] is the control vector, whose variable UGj(k) indicates how many generating units of group j will be active in period k. Since not distinguishing the control of each unit, the number of alternatives is reduced considerably. In each group the generating units will be ordered by activation priority. The same restrictions apply, being able to add a limit of generating units in activate state of a same group for operative reasons and for reliability, whereas the objective function is equivalent. The calculations are reduced to add the generating units products of the active ones of each group by the resources of anyone of them, in each state. For the initial trajectory all the generating units are located in an intermediate date between earliest date and the latest date, which allows greater flexibility. Each subproblem is solved running A* with the estimated previously proposed (deviation to compensate considering the signs). This way we use to the maximum the potential of A*, applying it to problems of manageable size.

8. Levelization Of Several Types Of Resources For problems with different types of resources and wher it is desired to maintain each one of them as leveled as possible, we define RPj, as the average for each resource j, 1 ≤ j ≤ q. The objective function considered is the sum of the absolute value of the differences in every period between the used resources and the desired average of resource, which is known previous to the planning. In addition, a factor of weight for each resource is considered, since all do not have the same importance for the planner. The cost in period k is: q

J(s(k),u(k),k) = ∑ αj rj(s(k),u(k),k) – RPj j=1

Where αj is the weight coefficient for resource j Rj(s(k),u(k),k) the resources of type j required in period k according to the state s(k) This problem also can be solved using the algorithm A* with the following estimative: q

k

j=1

i=1

h´´(n) = ∑ αj ∑ J´j(ni) J´j is the deviation considering signs of resource j in the node ni, being ni, the ones belonging to the path that is being explored and this estimate is consistent.

9. Conclusions The use of heuristic programming for this class of problems has allowed reaching solutions faster than through traditional algorithms. Its combination with successive approximations allows working on problems still more complex, with a greater number of generating units. Its application has been successful in two cases, maintenance of power generation units and resource allocation after PERT/CPM. This generalization is open to other leveling problems.

For additional improvements Iterative-Deepening-A* (Korf, 2001), since if efficient handling of memory allows working with subproblems of greater dimensions.

BIBLIOGRAPHY Aráoz J., and Broner E., (1982). “Algoritmos para Programación del Mantenimiento de las Unidades de Generación”, I CLAIO, Sobrapo, Río de Janeiro. Aráoz J., and Broner E., (1984). “Nivelación de Recursos en PERT/CPM”, Avances en Investigación Operativa, Sadio, Buenos Aires. Gonzaga C., (1978). “Busca de caminhos em grafos e aplicaçoes”, COPPE; UFRJ, IBM do Brasil, Río de Janeiro. Gonzaga C., and Persiano R, (1981). “The Use of Heuristic Graph-Search in Power and Energy Planning”, UFRJ, Río de Janeiro. Hart P., Nilsson N., Raphael B., (1968). “A Formal Basis for the Heuristic Determination of Minimum Cost Paths”, IEEE Transactions Syst. Sc. Cybernetics 4, N.2. Korf R., Reid M., and Edelkamp S., (2001). “Time complexity of Iterative-Deepening-A*”, Artificial Intelligence, Vol 129, No. 1-2. Larsson R., (1968). “State Increment Dynamic Programming”, American Elsevier Publishing Co. New York.