A grand-canonical solution to a class of random optimization problems | Synapse