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

Add flow constraints #34

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add flow constraints #34

wants to merge 1 commit into from

Conversation

bentaculum
Copy link
Collaborator

Adds two modular constraints necessary for a network flow formulation, useful for example for single particle tracking:

  • Symmetry: # incoming edges = # outgoing edges
  • Minimum track length: Each starting track needs to contain at least the given number of edges. Currently only implemented for length 1, i.e. each node with a set appear indicator needs to have at least one outgoing edge.

Each constraint includes a functional test.

@codecov-commenter
Copy link

codecov-commenter commented Mar 27, 2023

Codecov Report

Merging #34 (53553f4) into main (dc797d4) will increase coverage by 0.32%.
The diff coverage is 97.82%.

@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   92.47%   92.80%   +0.32%     
==========================================
  Files          30       32       +2     
  Lines         718      764      +46     
==========================================
+ Hits          664      709      +45     
- Misses         54       55       +1     
Files Changed Coverage Δ
motile/constraints/min_track_length.py 95.23% <95.23%> (ø)
motile/constraints/__init__.py 100.00% <100.00%> (ø)
motile/constraints/in_out_symmetry.py 100.00% <100.00%> (ø)

@bentaculum
Copy link
Collaborator Author

@funkey I am wondering what would be a nice way to generalize the MinTrackLength constraint to arbitrary length (currently only implemented for min_length=1, which is trivial). Is there a way around creating indicator variables for all possible tracks of min_length and coupling them to e.g. the edges?

@funkey
Copy link
Member

funkey commented May 12, 2023

I think you could introduce an integer variable for each edge that counts the number of edges since appear (a constraint needs to ensure that each edge's length integer has to be one more than the incoming one). Then you can add a constraint that only allows for disappear events to happen if the integer is greater equal a threshold. That should do it.

@bentaculum bentaculum force-pushed the add_flow_constraints branch from 92dded9 to f38bf9d Compare July 20, 2023 12:12
@bentaculum bentaculum force-pushed the add_flow_constraints branch 2 times, most recently from f125d21 to f1d157f Compare July 27, 2023 18:34
Adds two modular constraints necessary for a network flow formulation,
useful for example for single particle tracking:
- Symmetry: # incoming edges = # outgoing edges
- Minimum track length: Each starting track needs to contain at least
  the given number of edges. Currently only implemented for length 1,
i.e. each node with a set appear indicator needs to have at least one
outgoing edge.

Each constraint includes a functional test.
@bentaculum bentaculum force-pushed the add_flow_constraints branch from f1d157f to 53553f4 Compare July 27, 2023 18:38
@bentaculum bentaculum marked this pull request as ready for review July 27, 2023 18:39
@bentaculum bentaculum marked this pull request as draft July 27, 2023 18:59
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