Skip to content

Commit

Permalink
Fix ignore attribute for disappear costs
Browse files Browse the repository at this point in the history
  • Loading branch information
funkey committed Jan 22, 2024
1 parent c160b19 commit 3ec2916
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions motile/costs/disappear.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class Disappear(Costs):
at no cost.
"""

def __init__(self, constant: float) -> None:
def __init__(self, constant: float, ignore_attribute: str | None = None) -> None:
self.constant = Weight(constant)
self.ignore_attribute = ignore_attribute

def apply(self, solver: Solver) -> None:
disappear_indicators = solver.get_variables(NodeDisappear)

for index in disappear_indicators.values():
for node, index in disappear_indicators.items():
if self.ignore_attribute is not None:
if solver.graph.nodes[node].get(self.ignore_attribute, False):
continue
Expand Down

0 comments on commit 3ec2916

Please sign in to comment.