Saving & and loadingThe most efficient and safe way to save and communicate YALMIP models is to work with the MATLAB script, i.e. the YALMIP code. In some cases however, it might be necessary to use binary or other formats. Additionally, there might be cases where a YALMIP model needs to be converted to a solver specific numerical model. Loading & saving in binary MATLAB formatThe objects in YALMIP all support loading and saving, hence it is possible to save a model in a binary MATLAB format.
Note that loading a YALMIP model will destroy any sdpvar and set object in the current workspace. The binary data format is not recommended, and the reason is three-fold. The first reason is incompatibility between different MATLAB version, the second reason is possible incompatibility between different YALMIP versions, and finally that the binary format in YALMIP currently is inefficient for large-scale problems. Loading & saving in SDPA sparse ASCII formatThe leading format to communicate standard linear SDP problems in a platform and application independent way is the sparse SDPA format. YALMIP can both save and load models in this format.
The SDPA format is limited to standard linear SDP problems (without equality constraints), hence many YALMIP models cannot be saved in this format. Exporting solver specific modelsYALMIP can be used to extract the numerical model in various solver
specific formats. This can be done along during a call to the solver,
but also without explicitly invoking the solver. To export the solver
while solving the problem, we use the
To export the model with actually calling the solver, use export.
All solvers are currently not supported in export. If you miss support for some solver, please make a feature request. Saving AMPL
modelsA
rudimentary support for exporting models in
AMPL format is
available. This functionality is mainly intended for small nonlinear or
mixed integer programs, and was only implemented in order to save one
particular problem. If you are interested in a better support, make a
feature request. |
sdpvar a b c F = set(a+b^2 < c*pi) + set(integer(b)) + set(a+b==3); obj = a*b*c; saveampl(F,obj,'mymodel.mod') type mymodel var x {1..2}; var z {1..1} integer ; minimize obj: x[1]*z[1]*x[2]; subject to constr1: 0 <= -x[1]+x[2]-z[1]^2; subject to constr2: 0 == 3-x[1]-z[1]; solve; display x; display z; display obj; |