The rapid development and integration of heterogeneous wireless networks provide ubiquitous communications for mobile users. The intelligent and multimodal mobile terminals should select the best access network at any time anywhere. However, the “best” is a complex and fuzzy concept, which has different meanings to different users and even to the same user under different conditions. There are various factors to consider when deciding which one is the best for a mobile terminal. In this paper, we design a generalized and flexible framework for the access network selection in heterogeneous wireless networks. The framework is generalized because it considers various factors in a comprehensive way to get the solutions. These factors can be classified as network-related or user-related, economic or non-economic, objective or subjective, accurate or fuzzy. Meanwhile, the framework is also flexible because these factors can be customized and adapted to specific solutions. Under the framework, given N mobile terminals and M access networks, we have developed a novel access network selection scheme based on a Quantum-inspired Immune Clonal Algorithm (QICA). Experimental results demonstrate that our proposed scheme provides better utilities for both the users and the access networks, and also better services for users as compared with four other schemes.