Hi @Muhammad,
I’m not really sure what the issue is in your case. But from the logical point of view I don’t know if that yields to the expected behavior. So in general you want to have the biggest distance from all obstacles?! But what if the obstacle is behind you?
What about the solution with constraints instead of adapting the cost function?
Can you specify the errors more exactly? Does it also occur if you have just one obstacle far away? When does the solver starts to fail? How does the solution look like when it is still feasible?
Bye