Cannot perform the operation: {negative constant} .* {convex}

Hi
I do not know how to fix this problem about"Disciplined convex programming error:
Cannot perform the operation: {negative constant} .* {convex}".

2-Pr(n,1)*inv_pos(Pr_vec(n,1))-drd_vec(n,k)*inv_pos(drd(n,k)),which leads to this error.
Pr_vec and drd_vec are cvx variables.
thank u vvvvery much

Thanks.Recently I was faced with a new problem :I do not know if cvx variable can be the denominator in my constraint function.
If cvx variable must be a denominator,is there any other form of expression.
Thanks for attention.

You have to provide more context. You already know about inv_pos. There is also quad_ovr_lin. And gp mode has some provision for division, subject to the special gp rules.

And as you know from reading the link in my previous post, the first thing you must do is prove convexity of the constraint.

pr,ps,drd,dre,drd1,drs,x[n],y[n] are cvx variables .I can prove these formulations are convex.
But Status: Failed Optimal value (cvx_optval): NaN.I don’t konw why.Here are the simulation results.
Calling SDPT3 4.0: 7404 variables, 2749 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 2749
dim. of sdp var = 3696, num. of sdp blk = 1848
dim. of linear var = 1858
dim. of free var = 2 *** convert ublk to lblk


SDPT3: Infeasible path-following algorithms


