Holonic Manufacturing System (HMS) is a new concept for enterprise reconfiguration, order form selection and evaluation are very important problem in task allocation and carry out. This paper focuses on the dynamic re-configuration and task optimization of HMS. The concept of dynamic virtual clustering is extended to the control process of a holarchy or holonic organization. A task-oriented clustering mechanism and a corresponding optimization algorithm are presented as an efficient approach to the holonic control in the HMS domain. Simulation results show that the proposed model and algorithm are effective.