Optimising Power Flow in a Volatile Electrical Grid using a Message Passing Algorithm