How can I eliminate Inaccurate/solved status? I’ve already set the precision to best.
Setting precision to best
is certainly not going to help. The problem is that the solvers cannot achieve enough accuracy to return a normal Solved
status. There’s not much you can do here, really, except perhaps try different solvers.
Perhaps you can improve your model formulation, such as scaling of the variables.
Thanks very much for your kind reply.
Thanks for your help. You mean scaling of the variables in convex fitting model or in the convex optimization problem? I’ve scaled the variables in the convex optimization.
I don’t understand your distinction. If you provide your complete model, preferably with all input data (i.e., reproducible), more help might be available. Or if that’s not a feasible, a “minimal” reproducible example which exhibits the problematic behavior.
Sir, this is the complete model of my problem. Again, thanks!
cvx_begin
variables Tem2(Nd) Pice_f(Non) Pem1_e(Non) wem1(Non) Eb(Nd+1) wice(Non);%Pbrk(Nd)
expressions Pem1_m(Non) Pbatt(Nd) Pbloss(Nd) Ub(Nd) Ub2(Nd);
Pbatt = -(Eb(2:Nd+1)-Eb(1:Nd))/dt*Se/Sp;
Ub2=2*Eb(1:Nd)/C*Se/Su2 + V0^2*n0*1/Su2;
Ub = sqrt(n0*Su2)*sqrtprod(Ub2,1)/Su;
Pbloss=bat.R*quad_over_lin(Pbatt,Ub2,0)*Sp/Su2;
Pem1_m=task.a0/Sp + task.a1*Pem1_e + task.a2*wem1*3000*2*pi/60/Sp;
Pice_loss = task.c0/Sp+task.c1*Pice_f+task.c2*Pice_f.*Pice_f*Sp+task.c3*wice.*wice*276.9838*276.9838/Sp;
minimize(sum(Pice_f))
subject to
%%%%%%%%%%%%% ICE on
ix=on;
Pbatt(ix) >= Pbloss(ix) + Pem1_e ...
+(task.b0(ix) + task.b1(ix).*Tem2(ix)*St + task.b2(ix).*square(Tem2(ix))*St^2)/Sp;%Pem1_m w, Pem1_loss w;
task.Preq_driving(ix) <= 1/task.Eff_t*(Tem2(ix).*task.wem2(ix)*St+ Pice_f*Sp...
-Pice_loss*Sp + Pem1_m*Sp); %(task.c0+task.c1*Pice_f*Sp+task.c2*Pice_f.*Pice_f*Sp*Sp+task.c3*(wice.*wice*276.9838*276.9838))
wice*276.9838==wem1*3000*2*pi/60+task.wem2(ix);
%%%%%%%%%%%%% ICE off
ix=~on;
Pbatt(ix) >= Pbloss(ix) + (task.b0(ix) + task.b1(ix).*Tem2(ix)*St + task.b2(ix).*square(Tem2(ix))*St^2)/Sp;
task.Preq_driving(ix) <= 1/task.Eff_t*(Tem2(ix).*task.wem2(ix)*St);
%%%%%%%%%%%%%%Constraints
Tem2 >= -5000/St;
Tem2 <= 5000/St;
Eb >= C/2*(task.Vmin^2-V0^2)*n0/Se;
Eb <= C/2*(task.Vmax^2-V0^2)*n0/Se;
Eb(1)==Eb(Nd+1);
Pbatt >= bat.Imin*Ub*Su/Sp;
Pbatt <= bat.Imax*Ub*Su/Sp;
Pice_f >= 5000/Sp;
Pice_f <= 330000/Sp;
wem1>=-1;
wem1<=1;
wice>=73.3038/276.9838;
wice<=276.9838/276.9838;
Pem1_e>=-1500*900/9.55/Sp;
Pem1_e<=1500*900/9.55/Sp;
cvx_end
If you have any questions about the model, please feel free to ask.
You have not provided reproducible code. Some input values are missing. While you’re at it, try to get all your code into the code box.
Since I don’t know the values of the MATLAB variables you haven’t provided, it’s hard for me to say much until you do.
Can you also show the output? Try running with as many solvers as you have (I presume at least sedumi and sdpt3).
could you please give me your email? I can send u the m files
I just sent you a message.
Also, please go ahead and show the ouput from running CVX with all the solvers you have available.
Have you examined the solution? Is there something specific about it that is rendering it unsuitable for use? The Inaccurate
status should not be interpreted as a sign that it’s hopeless, just that you should check the solution returned carefully. If it works well for the rest of your application, then you should consider specifying a lower precision for the solver; e.g., cvx_precision medium
.
The Inaccurate/solved status is eliminated when one of the expression is changed by using an alternative simpler mathamatic model. However, the solutions of the two CVX problem are almostly the same.