Although many energy-aware routing schemes have been proposed for wireless ad hoc networks, they are not optimized for networks with heterogeneous power supplies, where nodes may run on battery or be connected to the mains (grid network). In this paper, we propose several energy-aware routing algorithms for such ad hoc networks. The proposed algorithms feature directing the traffic load dynamically towards mains-powered devices keeping the hop count of selected routes minimal. We unify these algorithms into a framework in which the route selection is formulated as a bi-criteria decision making problem. Minimizing the energy cost for end-to-end packet transfer and minimizing the hop count are the two criteria in this framework. Various algorithms that we propose differ in the way they define the energy cost for end-to-end packet traversal or the way they solve the bi-criteria decision making problem. Some of them consider the energy consumed to transmit and receive packets, while others also consider the residual battery energy of battery-enabled nodes. The proposed algorithms use either the weighted sum approach or the lexicographic method to solve the bi-criteria decision making problem. We evaluate the performance of our algorithms in static and mobile ad hoc networks, and in networks with and without transmission power control. Through extensive simulations we show that our algorithms can significantly enhance the lifetime of battery-powered nodes while the hop count is kept close to its optimal value. We also discuss the scenarios and conditions in which each algorithm could be suitably deployed. (C) 2011 Elsevier B.V. All rights reserved.