How to store the CVX resulting status and use some information in the following iteration?

(Christ) #1

Dear Sir:
We are running a loop, where CVX tool is utilized. We would like to get capture the printed CVX status and use some value somewhere,
like
" Status: Solved
Optimal value (cvx_optval): -101.319".

Is it possible to capture them? If yes, Could U plz give us some guide on how to realize it. Thanks a lot.

=====================================
=====================================
Using Pade approximation for exponential
cone with parameters m=3, k=3
=====================================
 
Calling Mosek 8.0.0.60: 240 variables, 92 equality constraints
   For improved efficiency, Mosek is solving the dual problem.
------------------------------------------------------------

MOSEK Version 8.0.0.60 (Build date: 2017-3-1 13:09:33)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 92              
  Cones                  : 71              
  Scalar variables       : 240             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 4
Eliminator terminated.
Eliminator - tries                  : 1                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.00    
Optimizer  - threads                : 8               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 62
Optimizer  - Cones                  : 71
Optimizer  - Scalar variables       : 221               conic                  : 213             
Optimizer  - Semi-definite variables: 0                 scalarized             : 0               
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 153               after factor           : 158             
Factor     - dense dim.             : 0                 flops                  : 1.71e+003       
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.5e+000 2.6e+005 9.6e+003 0.00e+000  1.569651310e+008  8.534005441e+001  1.0e+000 0.00  
1   2.7e-001 4.6e+004 7.3e+002 -1.00e+000 1.568177797e+008  -6.940903515e+004 1.8e-001 0.01  
2   5.2e-002 9.0e+003 6.3e+001 -1.00e+000 1.560237185e+008  -4.644160285e+005 3.5e-002 0.03  
3   1.8e-002 3.1e+003 1.3e+001 -9.99e-001 1.540432441e+008  -1.447998177e+006 1.2e-002 0.03  
4   4.2e-003 7.2e+002 1.4e+000 -9.98e-001 1.439720305e+008  -6.445475304e+006 2.8e-003 0.03  
5   1.0e-003 1.7e+002 1.7e-001 -9.87e-001 1.028977444e+008  -2.652551445e+007 6.8e-004 0.03  
6   2.7e-004 4.6e+001 2.5e-002 -9.37e-001 -2.857286224e+007 -9.216751483e+007 1.8e-004 0.03  
7   6.6e-005 1.1e+001 3.9e-003 -7.82e-001 -3.426440470e+008 -2.549338086e+008 4.4e-005 0.03  
8   2.3e-005 4.0e+000 1.6e-003 -2.86e-001 -3.623419892e+008 -2.731969251e+008 1.6e-005 0.03  
9   9.9e-006 1.7e+000 2.5e-003 1.01e+000  -6.679227341e+007 -7.417900365e+007 6.6e-006 0.03  
10  5.2e-006 8.9e-001 2.6e-003 2.84e+000  -8.609676269e+006 -1.026661329e+007 3.5e-006 0.03  
11  1.5e-006 2.5e-001 1.8e-003 2.04e+000  -1.077265383e+006 -1.373316600e+006 9.7e-007 0.03  
12  2.7e-007 4.7e-002 9.0e-004 1.45e+000  -1.608665026e+005 -2.128541414e+005 1.8e-007 0.03  
13  7.5e-008 1.3e-002 5.3e-004 1.23e+000  -5.157576676e+004 -6.624323521e+004 5.0e-008 0.03  
14  2.0e-008 3.4e-003 2.8e-004 1.07e+000  -1.143360321e+004 -1.529972295e+004 1.3e-008 0.03  
15  5.2e-009 8.9e-004 1.5e-004 1.02e+000  -3.979773581e+003 -5.058905945e+003 3.5e-009 0.05  
Interior-point optimizer terminated. Time: 0.06. 

Optimizer terminated. Time: 0.08    

Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: -2.2719457649e+001  nrm: 2e+003   Viol.  con: 5e-007   var: 7e-007   cones: 0e+000 
  Dual.    obj: -2.2719596334e+001  nrm: 1e+006   Viol.  con: 0e+000   var: 2e-006   cones: 0e+000 
Optimizer summary
  Optimizer                 -                        time: 0.08    
    Interior-point          - iterations : 28        time: 0.06    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    

------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -101.319
(Mark L. Stone) #2

After CVX completes execution:

cvx_optval has the optimal objective value.

cvx_status has a text string of status. See http://cvxr.com/cvx/doc/solver.html#interpreting-the-results for the values and meaning.

1 Like
(Christ) #3

Dear Sir:
Is it possible to store the resulting status of each step, but not only after the computation ends. We also hope to get some mid-computation results.
Best

(Mark L. Stone) #4

You can not get the intermediate solver results, except by capturing the screen output using the MATLAB diary command.

If by step you mean solver iteration, then see the above paragraph,. If you wish to capture cvx_status or cvx_optval for each of several invocations of CVX, you can store these however you want in MATLAB prior to the next CVX invocation.

In general, you can not get mid computation results. CVX makes various transformations to the problem before it is provided to the solver, and even if you knew how to reverse these, which you won’t, the reverse transformations are generally not meaningful when applied to the solver results prior to convergence to an optimum.

1 Like