Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNSF for fully linear systems #400

Merged
merged 15 commits into from Jul 10, 2019

Conversation

Projects
None yet
2 participants
@FreyJo
Copy link
Member

commented Jul 4, 2019

In this PR, I added a linear term in the controls to the Linear Output part of GNSF.
This makes it possible to use GNSF with fully linear systems more efficiently without calling an external function.
In the case that f_LO is trivial, I moved more into the precomputation phase.
Also, the automatic structure detection is updated wrt to the new structure.

New GNSF structure with BLO.pdf

Old GNSF structure without BLO

@codecov

This comment has been minimized.

Copy link

commented Jul 4, 2019

Codecov Report

Merging #400 into master will decrease coverage by 0.08%.
The diff coverage is 69.03%.

@@            Coverage Diff             @@
##           master     #400      +/-   ##
==========================================
- Coverage   59.89%   59.81%   -0.09%     
==========================================
  Files          49       49              
  Lines       10308    10352      +44     
==========================================
+ Hits         6174     6192      +18     
- Misses       4134     4160      +26
@codecov

This comment has been minimized.

Copy link

commented Jul 4, 2019

Codecov Report

Merging #400 into master will decrease coverage by 0.12%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master     #400      +/-   ##
==========================================
- Coverage   59.89%   59.77%   -0.13%     
==========================================
  Files          49       49              
  Lines       10308    10391      +83     
==========================================
+ Hits         6174     6211      +37     
- Misses       4134     4180      +46

@FreyJo FreyJo force-pushed the FreyJo:GNSF_fully_linear branch from 3cd9276 to 467b33f Jul 4, 2019

@FreyJo FreyJo changed the title [WIP] GNSF for fully linear systems GNSF for fully linear systems Jul 5, 2019

@FreyJo

This comment has been minimized.

Copy link
Member Author

commented Jul 5, 2019

I suggest to merge this, if there are no remarks/complaints.

@giaf

This comment has been minimized.

Copy link
Collaborator

commented Jul 5, 2019

@FreyJo I have something else for you here, we can discuss when you come to the office ;)

@FreyJo FreyJo force-pushed the FreyJo:GNSF_fully_linear branch from f12a79e to c57dcc7 Jul 8, 2019

@giaf

This comment has been minimized.

Copy link
Collaborator

commented Jul 8, 2019

I have one fix in case of adjoint sensitivities. At line 1798 of sim_gnsf.c

// forward and adjoint sensitivities are constant and already computed
you state that forward and adjoint sensitivities are constant and already computed.

This is true for the forward sensitivities (since the seeds are constantly I for the states and 0 for the inputs), but this is not true for the adjoint sensitivities (since the adjoint seed changes every time the routine is called).

To fix that, you just need to compute the adjoint sensitivity as the product of forward sensitivity (transposed) and anjoint seed, lambda = S_forw' * in->S_adj using blasfeo_dgemv_t, at line1798 too. Then this

blasfeo_unpack_dvec(nx + nu, lambda, 0, out->S_adj);
will correctly extract the adjoint sensitivity from lambda.

@FreyJo FreyJo closed this Jul 8, 2019

@FreyJo FreyJo reopened this Jul 8, 2019

@FreyJo

This comment has been minimized.

Copy link
Member Author

commented Jul 9, 2019

Thanks @giaf ! I fixed this.
Also, I take the forward seed into account now.
However, I think we dont really need them.
In the whole project, they are only used with identity matrix.
So we could think about removing in->S_forw imo, since one can always multiply with something else outside.

@FreyJo FreyJo force-pushed the FreyJo:GNSF_fully_linear branch from dd2adf3 to 3ba234c Jul 10, 2019

@FreyJo FreyJo force-pushed the FreyJo:GNSF_fully_linear branch from 3ba234c to 4ae6df8 Jul 10, 2019

@giaf giaf merged commit 48096c8 into acados:master Jul 10, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@FreyJo FreyJo deleted the FreyJo:GNSF_fully_linear branch Jul 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.