export

export is used to export YALMIP models to various numerical solver formats.

Syntax

 [model,recoverymodel,diagnostic,internalmodel] = export(F,h,ops)

Examples

Consider a Lyapunov stability problem

A = randn(5,5);A = -A*A';
P = sdpvar(5,5);
F = [A'*P+P*A <= 0, P >= eye(5)];
obj = trace(P);

Exporting this to a model in sedumi format is done by specifying the solver and calling export in the same way as optimize would have ben called.

[model,recoverymodel] = export(F,obj,sdpsettings('solver','sedumi'));
model =
       A: [50x15 double]
       b: [15x1 double]
       C: [50x1 double]
       K: [1x1 struct]
    pars: [1x1 struct]

The data in recoverymodel can be used to relate a solution obtained from using the exported model, to the actual variables in YALMIP.

[x,y] = sedumi(model.A,model.b,model.C,model.K);
assign(recover(recoverymodel.used_variables),y);

Some solvers do not support equality constraints. One way to handle this in YALMIP is to use sdpsettings('remove',1). If this is done, YALMIP derives a basis and solves the problem in the reduced variables. This basis is communicated through the structure recoverymodel.

ops = sdpsettings('solver','sedumi','remove',1);
[model,recoverymodel] = export([F, trace(P)==10],obj,ops);
[x,y] = sedumi(model.A,model.b,model.C,model.K);
z = recoverymodel.x_equ + recoverymodel.H*y;
assign(recover(recoverymodel.used_variables),z);

If the compilation of the numerical model fails for some reason, then this will be reported in the third output diagnostic.

The general internal numerical solver-agnostic model that YALMIP compiles is returned in the fourth output internalmodel

Leave a Comment