MIT-REALM / neural_clbf

Toolkit for learning controllers based on robust control Lyapunov barrier functions
BSD 3-Clause "New" or "Revised" License
134 stars 44 forks source link

Miscellanous questions about learned contraction metric #18

Closed dtch1997 closed 1 year ago

dtch1997 commented 1 year ago

I have a couple questions about learned contraction metrics in train_cm.py:

  1. Is it correct that, in order for the contraction metric to be fully valid, M_loss must converge to 0? a. Corollary, if M_loss > 0, does it imply that there exists some x, x*, u* in the dataset on which the learned metric is not a valid contraction metric? b. Do you observe empirically that the M_loss eventually goes to 0?
  2. Is the setting used in the script the same as that used in the paper?
  3. (Edit) Another question based on the paper: At the end of section V-E, it is said that "it is possible to deploy a non-verified Lyapunov or barrier certificate safely using a real-time safety monitor" where the corresponding conditions are continuously checked online. Is it possible to do the same thing for a learned contraction metric?

Thanks!

dawsonc commented 1 year ago
  1. This is essentially true. Technically, M_loss computes the matrix on the LHS of eq 16 in the paper and makes sure that it's maximum eigenvalue is less than -0.1, so if your maximum eigenvalue is -0.01 then the metric should still be valid but will have positive M_loss (but empirically, when the maximum eigenvalue is close to 0 then the contraction starts getting unacceptably slow in the direction of the corresponding eigenvector). a. Yes, with the same -0.1 caveat from above. b. For simple dynamics (like the ones we use), I would expect to see M_loss go to zero. If it doesn't, then I would check the empirical performance of the controller to see if it's "good enough" (the code here should log plots of controller performance to tensorboard throughout training). Sometimes you get situations where the metric isn't valid near the boundary of the training space but it's valid on the interior.
  2. The experiments in our survey paper were run using the train_cm.py script.
  3. The safety monitors for Lyapunov/barrier functions are pretty trivial: you approximate the derivative of V (or h) along the current trajectory using sequential samples, and if the derivative stops satisfying the relevant condition (eq 4c or 12) then you flag a safety violation. A contraction metric-based monitor would be less trivial since you would need to check that the distance between nearby trajectories is shrinking, so you can't do it using just the trajectory that you're currently experiencing, you need some way of "imagining" (or simulating) the behavior of nearby trajectories.
dawsonc commented 1 year ago

I'm happy to answer these more research-y questions, but let's move them over to the (newly activated) discussion section of this repo and reserve issues for bugs/feature requests for the code itself.