Our own research paper ESG Scores and Price Momentum Are More Than Compatible utilized the Knapsack problem to make the ESG strategies more profitable or Momentum strategies significantly less risky. The implementation of the Knapsack problem was created in R, using slightly modified Simulated annealing optimization algorithm. Recently, we have been asked about our implementation and the code. The code is commented and probably could be implemented more efficiently (in R or in another programming language). For example, R is more efficient with matrices, but the code would not be that “straightforward”. Lastly, the most important tuning parameter is the temperature decrease (the probability of accepting a new solution is falling with the rising number of iterations).