Multi-parameter constraint minimization in R

I am trying to figure out if it is possible to use R to perform a minimization with with multiple constraints. Where the constraints do not have a closed form.

In a nutshell, I have a set of random numbers (generated with fixed seeds). I have also defined a function, say f(theta) that will take a vector consisting of model parameters and transform my original set of random numbers into a random sample from the defined distribution.

I am trying to find a set of parameters such that when fed into f will resulting in a sample that will have the 2.5th, 5th, 10th percentile less than or equal to a set targets while minimizing the difference between the target and actual values.