An energy-based approach to topology optimization using the Hu-Washizu variational principle