Hi there.
I tried like “distance between process’s segments”
Take a read of Please read: make it easier to help you. It’s easier to help if you can provide the code as a minimal working example.
maximize linearity of process to goal
Can you clarify what this means?