This is an internal helper function for pedigree alignment. It uses quadratic programming to find optimal horizontal positions for subjects that minimize the distance between parents and children while keeping spouses together and respecting spacing constraints. Requires the quadprog package.
kinship2_alignped4(rval, spouse, level, width, align)Matrix of optimized horizontal positions for each subject
Aligned pedigree structure from previous alignment steps
Logical matrix indicating spouse connections
Integer vector of generation levels
Numeric, maximum width of the pedigree plot
Logical or numeric vector. If logical, uses default alignment parameters. If numeric, should be a vector c(a1, a2) where a1 controls parent-child penalties and a2 controls spouse penalties