Negative penalty?

Is it possible to set a negative penalty to an area - which would then act as a bonus instead - to allow for preferred paths? Or would I have to assign an initial penalty to all nodes in the map instead?


Negative penalties are not supported by the algorithms used (A* and Dijkstra) so therefore negative penalties cannot (as of version 3.2) be stored (penalties are stored as unsigned values). The reason for the algorithms not supporting them are quite straight forward but do require a few lines to explain, so I will leave it out here.
You can however add an initial penalty to the whole graph and then ‘cut out’ areas which have a lower penalty. That would work fine. However do note that a very high initial penalty will make path calculations take longer since A* needs to search more nodes in high penalty regions.