-
Notifications
You must be signed in to change notification settings - Fork 28
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
CoilIntegratedCurvature
objective
#1485
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1485 +/- ##
==========================================
- Coverage 95.69% 95.69% -0.01%
==========================================
Files 101 101
Lines 25614 25633 +19
==========================================
+ Hits 24511 24529 +18
- Misses 1103 1104 +1
|
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +6.35 +/- 4.95 | +3.65e-02 +/- 2.85e-02 | 6.12e-01 +/- 1.4e-02 | 5.76e-01 +/- 2.5e-02 |
-test_equilibrium_init_medres | +7.13 +/- 2.36 | +3.27e-01 +/- 1.08e-01 | 4.92e+00 +/- 4.2e-02 | 4.59e+00 +/- 9.9e-02 |
test_equilibrium_init_highres | +4.40 +/- 2.45 | +2.63e-01 +/- 1.46e-01 | 6.23e+00 +/- 1.0e-01 | 5.97e+00 +/- 1.1e-01 |
test_objective_compile_dshape_current | +2.09 +/- 5.37 | +9.53e-02 +/- 2.45e-01 | 4.66e+00 +/- 2.0e-01 | 4.56e+00 +/- 1.4e-01 |
test_objective_compute_dshape_current | +6.79 +/- 14.27 | +3.71e-04 +/- 7.81e-04 | 5.84e-03 +/- 3.3e-04 | 5.47e-03 +/- 7.1e-04 |
test_objective_jac_dshape_current | +0.48 +/- 10.08 | +2.26e-04 +/- 4.73e-03 | 4.71e-02 +/- 3.4e-03 | 4.69e-02 +/- 3.3e-03 |
test_perturb_2 | +3.35 +/- 3.85 | +7.28e-01 +/- 8.37e-01 | 2.25e+01 +/- 2.1e-01 | 2.18e+01 +/- 8.1e-01 |
-test_proximal_freeb_jac | +14.89 +/- 3.28 | +1.13e+00 +/- 2.48e-01 | 8.68e+00 +/- 1.3e-01 | 7.56e+00 +/- 2.1e-01 |
test_solve_fixed_iter | +5.38 +/- 4.14 | +1.82e+00 +/- 1.40e+00 | 3.57e+01 +/- 1.3e+00 | 3.39e+01 +/- 4.8e-01 |
test_LinearConstraintProjection_build | -0.32 +/- 4.79 | -3.59e-02 +/- 5.33e-01 | 1.11e+01 +/- 3.9e-01 | 1.11e+01 +/- 3.7e-01 |
test_build_transform_fft_midres | +0.82 +/- 3.30 | +5.05e-03 +/- 2.04e-02 | 6.25e-01 +/- 1.8e-02 | 6.20e-01 +/- 9.1e-03 |
test_build_transform_fft_highres | +0.53 +/- 6.73 | +5.24e-03 +/- 6.65e-02 | 9.94e-01 +/- 6.4e-02 | 9.88e-01 +/- 1.9e-02 |
test_equilibrium_init_lowres | -0.21 +/- 2.50 | -8.51e-03 +/- 9.97e-02 | 3.98e+00 +/- 6.9e-02 | 3.99e+00 +/- 7.2e-02 |
test_objective_compile_atf | -0.54 +/- 1.74 | -4.53e-02 +/- 1.47e-01 | 8.37e+00 +/- 7.6e-02 | 8.42e+00 +/- 1.3e-01 |
test_objective_compute_atf | +1.15 +/- 3.31 | +1.83e-04 +/- 5.29e-04 | 1.62e-02 +/- 4.0e-04 | 1.60e-02 +/- 3.4e-04 |
test_objective_jac_atf | -0.66 +/- 1.86 | -1.27e-02 +/- 3.59e-02 | 1.92e+00 +/- 2.4e-02 | 1.93e+00 +/- 2.6e-02 |
test_perturb_1 | -0.35 +/- 2.32 | -5.26e-02 +/- 3.49e-01 | 1.50e+01 +/- 2.5e-01 | 1.50e+01 +/- 2.4e-01 |
test_proximal_jac_atf | +0.62 +/- 0.59 | +5.14e-02 +/- 4.85e-02 | 8.31e+00 +/- 4.2e-02 | 8.26e+00 +/- 2.4e-02 |
test_proximal_freeb_compute | -0.50 +/- 1.56 | -1.02e-03 +/- 3.16e-03 | 2.02e-01 +/- 2.1e-03 | 2.03e-01 +/- 2.4e-03 |
test_solve_fixed_iter_compiled | -0.60 +/- 0.94 | -1.26e-01 +/- 1.95e-01 | 2.07e+01 +/- 1.6e-01 | 2.08e+01 +/- 1.2e-01 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- give a
self._endpoint
attribute toCoilConvexity
to be True - check for this attribute in
_CoilObjective.build
to decide ifendpoint
should be true or not (False by default ifhasattr(self._endpoint)
is False - move errorif statement to after
super.build()
inbuild
ofCoilConvexity
- make docstring clearer for
CoilConvexity
- Fix docs
Call it |
desc/objectives/_coils.py
Outdated
data = tree_leaves(data, is_leaf=lambda x: isinstance(x, dict)) | ||
out = jnp.array( | ||
[ | ||
trapezoid( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can get the same thing if you leave off the endpoint and do (curvature*x_s*ds).sum()
. The integrand is periodic so the endpoint and start are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly less accurate then the trapezoid integration (atol=2e-5
vs atol=1e-6
at the grid resolution used in the tests) but I still like this change for the simplicity.
Co-authored-by: Yigit Gunsur Elmacioglu <102380275+YigitElma@users.noreply.github.com>
A scalar version of convexity for a curve:$\int \kappa |\partial_s \mathbf{x}| ds = 2 \pi$
Similar to our existing
CoilCurvature
objective, which is signed to indicate convexity.