-In this paper, we propose a new ant-based algorithm for the dynamic routing and wavelength assignment (RWA) problem in optical WDM networks under the wavelength continuity constraint.Unlike conventional approaches, which usually require centralized global network information, our new RWA algorithm constructs the routing solution in a distributed manner by means of cooperative ants.To facilitate the ants' foraging task, we adopt in our algorithm a probabilistic routing table structure for route selection. The new algorithm is highly adaptive in that it always keeps a suitable number of ants in the network to cooperatively explore the network states and continuously update the routing tables, so that the route for a connection request can be determined promptly by the current states of routing tables with only a small setup delay. Some new schemes for path scoring and path searching are also proposed to enhance the performance of our ant-based algorithm. Extensive simulation results upon three typical network topologies indicate that the proposed algorithm has a very good adaptability to traffic variations and it outperforms both the fixed routing algorithm and the promising fixed-alternate routing algorithm in terms of blocking probability. The ability to guarantee both a low blocking probability and a small setup delay makes the new ant-based routing algorithm very attractive for both the optical circuit switching networks and future optical burst switching works.