# Project Robust Scheduling Based on the Scattered Buffer Technology
## 4 Unit activity Slack Algorithm (UAS)
### Resource Allocation Algorithm with Maximum Use of the Precedence Relations (MPRRA)  
#### 4.2.1 Principle of Resource Allocation  
To facilitate the discussion, the following concepts are introduced. In the baseline schedule, the completion time of each activity is sorted in ascending order, and the completion time of activity is taken as the stage (time point). There may be multiple activities at one stage whose completion time is that stage. At a certain stage, the saturated resource allocation refers to the situation that the sum of resources transferred on all the activity pairs with precedence relation equals the sum of the saturated resource at a certain stage. If the sum of resources transferred in all activity pairs is less than the sum of the saturated resources, this resource allocation approach is called the unsaturated resources allocation. The zero interval refers to the situation that the difference between the end time of the previous activity and the starting time of the later activity is zero. The sending activity refers to the activity whose completion time in this stage is equal to the time point (i.e., the stage). The sending activity will transfer the resource to the receiving activity. The receiving activity refers to the activity whose starting time in this stage is equal to the time point (i.e., the stage). The resource allocation is carried out through two relationships between the activity pairs in the baseline schedule. One is the precedence relation has existed among the activity pairs; the other is the additional precedence relation that is generated among the activity pairs. However, the more additional constraints, the stronger the mutual restriction between activities is, and so the greater the impact on the robustness of the schedule. Therefore, activity pairs with the precedence relation should fully use the resource allocation to reduce the number of newly additional constraints and to reduce the adverse effects of additional constraints on the schedule robustness. To realize the maximum use of the precedence relations, this algorithm divides the resource allocation into two parts. The resource is firstly transferred through the activity pairs with the precedence relations and it is executed in the first process. Then, the resource is transferred through the activity pairs without precedence relations in the second process of allocation. The specific resource allocation process is as follows. The first process: Using the allocation pattern based on stage, Section 4.2.2 details the allocation strategy that maximizes the use of precedence relations. At each stage, the zero interval activity pairs with the precedence relations should be found firstly in the sending activities and the receiving activities. Then, according to the allocation algorithm of repeated cyclic searching for the single activity pair to allocate the saturated resource into these zero interval activity pairs, more resources can be allocated through the zero interval activity pairs with precedence relation to reduce the amount of resource that is allocated through the non-precedence activity pairs. When the allocation of resources at each stage in the first process is completed, then the resource allocation in the second process can go on. The second process: Using the allocation pattern according to the activity, first arrange the completion time of each activity in ascending order to determine the allocation order of the activity, and then, check one by one the resource balance situation of the following activities based on the activity order mentioned above, and to transfer the resources according to the order of activities. Because the resource has been allocated first into the activity pairs with precedence relations in the first process, the activities pairs are the ones without precedence relations at this stage. When the allocation relation of activity pair is established, this activity pair needs to be allocated the constraints.