Simulated annealing for discrete optimisation implementation and minor bug fixes