Routing and Wavelength Assignment (RWA) is the most concern in wavelength routed optical networks. This paper proposes a novel dynamic RWA scheme inspired by the idea of binary quadratic programming (BQP) formulation for the static RWA problem. Subsequently, a heuristic algorithm namely QP routing and wavelength assignment (QP-RWA) is proposed. In this method, links wavelength occupancy information is collected to be used, in order to establish the upcoming calls via adaptive routing technique. Performance evaluation results show that the proposed QP-RWA is capable of reducing the blocking rate. Besides, average network throughput is increased as well. However, the improvement in QoS is obtained at the expense of a slight increase in average path length.