@@ -31,9 +31,8 @@ result = optimize(problem; method=Krotov)
3131
3232If `check` is true (default), the `initial_state` and `generator` of each
3333trajectory is checked with [`check_state`](@ref) and [`check_generator`](@ref).
34- Any other keyword argument temporarily overrides the corresponding keyword
35- argument in [`problem`](@ref ControlProblem). These arguments are available to
36- the optimizer, see each optimization package's documentation for details.
34+ Additional keyword arguments can be passed to these two `check` routines by
35+ passing a named-tuple as `check_state_kwargs` and `check_generator_kwargs`.
3736
3837The `callback` can be given as a function to be called after each iteration in
3938order to analyze the progress of the optimization or to modify the state of
@@ -54,7 +53,8 @@ the method-specific [`make_print_iters`](@ref) to print the progress of the
5453optimization after each iteration. This automatic callback runs after any
5554manually given `callback`.
5655
57- All remaining keyword argument are method-specific.
56+ All remaining keyword argument are method-specific and temporarily overrides
57+ the corresponding keyword argument in [`problem`](@ref ControlProblem).
5858To obtain the documentation for which options a particular method uses, run,
5959e.g.,
6060
@@ -75,10 +75,8 @@ function optimize(
7575 check = get (problem. kwargs, :check , true ),
7676 print_iters = get (problem. kwargs, :print_iters , true ),
7777 callback = get (problem. kwargs, :callback , nothing ),
78- for_expval = true , # undocumented
79- for_pwc = true , # undocumented
80- for_time_continuous = false , # undocumented
81- for_parameterization = false , # undocumented
78+ check_state_kwargs = get (problem. kwargs, :check_state_kwargs , (;)),
79+ check_generator_kwargs = get (problem. kwargs, :check_generator_kwargs , (;)),
8280 kwargs...
8381)
8482
@@ -113,20 +111,16 @@ function optimize(
113111 )
114112
115113 if check
116- # TODO : checks will have to be method-dependent, and then we may not
117- # need all the `for_...` keyword arguments
114+ # TODO : checks maybe should be method-dependent
118115 for (i, traj) in enumerate (problem. trajectories)
119- if ! check_state (traj. initial_state)
116+ if ! check_state (traj. initial_state; check_state_kwargs ... )
120117 error (" The `initial_state` of trajectory $i is not valid" )
121118 end
122119 if ! check_generator (
123120 traj. generator;
121+ check_generator_kwargs... ,
124122 state = traj. initial_state,
125123 tlist = problem. tlist,
126- for_expval,
127- for_pwc,
128- for_time_continuous,
129- for_parameterization,
130124 )
131125 error (" The `generator` of trajectory $i is not valid" )
132126 end
0 commit comments