What is the explanation of the 2 arguments in the function gosolnp {Rsolnp}: n.restarts & n.sim?

From the package writeup:

n.restarts: The number of solver restarts required

n.sim: The number of random parameters to generate for every restart of the solver. Note that there will always be significant rejections if inequality bounds are present. Also, this choice should also be motivated by the width of the upper and lower bounds

From my understanding then, if I set n.restarts=5 and n.sim=10, then for each n.restart it will generate n.sim starting points. Let's say I have no inequality constraints (so all random starting points are permissible), then I would have effectively rerun solnp $5 \times 10 = 50$ times.

Is that correct? Why then would I have these 2 arguments in the function and not just 1 where I could directly specify 50 reruns? This makes me think my understanding is flawed.


1 Answer 1


I also got very confused by this. In the note below the description of gosolnp in the documention, it also says:

"Given a set of lower and upper bounds, the function generates, for those parameters not set as fixed, random values [...] The resulting values are then sorted, and the best N (N = random.restart) parameter vectors (corresponding to the best N objective function values) chosen in order to initialize the solver."

So the way that gosolnp works is (someone correct me please if I am wrong):

  1. Draw n.sim * n.restart random values from the parameter space and evaluate the objective function for each draw.
  2. Take the best n.restart draws and run solnp with the respective draw as a starting value.

n.restart is therefore not redundant as it specifies how many times the solver is run in the second step.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.