v1.1.11
CVXPY version 1.1.11 introduces better verbose logging, several performance improvements, and various bug fixes. One performance optimization, namely multi-threaded compilation with OpenMP, is experimental, and must be opted into (see below).
Better verbose logging
When solving problems with verbose=True
, you will now see detailed logging that describes CVXPY's compilation of your problem, in addition to logs output by the underlying solver. This logging can be helpful when compiling large problems. (It is sometimes easy to forget that CVXPY is a compiler that interfaces your problems to low-level numerical solvers; CVXPY is not a solver.)
Here's an example of the new output.
===============================================================================
CVXPY
v1.1.11
===============================================================================
(CVXPY) Feb 26 10:30:24 PM: Your problem has 20 variables, 2 constraints, and 0 parameters.
(CVXPY) Feb 26 10:30:24 PM: It is compliant with the following grammars: DCP, DQCP
(CVXPY) Feb 26 10:30:24 PM: (If you need to solve this problem multiple times, but with different data, consider using parameters.)
(CVXPY) Feb 26 10:30:24 PM: CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.
-------------------------------------------------------------------------------
Compilation
-------------------------------------------------------------------------------
(CVXPY) Feb 26 10:30:24 PM: Compiling problem (target solver=OSQP).
(CVXPY) Feb 26 10:30:24 PM: Reduction chain: CvxAttr2Constr -> Qp2SymbolicQp -> QpMatrixStuffing -> OSQP
(CVXPY) Feb 26 10:30:24 PM: Applying reduction CvxAttr2Constr
(CVXPY) Feb 26 10:30:24 PM: Applying reduction Qp2SymbolicQp
(CVXPY) Feb 26 10:30:24 PM: Applying reduction QpMatrixStuffing
(CVXPY) Feb 26 10:30:24 PM: Applying reduction OSQP
(CVXPY) Feb 26 10:30:24 PM: Finished problem compilation (took 5.444e-03 seconds).
(CVXPY) Feb 26 10:30:24 PM: (Subsequent compilations of this problem, using the same arguments, should take less time.)
-------------------------------------------------------------------------------
Numerical solver
-------------------------------------------------------------------------------
(CVXPY) Feb 26 10:30:24 PM: Invoking solver OSQP to obtain a solution.
-----------------------------------------------------------------
OSQP v0.6.0 - Operator Splitting QP Solver
(c) Bartolomeo Stellato, Goran Banjac
University of Oxford - Stanford University 2019
-----------------------------------------------------------------
problem: variables n = 50, constraints m = 70
nnz(P) + nnz(A) = 700
settings: linear system solver = qdldl,
eps_abs = 1.0e-05, eps_rel = 1.0e-05,
eps_prim_inf = 1.0e-04, eps_dual_inf = 1.0e-04,
rho = 1.00e-01 (adaptive),
sigma = 1.00e-06, alpha = 1.60, max_iter = 10000
check_termination: on (interval 25),
scaling: on, scaled_termination: off
warm start: on, polish: on, time_limit: off
iter objective pri res dua res rho time
1 0.0000e+00 1.95e+00 6.37e+02 1.00e-01 1.61e-04s
200 1.9831e+01 2.92e-05 5.58e-06 1.29e+00 7.50e-04s
plsh 1.9831e+01 3.35e-16 8.89e-15 -------- 8.37e-04s
status: solved
solution polish: successful
number of iterations: 200
optimal objective: 19.8313
run time: 8.37e-04s
optimal rho estimate: 4.33e+00
-------------------------------------------------------------------------------
Summary
-------------------------------------------------------------------------------
(CVXPY) Feb 26 10:30:24 PM: Problem status: optimal
(CVXPY) Feb 26 10:30:24 PM: Optimal value: 1.983e+01
(CVXPY) Feb 26 10:30:24 PM: Compilation took 5.444e-03 seconds
(CVXPY) Feb 26 10:30:24 PM: Solver (including time spent in interface) took 1.555e-03 seconds
See #1251 for more context.
Performance improvements
We have made several optimizations to CVXPY's compilation process (#1255, #1259). These optimizations can sometimes yield modest to large reductions in the time CVXPY spends compiling your problem.
CVXPY 1.1.11 also includes experimental multi-threaded compilation, which can yield dramatic speed-ups on problems with many expressions. To enable multi-threaded compilation, you'll need to have OpenMP installed and compile from source. For example, on Linux with GCC, use
CFLAGS='-fopenmp' LDFLAGS='-lgomp' pip install cvxpy --no-binary cvxpy
Control the number of threads used either by setting the OMP_NUM_THREADS
environment variable, or by using the function cvxpy.set_num_threads
. The latter takes precedence.
Bug fixes
- CVXPY no longer resets warning filters on loggers (#1240 by @rileyjmurray )
- The
diag
atom'sis_nonneg
method now checks for PSD-ness (#1242 by @phschiele) - A fix to the Gurobi interface (#1246 by @bstellato)
- Reshaping with
order=C
now works properly (#1264 by @akshayka ) - The gradient of
quad_form
was fixed to handle complex inputs (#1261 by @SteveDiamond )