This paper presents an algorithm to be implemented in a distribution management system (DMS) that is capable of managing an active distribution network (ADN). This goal is achieved by minimizing the cost of system operation, which is expressed in terms of cost of energy losses, cost of curtailed energy, cost of reactive support, and cost of shed energy. Furthermore, the exploitation of network reconfiguration in ADNs is investigated. This paper shows that the coordination of flexible network topology with the continuous active management of energy resources allows improving the efficiency of power delivery. The proposed DMS algorithm allows reducing the risk of energy loss rise, caused by the bigger generation capacity and the deferment of network upgrade that may be a follow-up of ADNs. The proposed method has been applied on a test network to verify the validity of the approach.