 The study aimed to determine the best settings for directional overcurrent relays, dockers, for protecting an AC microgrid in both island and grid connected operations. Two different objective functions were used to compare the total operating time of all primary dockers. The optimal settings obtained in either mode of the microgrid differed depending on the varying magnitude of fault currents. A mixed integer nonlinear programming problem was formulated to obtain the settings, which were then optimized using various algorithms including firefly algorithm, simulated annealing algorithm, and genetic algorithm. The results showed that the settings obtained in common operation modes were robust and no miscoordination occurred in any of the operation modes. This article was authored by Pranjil Niranjan, Ravindra Kumar Singh and Niranjan Kumar Choudhury.