After each sample period, the new initial states, s0, need to be reset within the model. This PR adds support for resetting that value within the dynamic data and impacted parts of the dynamic model. The function reset_s0! is now exported so that the user can reset this value. In addition, I added tests for this function within runtests.jl and I reformatted the test/ subdirectory slightly so that all of the functions are in their own file.
In the sparse formulation, reset_s0! resets s0 within the dynamic data, and it resets the variable bounds on s at time 0 (thus fixing the first state to the value of s0.
For the dense formulation, reset_s0! resets s0 in the dynamic data, and it also calculates a new linear and constant term in the objective function. It also changes the impacted constraint bounds for the Jacobian. Because resetting s0 should be a quick and efficient call, I added blocks to the DenseLQDynamicBlocks that store the matrices needed to get the new linear and constant terms and for calculating the new constraint bounds. This also meant reconfiguring the functions _build_H_blocks and _set_G_blocks!. The data within DenseLQDynamicBlocks is designed to just be multiplied by s0 to get the desired final values.
After each sample period, the new initial states,
s0
, need to be reset within the model. This PR adds support for resetting that value within the dynamic data and impacted parts of the dynamic model. The functionreset_s0!
is now exported so that the user can reset this value. In addition, I added tests for this function withinruntests.jl
and I reformatted thetest/
subdirectory slightly so that all of the functions are in their own file.In the sparse formulation,
reset_s0!
resetss0
within the dynamic data, and it resets the variable bounds ons
at time 0 (thus fixing the first state to the value ofs0
.For the dense formulation,
reset_s0!
resetss0
in the dynamic data, and it also calculates a new linear and constant term in the objective function. It also changes the impacted constraint bounds for the Jacobian. Because resettings0
should be a quick and efficient call, I added blocks to theDenseLQDynamicBlocks
that store the matrices needed to get the new linear and constant terms and for calculating the new constraint bounds. This also meant reconfiguring the functions_build_H_blocks
and_set_G_blocks!
. The data withinDenseLQDynamicBlocks
is designed to just be multiplied bys0
to get the desired final values.