CVX/MOSEK problem format

Good evening to the cvx community.

I wonder if it is possible for CVX (when using an exterior solver such as MOSEK) to generate as an output the exact problem format that feeds MOSEK. For example for a conic optimization problem, a structure “prob” containing the fields {c,a,blc,blu, blx,bux, cones} is needed for MOSEK to run in a standalone manner. Is this possible, or is it handled exclusively internally in the cvx code?



Actually there is an undocumented feature that may provide what you are looking for. Indeed, one reason why I asked you to move this from the support channel to the Q&A forum is that I can answer it for everyone’s benefit here. I don’t know if this will enable you to do exactly what you want to do, but it might be close.

In CVX 2.0, we introduced a command called cvx_solver_settings that allows you to manipulate solver-specific parameters. The documentation for this feature is on this page of the CVX documentation. Please note the very strong warnings in that section on the dangers of using this feature.

However, there is one relatively safe way to use the cvx_solver_settings feature: the dumpfile setting. If you type

cvx_solver_settings( 'dumpfile', 'filename' )

where filename is the name of a .mat file, CVX will dump the following data into that file:

  • the raw input to the solver (e.g., mosekopt)
  • the raw output from the solver
  • the text sent to the screen by the solver

This data is extremely helpful when we encounter models that are difficult for a particular solver to solve: we can dump this raw data and send it to the solver vendor. The solver vendor does not need to run CVX to reproduce the problem.

Now, keep in mind that CVX still calls the solver as it always does; it simply captures the raw input and output for later examination. It is not possible to stop CVX from calling the solver in this case.

EDIT: I should point out that if you type help cvx_solver_settings, you’ll get a description of the dumpfile method. When I said “undocumented” above I meant that it is not yet in the users’ guide. I’ll rectify that.

I was wondering about the same, so it’s indeed a good idea to ask such questions on the forum.

Is it possible to get the dump without actually solving the problem? I only want the arguments sent to the optimizer, because I’m interested in trying some facial reduction techniques ( to generate an equivalent problem instance that might be smaller and easier to solve.

You could hack cvx_run_solver to intercept the actual call to MOSEK. Other than that, no.