Agent-based optimization algorithms are an effective means of solving global optimization problems with design spaces containing multiple local minima, however, modifications have to be made to such algorithms to be able to solve constrained optimization problems. The gravitational search algorithm (GSA) is an efficient and effective agentbased method, however, the idea of global transfer of data that is key to the algorithm's success prohibits coupling of many state-of-the-art methods for handling constraints. Hence, a robust method, called separation-sub-swarm (3S) has been developed specifically for use with GSA by exploiting but also accommodating the global transfer of data that occurs in GSA, however it can also act as an entirely black-box module so is generally applicable. This newly developed 3S method has been shown to be efficient and effective at optimizing a suite of constrained analytical test functions using GSA.