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

New Connectivity Constraint #2207

Merged
merged 8 commits into from
Sep 1, 2022
Merged

New Connectivity Constraint #2207

merged 8 commits into from
Sep 1, 2022

Conversation

mochen4
Copy link
Collaborator

@mochen4 mochen4 commented Aug 25, 2022

The previous connectivity constraint turned out to be rather stiff in practice: structures may fail to evolve too much if the tolerance is low, or may become disconnected if the tolerance is high. This PR adopts an alternative approach for the constraint and should have better performance. The interface is also streamlined.

The previous constraint solves the heat equation where solid pixels are conductive, and impose $T=T_0$ on the top boundary. The idea was that for connected structure, solid pixels should be heated up, and thus we use the density-weighted p-norm $(\frac{\sum \rho (T-T_0)^p}{\sum \rho})^\frac1{p}$ as the measure of connectivity.

In the new approach, in addition to being conductive, solid pixels are also sources; but $T=0$ on the top boundary. The idea was that for connected structure, heat from solid pixels should be able to diffuse away from the top boundary, and thus we use $\frac{({\sum T^p})^\frac1{p}}{\alpha}-1$ as the measure, where $\alpha$ is some normalization factor.

Here is the comparison of performance:
For the disconnected structure
image
The previous solver returned 0.6369810999723368 as forward value, and the gradients looked like
image

In comparison, the new solver returns 3.2973988093027025 as forward value, and the gradients look like (notice the change in scale from the colorbar)

For a connected structure
image
The previous forward value was 0.06833918047665405, and the gradients looked like
image

The new solver returns -0.9379063204901158, and the gradients look like (again, notice the change in scale from the colorbar)

In summary, the forward measure should now be positive for disconnected structure and negative for connected structure (with appropriately chosen hyper-parameters, especially a reasonably large cond_s). The gradients are also much larger for pixels that can "bridge" disconnected components; and smaller overall for connected structures

@mochen4 mochen4 changed the title Connectivity New Connectivity Constraint Aug 25, 2022
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2022

Codecov Report

Merging #2207 (5e9e4ce) into master (63cd51f) will increase coverage by 0.27%.
The diff coverage is 6.32%.

@@            Coverage Diff             @@
##           master    #2207      +/-   ##
==========================================
+ Coverage   73.24%   73.52%   +0.27%     
==========================================
  Files          17       17              
  Lines        4897     4873      -24     
==========================================
- Hits         3587     3583       -4     
+ Misses       1310     1290      -20     
Impacted Files Coverage Δ
python/adjoint/connectivity.py 8.64% <6.32%> (-1.84%) ⬇️
python/simulation.py 76.84% <0.00%> (ø)

@stevengj
Copy link
Collaborator

stevengj commented Sep 1, 2022

Great! Would be good to have a tutorial & documentation; tutorial to start with.

@stevengj stevengj merged commit bb16c28 into NanoComp:master Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants