Functions for writing optimization problems to a file.
- picos.modeling.file_out.write(picos_problem, filename, writer='picos')[source]¶
Write an optimization problem to a file.
P (Problem) – The problem to write.
filename (str) –
Path and name of the output file. The export format is inferred from the file extension. Supported extensions and their associated format are:
'.cbf'– Conic Benchmark Format.
This format is suitable for optimization problems involving second order and/or semidefinite cone constraints. This is a standard choice for conic optimization problems. Visit the website of The Conic Benchmark Library or read A benchmark library for conic mixed-integer and continuous optimization by Henrik A. Friberg for more information.
'.lp'– LP format.
This format handles only linear constraints, unless the writer
'cplex'is used. In the latter case the extended CPLEX LP format is used instead.
'.mps'– MPS format.
As the writer, you need to choose one of
'.opf'– OPF format.
As the writer, you need to choose
'.dat-s'– Sparse SDPA format.
This format is suitable for semidefinite programs. Second order cone constraints are stored as semidefinite constraints on an arrow shaped matrix.
writer (str) – The default
'picos'denotes PICOS’ internal writer, which can export to LP, CBF, and Sparse SDPA formats. If CPLEX, Gurobi or MOSEK is installed, you can choose
'mosek', respectively, to make use of that solver’s export function and get access to more formats.
For problems involving a symmetric matrix variable (typically, semidefinite programs), the expressions involving are stored in PICOS as a function of , the symmetric vectorized form of (see Dattorro, ch.18.104.22.168), and are also exported in that form. As a result, using an external solver on a problem description file exported by PICOS will also yield a solution in this symmetric vectorized form.
The CBF writer tries to write symmetric variables in the section
PSDVARof the .cbf file. However, this is possible only if the constraint appears in the problem, and no other LMI involves . If these two conditions are not satisfied, then the symmetric vectorization of is used as a (free) variable of the section
VARin the .cbf file, as explained in the previous paragraph.
This function is severly outdated and may fail or not function as advertised.
A number deemed too large to appear in practice.
- Default value