The cavity method is a mathematical method presented by Marc Mézard, Giorgio Parisi and Miguel Angel Virasoro in 1987 to derive and solve some mean field -type models in statistical physics, specially adapted to disordered systems. The method has been used to compute properties of ground states in many condensed matter and optimization problems.