This paper proposes a general approach, called a think-globally-act-locally method with weighted arcs (TGALW), which can be used to compute a liveness-enforcing supervisor (LES) for the Petri net (PN) model of a flexible manufacturing system (FMS) prone to deadlocks. Compared with siphon-based deadlock prevention policies that are usually rather conservative, the method is especially effective for generalized PN classes such as (SR)-R-4 and (SPR)-P-4 and also leads to optimal or near optimal LESS while maintaining the necessary computations simple. An original PNM is first transformed into a net that is behaviorally equivalent to it. A global sink/source place (GP) is used temporarily in the design steps and is finally removed when the liveness of the system is achieved. At each iteration step, bad markings are identified and then controlled by monitors through an established place-invariant based method. A condition of the optimal controllability of a bad marking is proposed, i.e., if all bad markings are optimally controlled at each iteration step, the TGALW method can find an optimal LES. Redundancy of monitors is checked. Typical examples existing in the literature are used to demonstrate applicability and the effectiveness of the proposed method. (C) 2015 Elsevier Inc. All rights reserved.