SimVascular / SimVascular/svVascularize

f.connect() fails to generate connections "Could not find optimal assignment"

Open
#67 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
19
Forks
11
Avg merge
1h 58m
Merged PRs (30d)
19

Description

Description

Following the Quickstart tutorial, I was unable to get f.connect() to generate any connections.

The pipeline runs without crashing, but the connection step fails to produce results. The output is:
C:\Users...\svv\tree\branch\bifurcation.py:222: RuntimeWarning: Method L-BFGS-B cannot handle constraints.
result = minimize(cost, x0, bounds=[(0.05, 0.95), (0.05, 0.95)], callback=callback,

Collision detected 0-1.
Collision detected 0-0.
Function data shape: 1540
Calculating optimal assignment...
ERROR: Could not find optimal assignment. Try increasing the number of neighbors allowed in search.

After this, no connections are created:
tc = f.connections.tree_connections[0]
print(tc.assignments) # []
print(tc.connections) # 0

Both outputs are empty. Is this behavior expected under certain geometry/tree configurations, or does it indicate a potential issue in the connection/assignment step? If expected, could you clarify what minimum conditions (e.g., tree density, domain scale, or neighbor settings) are required for connect() to generate connections?

Reproduction

Running the code from the quickstart tutorial:

import pyvista as pv
from svv.domain.domain import Domain
from svv.forest.forest import Forest

Creating the Tissue Domain

cube = Domain(pv.Cube())
cube.create()
cube.solve()
cube.build()

Creating the Vascular Forest Object

f = Forest()
f.set_domain(cube)
f.set_roots()
f.add(50)

Form connections

f.connect()

tc = f.connections.tree_connections[0]
print(tc.assignments) # []
print(tc.connections) # 0

Expected behavior

The code is expected to generate multiple vascular trees and then create valid connections between them, resulting in one unified connected network instead of separate trees.

Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct and Contributing Guidelines

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Quickstart example and inspect svv/tree/branch/bifurcation.py around line 222, where the L-BFGS-B warning is emitted. Trace the "Could not find optimal assignment" path and the neighbor-search settings; done means the documented example creates non-empty assignments and connections or the minimum failing conditions are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.