We consider financial networks where agents are linked to each other with financial contracts. A centralized clearing mechanism collects the initial endowments, the liabilities and the division rules of the agents and determines the payments to be made. A division rule specifies how the assets of the agents should be rationed, the four most common ones being the proportional, the priority, the constrained equal awards, and the constrained equal losses division rules. Since payments made depend on payments received, we are looking for solutions to a system of equations. The set of solutions is known to have a lattice structure, leading to the existence of a least and a greatest clearing payment matrix. Previous research has shown how decentralized clearing selects the least clearing payment matrix. We present a centralized approach towards clearing in order to select the greatest clearing payment matrix. To do so, we formulate the determination of the greatest clearing payment matrix as a programming problem. When agents use proportional division rules, this programming problem corresponds to a linear programming problem. We show that for the other common division rules, it can be written as an integer linear programming problem.