Converting problems to MOSEK from CVX

I am having trouble understanding how things work with solvers inside CVX and outside CVX with the same solver. I implemented an optimization problem on CVX calling MOSEK. The variable that needed to be optimized was of size 133 x 133 x 75. The problem was solved to optimality in around 1500 seconds. I work on a machine (Intel Core i9-9820X CPU ) with 32 GB of installed RAM.
Since I was getting a good optimal result, I implemented the problem outside CVX, on Python, calling MOSEK because I plan to move on to larger datasets. However, for the same smaller dataset that I used in CVX, the solver consumes 100pcnt memory and kept running for more than half an hour before I force stopped it.
Am I wrong in thinking that if something works on CVX in 1500 seconds, then doing exactly the same problem, calling the same solver outside CVX can be done in similar runtime?
If I have got something wrong then would be glad to know from an expert.

Perhaps if you show your complete CVX and Python codes, together with solver output, one of the Mosek employees who read this forum can provide an assessment (maybe they will ask you to generate a Mosek task file).

Thanks, am in touch with MOSEK people. But wanted to confirm here if that’s a common thing thats reported with CVX. This is way more difficult than I had imagined. I wish CVX could extend itself to larger scale problems.

You may or may not have provided the same optimization problem to CVX and Python. Even if the optimization problem you provided is the same, CVX performs transformations to the problem you entered before providing the problem to the solver (Mosek in this case). Among other things, CVX may decide to send the dual to Mosek rather than the primal (if so, the CVX output will tell you so). CVX’s reformulation decisions may result in a problem that is easier (faster) for the solver to solve, but it might be more difficult in some cases. There is also the matter of what solver parameters are specified, and whether the default solver parameter values are used, and even whether the defaults are the same depending on what entity calls the solver.

One thing you can try is limiting the number of threads (MSK_IPAR_NUM_THREADS). That might be making the difference between your runs in various environments.

1 Like

Thanks, restricting the number of threads worked.

1 Like