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

Fix ILP solver/motile #14

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ include_package_data = True

[options.extras_require]
ilp =
motile >= 0.2
motile >= 0.3
dev =
pytest
ruff
Expand Down
14 changes: 7 additions & 7 deletions trackastra/tracking/ilp.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,35 +109,35 @@ def solve_full_ilp(
used_costs = SimpleNamespace()

# NODES
solver.add_costs(
solver.add_cost(
motile.costs.NodeSelection(weight=p.nodeW, constant=p.nodeC, attribute="weight")
)
used_costs.nodeW = p.nodeW
used_costs.nodeC = p.nodeC

# EDGES
solver.add_costs(
solver.add_cost(
motile.costs.EdgeSelection(weight=p.edgeW, constant=p.edgeC, attribute="weight")
)
used_costs.edgeW = p.edgeW
used_costs.edgeC = p.edgeC

# APPEAR
solver.add_costs(motile.costs.Appear(constant=p.appearC))
solver.add_cost(motile.costs.Appear(constant=p.appearC))
used_costs.appearC = p.appearC

# DISAPPEAR
solver.add_costs(motile.costs.Disappear(constant=p.disappearC))
solver.add_cost(motile.costs.Disappear(constant=p.disappearC))
used_costs.disappearC = p.disappearC

# DIVISION
if allow_divisions:
solver.add_costs(motile.costs.Split(constant=p.splitC))
solver.add_cost(motile.costs.Split(constant=p.splitC))
used_costs.splitC = p.splitC

# Add constraints
solver.add_constraints(motile.constraints.MaxParents(1))
solver.add_constraints(motile.constraints.MaxChildren(2 if allow_divisions else 1))
solver.add_constraint(motile.constraints.MaxParents(1))
solver.add_constraint(motile.constraints.MaxChildren(2 if allow_divisions else 1))

solver.solve()

Expand Down
Loading