that, which (pronouns) Use that and which in referring to inanimate objects and to animals without a name. Use that for essential clauses, important to the meaning of a sentence, and without commas: I remember the day that we met. Use which for nonessential clauses, where the pronoun is less necessary, and use commas: The team, which finished last a year ago, is in first place.
(Note that this formulation folds in a recommendation against that used to refer to human beings.)
Uniquely referring NPs like the only solution to the problem can have either sort of relative:
The only solution to the problem that will satisfy them is to abandon the project. [restrictive]
The only solution to the problem, which will satisfy them, is to abandon the project. [non-restrictive]