Hello, I need some help understanding how best to use Custom evaluators—ArcGIS Pro | Documentation with ArcGIS Pro 3.2. I am attempting to create a custom evaluator class that will mimic the behavior of adding a strong restriction or preference for routes based on an attribute value. However, I have a list of many different attribute values I need to create routes for to demonstrate how the route solver output changes.
I think my trouble is that this class might only be accessing the cost attribute of the Edge and not actually looking at when Edge != Priority_Type.
Anybody have advice?
class EdgeCustomizer(arcpy.nax.AttributeEvaluator, Priority_Type):
def attach(self, network_query: arcpy.nax.NetworkQuery) -> bool:
"""Connect to and validate the network dataset."""
# Do additional validation checks before returning Boolean
return True
def refresh(self) -> None:
"""Reset internal state before solve."""
# Reset internal state in this method as needed
pass
def edgeValue(self, edge: arcpy.nax.Edge, Priority_Type):
# Get the value of the "Field_Type" attribute for the current edge
field_type_value = self.networkQuery.attributeValue(edge, "Field_Type")
# Check if the value is not equal to Priority_Type
if field_type_value != Priority_Type:
base_value = self.networkQuery.attributeValue(edge, self.attribute)
base_multiplier = 10
return base_value * base_multiplier
else:
# Return the original cost if the value is Priority_Type
return self.networkQuery.attributeValue(edge, self.attribute)