The present invention proposes a kind of embedded core test packaging scan chain design method, including step (1): algorithm initialization; step (2): de-initialization step (3): if the end condition is not satisfied, continue, otherwise go to step (12 ); Step (4): Estimate the objective function max(s i ,s o ) value; step (5): adjust food sources and enemies; step (6): adjust individual separation S, individual direction A, individual cohesion C, individual food F, position D and weight of individual enemies w; Step (7): Evaluate S, A, C, F, and D; Step (8): Adjust the neighborhood radius; Step (9): Adjust the location vector; Step (10): Validate according to the bounds of the variables and Modify the new position, if the value of the new position is less than 1, set its value to 1, if it is greater than N, then set its value to N; step (11): go to step (3); step (12): Output the result.