Gradient-Based Variable Ordering of Decision Diagrams for Systems with Structural Units