The MOSEK Python optimizer API manual Version 7.0 (Revision 141)

Optimizer API for Python - Documentation - Mosek Optimizer API for Python - Documentation - Mosek

25.11.2015 Views

606 APPENDIX F. MOSEK FILE FORMATS Apart from containing objective, constraints, bounds etc. it may contain complete or partial solutions, comments and extra information relevant for solving the problem. It is designed to be easily read and modified by hand and to be forward compatible with possible future extensions. F.3.1 Intended use The OPF file format is meant to replace several other files: • The LP file format. Any problem that can be written as an LP file can be written as an OPF file to; furthermore it naturally accommodates ranged constraints and variables as well as arbitrary characters in names, fixed expressions in the objective, empty constraints, and conic constraints. • Parameter files. It is possible to specify integer, double and string parameters along with the problem (or in a separate OPF file). • Solution files. It is possible to store a full or a partial solution in an OPF file and later reload it. F.3.2 The file format The format uses tags to structure data. A simple example with the basic sections may look like this: [comment] This is a comment. You may write almost anything here... [/comment] # This is a single-line comment. [objective min ’myobj’] x + 3 y + x^2 + 3 y^2 + z + 1 [/objective] [constraints] [con ’con01’] 4

F.3. THE OPF FORMAT 607 [tag "value"] double-quoted value [/tag] [tag arg="value"] double-quoted value [/tag] F.3.2.1 Sections The recognized tags are • [comment] A comment section. This can contain almost any text: Between single quotes (’) or double quotes (") any text may appear. Outside quotes the markup characters ([ and ]) must be prefixed by backslashes. Both single and double quotes may appear alone or inside a pair of quotes if it is prefixed by a backslash. • [objective] The objective function: This accepts one or two parameters, where the first one (in the above example ‘min’) is either min or max (regardless of case) and defines the objective sense, and the second one (above ‘myobj’), if present, is the objective name. The section may contain linear and quadratic expressions. If several objectives are specified, all but the last are ignored. • [constraints] This does not directly contain any data, but may contain the subsection ‘con’ defining a linear constraint. [con] defines a single constraint; if an argument is present ([con NAME]) this is used as the name of the constraint, otherwise it is given a null-name. The section contains a constraint definition written as linear and quadratic expressions with a lower bound, an upper bound, with both or with an equality. Examples: [constraints] [con ’con1’] 0 = x + y [/con] [con ’con3’] 0

F.3. THE OPF FORMAT 607<br />

[tag "value"] double-quoted value [/tag]<br />

[tag arg="value"] double-quoted value [/tag]<br />

F.3.2.1<br />

Sections<br />

<strong>The</strong> recognized tags are<br />

• [comment] A comment section. This can contain almost any text: Between single quotes (’) or<br />

double quotes (") any text may appear. Outside quotes the markup characters ([ and ]) must<br />

be prefixed by backslashes. Both single and double quotes may appear alone or inside a pair of<br />

quotes if it is prefixed by a backslash.<br />

• [objective] <strong>The</strong> objective function: This accepts one or two parameters, where the first one<br />

(in the above example ‘min’) is either min or max (regardless of case) and defines the objective<br />

sense, and the second one (above ‘myobj’), if present, is the objective name. <strong>The</strong> section may<br />

contain linear and quadratic expressions.<br />

If several objectives are specified, all but the last are ignored.<br />

• [constraints] This does not directly contain any data, but may contain the subsection ‘con’<br />

defining a linear constraint.<br />

[con] defines a single constraint; if an argument is present ([con NAME]) this is used as the name<br />

of the constraint, otherwise it is given a null-name. <strong>The</strong> section contains a constraint definition<br />

written as linear and quadratic expressions with a lower bound, an upper bound, with both or<br />

with an equality. Examples:<br />

[constraints]<br />

[con ’con1’] 0 = x + y [/con]<br />

[con ’con3’] 0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!