Allocating heat and electricity in an Integrated Energy System coupled with a water purification system