The concept of rainbow connection was introduced by Chartrand et al. in 2008. The rainbow connection number, rc(G), of a connected graph G = (V, E) is the minimum number of colors needed to color the edges of E, so that each pair of the vertices in V is connected by at least one path in which no two edges are assigned the same color. The rainbow vertex-connection number, rvc(G), is the vertex version of this problem. In this paper, we introduce mixed integer programming models for both versions of the problem. We show the validity of the proposed models and test their efficiency using a nonlinear programming solver.