I'm using postgreSQL and I'm running the pgr_astar function to get the optimal path. I calculated my path using a formula that uses angle of elevation or the angle of depression as input. So I'm getting negative values on the cost column, I pgr_astr function does not return any result when I'm using the cost values.

Any suggestion please? How can I manipulate this function to get the optimal path using the cost's negative values?

  • What if you just add a constant for making all values positive? If zero cost means that you reach the target in no time then what would negative cost mean? – user30184 Aug 8 '18 at 6:38
  • Thank you for commenting, a negative value represent a fuel consumption of a down hill where the fuel consumed is -value from the fuel consumption of a flat segment. – Ben Aug 8 '18 at 15:24
  • Calculate some other measure that is always positive. Like absolute fuel consumption (liters/km) or relational (90 percent of the consumption on flat). – user30184 Aug 8 '18 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.