Equilibrate the continuity Jacobian at x for the optimization (eclipse_opt_equilibrate):
alternately normalize its rows (weights w) and its columns (the variables' factors r,
the optimization's variables being x/r), a few times, so that the rows and the columns
all have 2-norms near 1. This lowers the condition number of the KKT systems of sqpopt's
QP subproblems (for 100 revolutions, J's condition number goes from 8e4 to 7e2). The
objective, |x/r - x0/r|^2/2, is then measured in these units.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
subroutine equilibrate(d,x)type(eclipse_opt_data),intent(inout)::dreal(wp),dimension(:),intent(in)::xreal(wp),dimension(:),allocatable::jac,a,normsinteger::it,kcall d%mission%compute_jacobian_stm(x,jac)allocate(a(size(jac)),norms(max(size(d%r),size(d%w))))d%r=oned%w=onedo it=1,10a=jac*d%r(d%icol)*d%w(d%irow)norms=zerodo k=1,size(a)norms(d%irow(k))=norms(d%irow(k))+a(k)**2end do where(norms(1:size(d%w))>zero)d%w=d%w/sqrt(norms(1:size(d%w)))a=jac*d%r(d%icol)*d%w(d%irow)norms=zerodo k=1,size(a)norms(d%icol(k))=norms(d%icol(k))+a(k)**2end do where(norms(1:size(d%r))>zero)d%r=d%r/sqrt(norms(1:size(d%r)))end do write(*,'(A,2ES10.2,A,2ES10.2)')' equilibrated: column factors ',minval(d%r),maxval(d%r),&', row weights ',minval(d%w),maxval(d%w)end subroutine equilibrate