DESC icon indicating copy to clipboard operation
DESC copied to clipboard

Add Coil Arclength Differential Variance Objective

Open dpanici opened this issue 1 year ago • 3 comments

  • Adds objective similar to the one detailed in Wechsung 2021 to penalize the variance of the arclength differential along a curve, which was claimed to be useful for avoiding issues with parameterization non-uniqueness in optimization.
  • Also add jitable flag to compute to skip past checks, as in _CoilObjective we use coil.compute, and the transform check can run into issues with jit when the quantity requested has non-empty transforms (like "x_s" in this PR)
  • [x] add a test for this
  • [x] Add simplified version, this is equal to the simsopt implementation with nintervals="full"

From reference: image image

dpanici avatar Jul 08 '24 23:07 dpanici

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_midres         |     +1.92 +/- 5.28     | +1.15e-02 +/- 3.17e-02 |  6.11e-01 +/- 3.0e-02  |  5.99e-01 +/- 9.0e-03  |
 test_build_transform_fft_highres        |     +1.03 +/- 2.70     | +1.02e-02 +/- 2.66e-02 |  9.98e-01 +/- 2.4e-02  |  9.88e-01 +/- 1.1e-02  |
 test_equilibrium_init_lowres            |     +6.39 +/- 7.70     | +2.41e-01 +/- 2.90e-01 |  4.01e+00 +/- 2.9e-01  |  3.77e+00 +/- 4.0e-02  |
 test_objective_compile_atf              |     +2.14 +/- 3.42     | +1.67e-01 +/- 2.67e-01 |  7.97e+00 +/- 1.9e-01  |  7.80e+00 +/- 1.9e-01  |
 test_objective_compute_atf              |     +1.79 +/- 1.40     | +1.85e-04 +/- 1.44e-04 |  1.05e-02 +/- 1.1e-04  |  1.03e-02 +/- 9.6e-05  |
 test_objective_jac_atf                  |     +2.54 +/- 3.03     | +4.96e-02 +/- 5.92e-02 |  2.00e+00 +/- 5.0e-02  |  1.95e+00 +/- 3.2e-02  |
 test_perturb_1                          |     +6.00 +/- 4.52     | +7.50e-01 +/- 5.65e-01 |  1.32e+01 +/- 4.0e-01  |  1.25e+01 +/- 4.0e-01  |
 test_proximal_jac_atf                   |     +0.11 +/- 0.87     | +8.94e-03 +/- 7.11e-02 |  8.21e+00 +/- 4.7e-02  |  8.20e+00 +/- 5.3e-02  |
 test_proximal_freeb_compute             |     -1.52 +/- 0.86     | -2.82e-03 +/- 1.60e-03 |  1.83e-01 +/- 9.7e-04  |  1.86e-01 +/- 1.3e-03  |
 test_build_transform_fft_lowres         |     +0.10 +/- 4.14     | +5.16e-04 +/- 2.19e-02 |  5.30e-01 +/- 1.7e-02  |  5.30e-01 +/- 1.3e-02  |
 test_equilibrium_init_medres            |     -0.87 +/- 1.16     | -3.66e-02 +/- 4.86e-02 |  4.16e+00 +/- 2.6e-02  |  4.20e+00 +/- 4.1e-02  |
 test_equilibrium_init_highres           |     -0.41 +/- 0.77     | -2.23e-02 +/- 4.27e-02 |  5.49e+00 +/- 3.5e-02  |  5.51e+00 +/- 2.4e-02  |
 test_objective_compile_dshape_current   |     +0.06 +/- 0.95     | +2.18e-03 +/- 3.69e-02 |  3.87e+00 +/- 3.6e-02  |  3.87e+00 +/- 9.8e-03  |
 test_objective_compute_dshape_current   |     +1.66 +/- 2.28     | +5.90e-05 +/- 8.12e-05 |  3.62e-03 +/- 4.8e-05  |  3.56e-03 +/- 6.5e-05  |
 test_objective_jac_dshape_current       |     -1.22 +/- 6.65     | -4.89e-04 +/- 2.67e-03 |  3.96e-02 +/- 2.3e-03  |  4.01e-02 +/- 1.3e-03  |
 test_perturb_2                          |     -0.65 +/- 1.79     | -1.17e-01 +/- 3.20e-01 |  1.77e+01 +/- 3.0e-01  |  1.78e+01 +/- 1.0e-01  |
 test_proximal_freeb_jac                 |     +0.04 +/- 1.33     | +3.16e-03 +/- 9.88e-02 |  7.43e+00 +/- 5.4e-02  |  7.43e+00 +/- 8.3e-02  |
 test_solve_fixed_iter                   |     +0.52 +/- 60.11    | +2.65e-02 +/- 3.08e+00 |  5.15e+00 +/- 2.2e+00  |  5.12e+00 +/- 2.2e+00  |

github-actions[bot] avatar Sep 24 '24 23:09 github-actions[bot]

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.52%. Comparing base (5d29342) to head (5f5f70f). Report is 1898 commits behind head on master.

Files with missing lines Patch % Lines
desc/objectives/_coils.py 96.55% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1113   +/-   ##
=======================================
  Coverage   95.51%   95.52%           
=======================================
  Files          96       96           
  Lines       23975    24005   +30     
=======================================
+ Hits        22900    22930   +30     
  Misses       1075     1075           
Files with missing lines Coverage Δ
desc/compute/_curve.py 100.00% <ø> (ø)
desc/objectives/__init__.py 100.00% <ø> (ø)
desc/transform.py 93.29% <100.00%> (+0.01%) :arrow_up:
desc/objectives/_coils.py 99.52% <96.55%> (+0.03%) :arrow_up:

... and 2 files with indirect coverage changes

codecov[bot] avatar Sep 25 '24 02:09 codecov[bot]

check for which curves this makes sense to have

dpanici avatar Sep 25 '24 18:09 dpanici

looks good to me @f0uriest

dpanici avatar Oct 16 '24 20:10 dpanici