Heuristics are numerical methods that can solve difficult optimization models, such as models with multiple local optima, or with discontinuities in their objective functions and constraints. We provide a tutorial for using such methods, in which we tackle the classic subset-sum problem. The chapter is hands-on, and all ideas are illustrated through R code. We also show how the ideas of the tutorial can be used in two applications: selecting variables in a regression model, and computing weights for a portfolio of financial assets