A task allocation method, comprising: initializing allocation parameters, wherein the allocation parameters comprise the number of idle node devices in a target device cluster and the number of to-be-allocated task elements; performing simulated allocation on the to-be-allocated task elements to each idle node device for processing to generate a candidate scheduling matrix, wherein the candidate scheduling matrix is configured to indicate a simulated allocation result; obtaining a load balancing parameter corresponding to the candidate scheduling matrix, iteratively updating the candidate scheduling matrix according to the load balancing parameter, and determining the target scheduling matrix in response to the number of current update times of the candidate scheduling matrix being equal to the preset maximum number of update times; and in response to the target scheduling matrix satisfying an allocation condition, allocating the to-be-allocated task elements to the idle node devices according to the target scheduling matrix; wherein the simulated allocation on the to-be-allocated task elements to each idle node device is performed by iteratively generating a plurality of scheduling paths to obtain a plurality of simulated scheduling matrices, wherein the plurality of scheduling paths are generated according to an affinity parameter and a current information element matrix, wherein the current information element matrix indicates an allocation strategy in the current round of allocation processing, and the affinity parameter indicates whether the to-be-allocated task elements have affinity with the idle node devices; and determining the candidate scheduling matrix from the plurality of simulated scheduling matrices. initializing allocation parameters, wherein the allocation parameters comprise the number of idle node devices in a target device cluster and the number of to-be-allocated task elements; performing simulated allocation on the to-be-allocated task elements to each idle node device for processing to generate a candidate scheduling matrix, wherein the candidate scheduling matrix is configured to indicate a simulated allocation result; obtaining a load balancing parameter corresponding to the candidate scheduling matrix, iteratively updating the candidate scheduling matrix according to the load balancing parameter, and determining the target scheduling matrix in response to the number of current update times of the candidate scheduling matrix being equal to the preset maximum number of update times; and in response to the target scheduling matrix satisfying an allocation condition, allocating the to-be-allocated task elements to the idle node devices according to the target scheduling matrix; wherein the simulated allocation on the to-be-allocated task elements to each idle node device is performed by iteratively generating a plurality of scheduling paths to obtain a plurality of simulated scheduling matrices, wherein the plurality of scheduling paths are generated according to an affinity parameter and a current information element matrix, wherein the current information element matrix indicates an allocation strategy in the current round of allocation processing, and the affinity parameter indicates whether the to-be-allocated task elements have affinity with the idle node devices; and determining the candidate scheduling matrix from the plurality of simulated scheduling matrices.