The self-organization of dislocation structures produced by rearrangement under mutual interaction forces has been simulated by a computer technique based on molecular dynamics. The model employed is a two-dimensional array of straight, mixed dislocations on orthogonal slip planes. Equations of motion are developed that account for viscous drag in glide and climb motion, inertial forces, externally applied stresses and interaction forces due to other internal defects. Relaxation of an initially random dislocation structure by glide and by a combination of glide and climb has been studied. Results are expressed in the form of a two-dimensional distribution function, which reveals the degree and nature of the self-organization of the structure. Kinetics of the reduction of dislocation density by annealing are found to agree with a similar model based on mutual annihilation of dislocations in cell walls.