The partition function of the extended r-reduced Kadomtsev–Petviashvili hierarchy