The objective and the constraints for sqpopt: halo's continuity constraints, then the eclipse rows.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in), | dimension(:) | :: | x | ||
| real(kind=wp), | intent(out) | :: | f | |||
| real(kind=wp), | intent(out), | dimension(:) | :: | c | ||
| integer, | intent(inout) | :: | status | |||
| class(*), | intent(inout), | optional | :: | data |
subroutine eclipse_fc(x, f, c, status, data) real(wp),dimension(:),intent(in) :: x real(wp),intent(out) :: f real(wp),dimension(:),intent(out) :: c integer,intent(inout) :: status class(*),optional,intent(inout) :: data real(wp),dimension(:),allocatable :: ks logical :: ok if (.not. present(data)) error stop 'eclipse_fc: no data' select type (data) type is (eclipse_opt_data) ! (x here is the optimization's variable y = x/r) if (data%mission%eclipse_opt_objective == 0) then f = zero ! (a feasibility problem: as SNOPT's feasible point mode) else f = 0.5_wp * sum((x - data%x0/data%r)**2) end if if (.not. epochs_in_range(data, x*data%r)) then c = zero status = 1 ! (outside the splined ephemeris: can't evaluate here) return end if call data%mission%constraint_violations(x*data%r, c(1:data%m_halo)) ! (also puts x in the segments) c(1:data%m_halo) = c(1:data%m_halo) * data%w if (data%single) then allocate(ks(size(data%rows))) call eval_rows(data, ks, ok=ok) c(data%m_halo+1) = ks_aggregate(ks, data%mission%eclipse_opt_ks_rho) else call eval_rows(data, c(data%m_halo+1:), ok=ok) end if if (.not. ok .or. any(data%mission%segs%failed)) status = 1 ! (can't evaluate here: sqpopt shortens the step) class default error stop 'eclipse_fc: invalid data' end select end subroutine eclipse_fc