version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|1.6e+11|4.4e+02|1.7e+13|-2.119047e+09 0.000000e+00| 0:0:00| spchol 2 2
1|0.000|0.000|1.6e+11|4.4e+02|1.7e+13|-2.119041e+09 -2.589520e+01| 0:0:00| spchol 2 2
2|0.000|0.000|1.6e+11|4.4e+02|1.7e+13|-2.119032e+09 -9.242839e+01| 0:0:00| spchol 2 2
3|0.000|0.000|1.6e+11|4.4e+02|1.7e+13|-2.119007e+09 -2.417332e+02| 0:0:00| spchol 2 2
4|0.000|0.000|1.6e+11|4.4e+02|1.7e+13|-2.118932e+09 -4.029466e+02| 0:0:01|
*** Too many tiny steps: restarting with the following iterate.
*** [X,y,Z] = infeaspt(blk,At,C,b,2,1e5); spchol *12 *12
5|0.216|0.373|2.9e+14|6.7e-01|5.0e+13|-4.879461e+12 -3.404995e+04| 0:0:01| spchol *13 *13
6|0.415|0.482|1.7e+14|3.5e-01|3.6e+13|-3.126419e+12 -1.628239e+04| 0:0:01| spchol *12 *13
7|0.432|0.517|9.5e+13|1.7e-01|2.5e+13|-1.794276e+12 -9.130106e+03| 0:0:01| spchol *13 *13
8|0.626|0.692|3.6e+13|5.2e-02|1.1e+13|-6.650115e+11 -2.247263e+03| 0:0:01| spchol *11 *11
9|0.852|0.813|5.3e+12|9.7e-03|2.2e+12|-7.823601e+10 5.774712e+02| 0:0:01| spchol 4 4
10|0.904|0.755|5.1e+11|2.4e-03|3.6e+11| 6.232278e+09 1.045317e+03| 0:0:01| spchol 3 * 4
11|0.593|0.193|2.1e+11|1.9e-03|2.8e+11| 1.028548e+10 1.305084e+03| 0:0:01| spchol 2 3
12|0.657|0.529|7.1e+10|9.0e-04|1.6e+11| 1.208522e+10 2.459482e+03| 0:0:01| spchol 2 2
13|0.554|0.501|3.1e+10|4.5e-04|1.0e+11| 1.250595e+10 4.175582e+03| 0:0:01| spchol 2 2
14|0.483|0.469|1.6e+10|2.4e-04|6.9e+10| 1.295550e+10 6.775790e+03| 0:0:01| spchol 2 2
15|0.239|0.320|1.2e+10|1.6e-04|5.9e+10| 1.303757e+10 9.671978e+03| 0:0:01| spchol 2 2
16|0.753|0.146|3.1e+09|1.4e-04|5.1e+10| 1.153566e+10 1.090835e+04| 0:0:01| spchol 2 2
17|0.467|0.469|1.6e+09|7.4e-05|3.5e+10| 1.052076e+10 2.274660e+04| 0:0:01| spchol 2 2
18|0.408|0.232|9.6e+08|5.7e-05|3.0e+10| 8.761395e+09 3.084180e+04| 0:0:02| spchol 1 1
19|0.526|0.393|4.6e+08|3.4e-05|2.3e+10| 5.850293e+09 5.307568e+04| 0:0:02| spchol 1 1
20|0.127|0.088|4.0e+08|3.1e-05|2.4e+10|-4.631481e+07 6.372531e+04| 0:0:02| spchol 1 1
21|0.189|0.093|3.2e+08|2.8e-05|2.8e+10|-3.531733e+10 7.641409e+04| 0:0:02| spchol 1 1
22|0.115|0.086|2.9e+08|2.6e-05|3.9e+10|-3.035508e+11 9.218120e+04| 0:0:02| spchol 2 2
23|0.017|0.023|2.8e+08|2.5e-05|9.0e+10|-2.072092e+12 9.799027e+04| 0:0:02| spchol 2 2
24|0.005|0.005|2.8e+08|2.5e-05|3.5e+11|-1.193508e+13 9.955777e+04| 0:0:02| spchol 2 2
25|0.002|0.002|2.8e+08|2.5e-05|1.2e+12|-4.738211e+13 1.016774e+05| 0:0:02| spchol 2 2
26|0.001|0.002|2.8e+08|2.5e-05|3.5e+12|-1.498626e+14 1.055692e+05| 0:0:02| spchol 2 2
27|0.001|0.005|2.8e+08|2.5e-05|8.5e+12|-4.608635e+14 1.314480e+05| 0:0:02| spchol 2 2
28|0.001|0.001|2.8e+08|2.5e-05|2.6e+13|-1.424046e+15 1.367332e+05| 0:0:02| spchol 2 2
29|0.001|0.002|2.8e+08|2.5e-05|6.8e+13|-4.351296e+15 2.141687e+05| 0:0:02| spchol 2 2
30|0.001|0.001|2.8e+08|2.5e-05|2.0e+14|-1.362597e+16 3.716619e+05| 0:0:02| spchol 2 2
31|0.000|0.001|2.8e+08|2.5e-05|5.7e+14|-4.304005e+16 6.309286e+05| 0:0:02| spchol 2 2
32|0.000|0.001|2.8e+08|2.5e-05|1.8e+15|-1.397664e+17 9.534111e+05| 0:0:02| spchol 2 2
33|0.000|0.000|2.8e+08|2.5e-05|5.7e+15|-4.613563e+17 1.153289e+06| 0:0:03| spchol * 3 2
34|0.000|0.001|2.8e+08|2.5e-05|1.9e+16|-1.575923e+18 9.035589e+05| 0:0:03| spchol 2 2
35|0.000|0.000|2.8e+08|2.5e-05|6.7e+16|-5.824318e+18 1.120020e+06| 0:0:03| spchol * 3 3
36|0.001|0.000|2.8e+08|2.5e-05|3.2e+17|-2.813767e+19 9.811990e+05| 0:0:03| spchol * 3 3
37|0.000|0.000|2.8e+08|2.5e-05|3.8e+17|-3.413641e+19 1.055799e+06| 0:0:03| spchol * 3 3
38|0.901|0.000|2.8e+07|2.5e-05|2.8e+21|-2.548298e+23 1.061332e+06| 0:0:03|
sqlp stop: primal or dual is diverging, 7.4e+18

number of iterations = 38
Total CPU time (secs) = 2.87
CPU time per iteration = 0.08
termination code = 3
DIMACS: 2.8e+07 0.0e+00 2.1e-04 0.0e+00 -1.0e+00 1.1e-02


Status: Failed
Optimal value (cvx_optval): NaN

CVX accepted the problem as convex, but the solver failed. Given the use of log, ut seems you must be using CVXQUAD. Try replacing the CVXQUAD exponential.m with the original version from CVX, and using Mosek 9.x instead. Also, perhaps the scaling of input data is bad?