Returns the size variables for the "forward-backward" formulation of the problem.
Note
All the outputs are functions of n_revs
,
the number of orbits we want to solve.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mission_type), | intent(in) | :: | me | |||
integer, | intent(out), | optional | :: | n |
number of opt vars for the solver |
|
integer, | intent(out), | optional | :: | m |
number of equality constraints for the solver |
|
integer, | intent(out), | optional | :: | n_segs |
number of segments |
|
integer, | intent(out), | optional | :: | n_nonzero |
number of nonzero elements in the Jacobian |
|
logical, | intent(in), | optional | :: | full_problem |
if true (default) always return the results for the full problem (i.e., without fixing any of the variables) |
pure subroutine define_problem_size(me,n,m,n_segs,n_nonzero,full_problem) implicit none class(mission_type),intent(in) :: me integer,intent(out),optional :: n !! number of opt vars for the solver integer,intent(out),optional :: m !! number of equality constraints for the solver integer,intent(out),optional :: n_segs !! number of segments integer,intent(out),optional :: n_nonzero !! number of nonzero elements in the Jacobian logical,intent(in),optional :: full_problem !! if true (default) always return the results for the full problem !! (i.e., without fixing any of the variables) if (present(n)) n = 28 * me%n_revs + 7 if (present(m)) m = 24 * me%n_revs if (present(n_segs)) n_segs = 8 * me%n_revs ! there are 4 blocks of nonzeros per rev ! (each block contains 84 elements) if (present(n_nonzero)) n_nonzero = me%n_revs * (84*4) if (present(full_problem)) then if (full_problem) return ! don't do the stuff below end if if (me%fix_initial_time) then if (present(n)) n = n - 1 ! remove the t0 optimization variable if (present(n_nonzero)) n_nonzero = n_nonzero - 6 ! remove the first column of the jacobian end if if (me%fix_initial_r) then if (present(n)) n = n - 3 ! remove the three optimization variables if (present(n_nonzero)) n_nonzero = n_nonzero - 3*6 ! remove columns 2,3,4 of the jacobian end if ! note: assuming there are more than 2 revs for these if (me%fix_ry_at_end_of_rev > 0) then if (me%n_revs<3) error stop 'at least 3 revs are required for fix_ry_at_end_of_rev' if (me%fix_ry_at_end_of_rev >= me%n_revs) & error stop 'fix_ry_at_end_of_rev must be < number of revs' if (present(n)) n = n - 1 ! remove the optimization variable if (present(n_nonzero)) n_nonzero = n_nonzero - 12 end if if (me%fix_final_ry_and_vx) then if (me%n_revs<3) error stop 'at least 3 revs are required for fix_final_ry_and_vx' if (present(n)) n = n - 2 ! remove the two optimization variable if (present(n_nonzero)) n_nonzero = n_nonzero - 2*6 end if end subroutine define_problem_size