Skip to content

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

Description

@Jimmyazarnoosh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions