Due to the growth and development of computer networks, the importance of the routing topic has been increased. The importance of the use of multicast networks is not negligible nowadays. Many of multimedia programs need to use a communication link to send a packet from a sender to several receivers. To support such programs, there is a need to make an optimal multicast tree to indicate the optimal routes from the sending source to the corresponding sinks. Providing an optimal tree for routing is a complicated problem. In this paper, we are looking forward a method for routing of multicast networks with considering some parameters such as the cost and delay. Also, this paper has emphasized the issue that every parameter in routing problem has different value for different packets. And in accordance to these parameters optimal routing multicast trees are proposed. To gain this end, the genetic algorithm and ant colony optimization approaches are adopted. The simulation results show that the presented algorithms are able to produce optimal multicast trees subject to the packets.