Debugging unknown error

YALMIP adds a try-catch layer on all solver calls which hides complete failures in solvers. In some cases, we might want to to remove this layer.

Debug flag

If a solver crashes (or YALMIP crashes internally before a solver call) the error code 9 will be issued in the diagnostic output. In most cases the cause wll be shown in the diagnostic output, but in severe cases this can fail.

To remove the try-catch failure, simply turn on the ‘‘debug’’ flag in the options. Here we test a setup which generates a (predictable) crash in CPLEX.

In this case, it is not problematic as YALMIP manages to recover the crash message which could be all that is needed to find out the issue.

x = intvar(100,1);A=randn(100,1)
optimize(randn(100)*x <=1,[],sdpsettings('solver','cplex','cplex.benders.strategy',1))
Matlab Toolbox parameter "Display" found.
Version identifier: | 2019-11-26 | 843d4de2ae
CPXPARAM_Benders_Strategy                        1
CPXPARAM_MIP_Display                             1

ans = 

  struct with fields:

    yalmipversion: '20210331'
    matlabversion: ' (R2020b) Update 2'
       yalmiptime: NaN
       solvertime: NaN
             info: 'Unknown problem (debug) (Error using cplexmilp↵CPLEX Error  2000: No Benders decomposition available.↵)'
          problem: 9

If we want to see the crash more clearly we turn on debug

optimize(A*x <=1,[],sdpsettings('solver','cplex','cplex.benders.strategy',1,'debug',1))

Error using cplexmilp
CPLEX Error  2000: No Benders decomposition

Error in call_cplexibm_miqp>localSolverCall
(line 159)
            [x,fval,exitflag,output] =

Error in call_cplexibm_miqp (line 32)
[x,fval,exitflag,output,lambda] =