passing in options to solvers from cvxr solve function

263 Views Asked by At

I am using CVXR to solve a problem with constrains. The solver gives result that doesn't satisfy all constrains.

result <- solve(problem, solver='ECOS', verbose=TRUE, ecos.control(maxit=2000))

The last few lines of verbose output is like below:

100 +3.405e+04 +3.405e+04 +1e-09 5e-05 5e-09 1e-03 4e-12 0.9791 9e-01 2 0 0 | 15 0 Maximum number of iterations reached, recovering best iterate (87) and stopping.

The solver stopped at iteration 100, which could be the reason that the solution doesn't satisfy the constrain; or could be that the problem's solution is small number (1e-5) and the default tolerance was hit. So I tried to pass in extra argument into the solver according to document of package ECOSolveR:

ecos.control(maxit=2000)

Yet, the solver still stops at default maximum iteration of 100. What went wrong? How do I pass extra controls to the solver?

1

There are 1 best solutions below

0
On

I figured it out. The arguments should be all capital letters.

result <- solve(problem, solver='ECOS', verbose=TRUE, MAXIT=as.integer(2000))

I think this is inconsistent with the document.