Test and issue project double-layer scheduling method based on heuristic rule genetic algorithm
Technical Field
The invention relates to a test and issue project double-layer scheduling method based on heuristic rule genetic algorithm, belonging to the technical field of project management.
Background
The issue-measuring Project Scheduling Problem is a subset of the basic Resource-Constrained Project Scheduling (RCPSP) Problem; but different from the classical RCPSP, in the process of testing and sending, different activities have different levels of priority, the activity related to the product main body testing and sending is called a main line activity, the priority is higher, the other activities are called secondary line activities, and the priority is lower.
In the whole project implementation process, managers mainly ensure that the main line activities are completed in time, so in order to meet the requirement, the auxiliary line activities need to be operated in advance, and the solution of the problem has important significance for making up the vacancy of the RCPSP in the research field. The RCPSP belongs to NP-hard problem, the solving method mainly comprises an accurate algorithm and a heuristic algorithm, wherein the heuristic algorithm can be divided into a heuristic algorithm and a hyper-heuristic algorithm based on priority rules.
In order to solve various RCPSPs, the existing research is used for solving problem subsets such as multi-skill staff and dynamic project requirements, but the existing research mainly focuses on projects determined by logic sequences among activities, and few projects represented by survey and development and having the characteristics of distinguishing main lines and secondary lines, and activity detachability are researched at present.
Therefore, a scheduling method for the issue of test issue items is needed.
Disclosure of Invention
In order to solve the technical problems, the invention provides a test and issue project double-layer scheduling method based on heuristic rule genetic algorithm, which has the following specific technical scheme:
a test and issue project double-layer scheduling method based on heuristic rule genetic algorithm comprises the following steps:
step 1: generating an initial main line scheduling plan based on heuristic rules, wherein the heuristic rules are higher in the priority of activities with more subsequent activities;
step 2: moving the position of each activity in the schedule of the construction period to the right from the last actual activity of the main line scheduling plan, wherein the condition that the activity stops moving to the right is that the activity does not meet resource and logic constraint conditions any more after moving to the right, the resource and logic constraint conditions are that the resources are sufficient, the completion time of the current activity is earlier than the start time of the activity immediately after the current activity, and the activities which can not move all the time in the process form a key chain to obtain the final main line scheduling plan;
and step 3: based on the final main line scheduling plan, each secondary line is moved to the left, each activity is compared with the main line activity from the last activity of the current secondary line, an advance entry activity is determined, and an upper-layer scheduling plan is generated;
and 4, step 4: generating an initial population based on an upper-layer scheduling plan, wherein the initial population is a scheduling plan and consists of genes, and the genes are activity numbers;
and 5: carrying out selection operation, cross operation and variation operation on the initial population to obtain a new generation population, and calculating the construction period of the new generation population;
step 6: and (5) repeating the step 5 to carry out iterative operation and storing the optimal solution as the solution of the scheduling problem of the test and development project, wherein the optimal solution is the scheduling result with the shortest construction period.
Further, the specific process of step 1 is as follows:
step 1.1: initializing the activity state of each activity, wherein the activity state comprises that Finished, executing the implementation, Waiting for Waiting and unable to execute Inadequest;
step 1.2: initializing a mainline active state: the virtual starting activity is executing state implementation, the activity immediately after the virtual starting activity is Waiting state Waiting, and the rest activities are non-executing state Inadequate;
step 1.3: start the first iteration
Step 1.3.1: the virtual start activity enters a Finished state Finished;
step 1.3.2: selecting activities meeting resource constraint and logic constraint conditions from activities Waiting for;
step 1.3.3: the immediately following activity entering the activity in the executing state implementation in the step 1.3.2 enters a Waiting state Waiting;
step 1.4: and repeating the iteration process until the virtual ending activity state is Finished, and obtaining an initial main line scheduling plan.
Further, the specific process of step 2 is as follows:
step 2.1: starting from the last actual activity, checking whether the current activity can move to the right or not, and simultaneously checking whether resource and logic constraint conditions are met after the current activity moves to the right or not; if the right shift can be simultaneously met, and the resource and logic constraint conditions are met after the right shift, the activity is shifted to the right, and the activity starting time is updated;
step 2.2: repeating the steps for the activity immediately before the current activity;
step 2.3: repeating the step 2.2 until all the activities can not move to the right, and forming a main line key chain by the activities which can not move to obtain a final main line scheduling plan;
and in the moving process of the activity, the serial-parallel relation between the activity and the activities before and after the activity is kept unchanged.
Further, the specific process of step 3 is as follows:
step 3.1: according to a reverse order rule, the higher the priority of the secondary line which is more backward converged with the main line, the priority of each independent secondary line link is sequenced;
step 3.2: selecting a secondary line with the highest priority, moving the secondary line to the left from the merging activity of the secondary line on the primary line on the basis of the final primary line scheduling plan, wherein the merging activity is the activity immediately after the last activity of the secondary line, and judging whether each activity meets the resource logic constraint condition or not one by one from the last activity of the secondary line, and if so, updating the scheduling plan;
step 3.3: comparing the activity of the secondary line with the activity of the main line, and arranging the activity of the secondary line exceeding the first activity of the main line in the secondary line after the left shift as an advance entry activity;
step 3.4: repeating the steps to the subline with the lowest priority to obtain the current scheduling plan;
step 3.5: and updating the current scheduling plan into an upper-layer scheduling plan.
Further, in the generating of the initial population in step 4, in the population initialization process, the arrangement sequence of the active gene parts belonging to the upper-level schedule is kept unchanged.
Further, the selection operation of the step 5 is performed in a roulette manner, the crossover operation is performed in a multiple single-point crossover method, the variation operation is performed in a non-uniform variation manner, and the variation probability is gradually reduced along with iteration.
Further, the population size is 200, the maximum number of iterations is 100, and the initial variation probability is 0.4.
The invention has the beneficial effects that: according to the characteristic that the number of main line activities is small, a heuristic rule with higher priority of main line activities with a large number of subsequent activities is adopted to obtain a main line scheduling plan, and the main line activities are moved to the right in the scheduling period according to the resource and logic relation; performing double-layer scheduling by adopting a genetic algorithm based on heuristic rules, constraining an initial population by an upper-layer scheduling plan, limiting the range of intersection and variation, reducing the space of a solution, and accurately positioning an optimal solution; the characteristic that the subline activities allow operation in advance is considered, the subline activities needing to enter the field in advance are reasonably arranged, so that the total project period is shortened, and the study vacancy of the project scheduling problem with uncertain flow logic represented by measurement and issue is made up.
Drawings
Figure 1 is a flow chart of the present invention,
figure 2 is a project activity scheduling diagram of an embodiment of the present invention,
figure 3 is a schematic diagram of population initialization of the present invention,
FIG. 4 is a schematic cross-mutation diagram.
Detailed Description
The present invention is further illustrated by the following figures and specific examples, which are to be understood as illustrative only and not as limiting the scope of the invention, which is to be given the full breadth of the appended claims and any and all equivalent modifications thereof which may occur to those skilled in the art upon reading the present specification.
As shown in fig. 2, START is a virtual initial activity, END is a virtual END activity, a preamble activity is a series of activities arranged before a current activity, a subsequent activity is a series of activities arranged after the current activity, an immediately preceding activity is a first activity in the preamble of the current activity, an immediately subsequent activity is a first activity in the subsequent of the current activity, a convergence activity is an immediately subsequent activity of a last activity of a subline, and an actual activity is an actually executed activity.
As shown in fig. 1, the test and issue project double-layer scheduling method based on heuristic rule genetic algorithm of the present invention specifically comprises the following steps:
step 1: generating a scheduling plan based on heuristic rules of subsequent activity quantity
Step 1.1: is provided with
Representing activity of a dominant lineThe number of active sequences in (1) is,
for the total number of main line activities, as shown in fig. 2, for the main line activities in the graph, the activity status includes Finished, executing the implementation, Waiting for Waiting and unable to execute Inadequate;
step 1.2: initializing a mainline active state: the virtual starting activity is executing state implementation, the activity immediately after the virtual starting activity is Waiting state Waiting, and the rest activities are non-executing state Inadequate;
step 1.3: start the first iteration
Step 1.3.1: the virtual start activity enters a Finished state Finished;
step 1.3.2: selecting activities meeting resource constraint and logic constraint conditions from activities Waiting for;
step 1.3.3: entering a Waiting state Waiting for the immediately following activity entering the activity in the executing state implementation in the step 1.3.2, if the activity enters the Waiting state Waiting
Repeating the step 1.3.3, otherwise, turning to the step 1.4;
step 1.4: and if the virtual ending activity state is Finished, taking the current main line scheduling plan as an initial main line scheduling plan.
Step 2: from the last actual activity of the main line scheduling plan, the positions of all the activities in the scheduling of the construction period are shifted to the right, and the activities which can not be moved all the time in the process form a key chain to obtain a final main line scheduling plan;
step 2.1: starting from the last actual activity
Checking whether the current activity can move to the right or not, and simultaneously checking whether the resource and logic constraint conditions are met after the movement to the right; if the same asIf the right shift is satisfied and the resource and logic constraint conditions are satisfied after the right shift, the activity is shifted to the right, and the activity starting time is updated; the resource and logic constraint condition is that the resource is enough and the completion time of the current activity is earlier than the starting time of the activity immediately after the current activity;
step 2.2: repeating the steps for the activity immediately before the current activity;
step 2.3: repeating the step 2.2 until all the activities can not move to the right, and forming a main line key chain by the activities which can not move to obtain a final main line scheduling plan;
the condition that the activity stops moving to the right is that the activity has no space for moving to the right or the activity no longer meets the resource and logic constraint condition after moving to the right, and the serial-parallel relationship between the activity and the activities before and after the activity is kept unchanged in the process of moving the activity.
And step 3: based on the final main line scheduling plan, each secondary line is moved to the left, each activity is compared with the main line activity from the last activity of the current secondary line, an advance entrance activity is determined, and an upper-layer scheduling plan is generated, wherein the method specifically comprises the following steps:
a. is provided with
Is the serial number of the secondary line,
is the total number of the sub-lines,
is the serial number of the secondary line activity,
the total number of the activities of the secondary line,
a first mainline activity start time;
b. obtaining a set of subline priorities
Each minor lineThe set of activities is
;
c. Selecting the secondary line with the highest priority
Last activity of
If left-shifting beyond the activity of the first main line, i.e. movement
When the event is scheduled as an early approach event;
d. if it is
Repeating the step c, otherwise, turning to the step e;
e. if it is
Repeating the steps c and d, otherwise, completing the updating;
and 4, step 4: generating an initial population based on an upper-layer scheduling plan;
and 5: selecting the initial population in a roulette mode, performing single-point cross operation and non-uniform variation operation to obtain a new generation population, and calculating the construction period of the new generation population;
step 6: and (5) repeating the step 5 to carry out iterative operation and storing the optimal solution as the solution of the scheduling problem of the test and development project, wherein the optimal solution is the scheduling result with the shortest construction period.
Table 1 shows the main line flow time obtained by scheduling using the heuristic rule algorithm of the present invention and the conventional genetic algorithm:
TABLE 1
Table 2 shows the total flow time of the project using the heuristic rule genetic algorithm of the present invention and the heuristic rule algorithm of the present invention:
TABLE 2
The numbers in tables 1 and 2 are the numbers of the multiple solving operations, and the average value is finally obtained, so that the method ensures that the main line has the shortest construction period and is not influenced by the activity of the auxiliary line, and the activity of the auxiliary line needing to enter the field in advance is reasonably arranged to ensure that the total construction period of the project is the shortest.
In light of the foregoing description of the preferred embodiment of the present invention, many modifications and variations will be apparent to those skilled in the art without departing from the spirit and scope of the invention. The technical scope of the present invention is not limited to the content of the specification, and must be determined according to the scope of the claims.