Is there a way to print only the result (without any diagnosis)?

Before asking, let me show my pseudocode (as known as difference of convex (DC) programming):

K = 10;                        // given parameter
Pmax = 10;                 // given parameter
Pmax_each = 1.3*ones(K,1);        // given parameter

P_prev = Pmax/K*ones(K,1);        // Initialize P (which is the variable that I want to optimize.)
fobj_prev = inf;
iter = 0;
while iter < 100
    iter = iter + 1;

    clear cvx_P
    cvx_precision high
    cvx_begin quiet
        variable cvx_P(K)
        fobj = 0;
        for k_in_cvx = 1:K
            fobj = fobj + ...;    // fobj is defined as the sum of the function of cvx_P and P_prev over all k.
        end
        minimize ( fobj )
        subject to
            sum(cvx_P) <= Pmax;
            cvx_P(:) <= Pmax_each(:);
            cvx_P(:) >= 0
    cvx_end
    
    if norm(fobj_prev - fobj) < 1e-8
        break
    else
        fobj_prev = fobj;
        P_prev = cvx_P;
    end
end

The “fobj” function above has a term with a very large coefficient (randomly generated) and it is plugged into the logarithmic function. Due to this, results such as “Inaccurate/Solved, Inaccurate/Unbounded, Inaccurate/Infeasible” occurred very often depending on the value of the coefficients. However, by adding the phrase “cvx_precision high,” I could resolve the inaccurate issue, so that the problem result has been changed to “Solved.” Nevertheless, I am worried about some situations where the results are still in “Inaccurate” status.

Is there a command that hides most of the results but shows whether “inaccurate” or “accurate” only?
The “quiet” command I use hides everything, but I only want to check if the results are correct or inaccurate without any diagnostic results.

After CVX exits, cvx_status contains the status of the just completed optimzation.

1 Like