We propose an automated method for velocity picking that allows to estimate appropriate velocity functions for the normal moveout (NMO) correction of common depth point (CDP) gathers, valid for either hyperbolic or nonhyperbolic trajectories. In the hyperbolic velocity analysis case the process involves the simultaneous search (picking) of a certain number of time-velocity pairs where the semblance, or any other coherence measure, is high. In the nonhyperbolic velocity analysis case, a third parameter, usually associated with the layering and/or the anisotropy, is added to the searching process. The proposed technique relies on a simple but effective search of a piecewise linear curve defined by a certain number of nodes in a 2D or 3D space that follows the semblance maxima. The search is carried out efficiently using a constrained very fast simulated annealing algorithm. The constraints consist of static and dynamic bounding restrictions, which are viewed as a means to incorporate prior information about the picking process. This allows to avoid those maxima that correspond to multiples, spurious, and other meaningless events. Results using synthetic and field data show that the proposed technique permits to automatically obtain accurate and consistent velocity picks that lead to flattened events, in agreement with the manual picks. As an algorithm, the method is very flexible to accommodate additional constraints (e.g. preselected events) and depends on a limited number of parameters. These parameters are easily tuned according to data requirements, available prior information, and the user's needs. The computational costs are relatively low, ranging from a fraction of a second to, at most, 1-2 seconds per CDP gather, using a standard PC with a single processor.