numagic / lumos

scalable accelerated optimal control
MIT License
16 stars 0 forks source link

working automatic assembly of residuals #101

Closed yunlongxu-numagic closed 1 year ago

yunlongxu-numagic commented 1 year ago

Summary

In this PR, we make the collection of residuals automatic, so the users no longer have to pipe residuals from leaf node submodels all the way manually to top level model.

How does it work under the hood?

What has been done is very similar to con_outputs. We leverage the mechanism that automatically collects outputs, and the user have to define what subsets of the outputs constitute a 'residual'.

Why is it different to how we treat con_outputs?

How should I change my model?

At the model where residuals exist (see this diff as an example)

At parent models (see this diff as an example), simply remove all the operations that pipe residuals from child models