In this paper we study the problem of optimal dividend payment strategy which maximizes the expected discounted sum of dividends to a multidimensional set up of n associated insurance companies where the surplus process follows an n-dimensional compound Poisson process. The general manager of the companies has the possibility at any time to exercise an irreversible switch into another regime; we also take into account an expected discounted value at ruin. This multidimensional dividend problem is a mixed singular control/optimal problem. We prove that the optimal value function is a viscosity solution of the associated HJB equation and that it can be characterized as the smallest viscosity supersolution. The main contribution of the paper is to provide a numerical method to approximate (locally uniformly) the optimal value function by an increasing sequence of sub-optimal value functions of admissible strategies defined in an n-dimensional grid. As a numerical example, we present the optimal time of merger for two insurance companies.