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

604 APPENDIX F. MOSEK FILE FORMATS F.2.2.4 MOSEK specific extensions to the LP format Some optimization software packages employ a more strict definition of the LP format that the one used by MOSEK. The limitations imposed by the strict LP format are the following: • Quadratic terms in the constraints are not allowed. • Names can be only 16 characters long. • Lines must not exceed 255 characters in length. If an LP formatted file created by MOSEK should satisfies the strict definition, then the parameter iparam.write lp strict format should be set; note, however, that some problems cannot be written correctly as a strict LP formatted file. For instance, all names are truncated to 16 characters and hence they may loose their uniqueness and change the problem. To get around some of the inconveniences converting from other problem formats, MOSEK allows lines to contain 1024 characters and names may have any length (shorter than the 1024 characters). Internally in MOSEK names may contain any (printable) character, many of which cannot be used in LP names. Setting the parameters iparam.read lp quoted names and iparam.write lp quoted names allows MOSEK to use quoted names. The first parameter tells MOSEK to remove quotes from quoted names e.g, "x1", when reading LP formatted files. The second parameter tells MOSEK to put quotes around any semi-illegal name (names beginning with a number or a period) and fully illegal name (containing illegal characters). As double quote is a legal character in the LP format, quoting semiillegal names makes them legal in the pure LP format as long as they are still shorter than 16 characters. Fully illegal names are still illegal in a pure LP file. F.2.3 The strict LP format The LP format is not a formal standard and different vendors have slightly different interpretations of the LP format. To make MOSEK’s definition of the LP format more compatible with the definitions of other vendors, use the parameter setting iparam.write lp strict format = onoffkey.on This setting may lead to truncation of some names and hence to an invalid LP file. The simple solution to this problem is to use the parameter setting

F.3. THE OPF FORMAT 605 iparam.write generic names = onoffkey.on which will cause all names to be renamed systematically in the output file. F.2.4 Formatting of an LP file A few parameters control the visual formatting of LP files written by MOSEK in order to make it easier to read the files. These parameters are iparam.write lp line width iparam.write lp terms per line The first parameter sets the maximum number of characters on a single line. The default value is 80 corresponding roughly to the width of a standard text document. The second parameter sets the maximum number of terms per line; a term means a sign, a coefficient, and a name (for example ”+ 42 elephants”). The default value is 0, meaning that there is no maximum. F.2.4.1 Speeding up file reading If the input file should be read as fast as possible using the least amount of memory, then it is important to tell MOSEK how many non-zeros, variables and constraints the problem contains. These values can be set using the parameters iparam.read con iparam.read var iparam.read anz iparam.read qnz F.2.4.2 Unnamed constraints Reading and writing an LP file with MOSEK may change it superficially. If an LP file contains unnamed constraints or objective these are given their generic names when the file is read (however unnamed constraints in MOSEK are written without names). F.3 The OPF format The Optimization Problem Format (OPF) is an alternative to LP and MPS files for specifying optimization problems. It is row-oriented, inspired by the CPLEX LP format.

604 APPENDIX F. <strong>MOSEK</strong> FILE FORMATS<br />

F.2.2.4<br />

<strong>MOSEK</strong> specific extensions to the LP format<br />

Some optimization software packages employ a more strict definition of the LP format that the one<br />

used by <strong>MOSEK</strong>. <strong>The</strong> limitations imposed by the strict LP format are the following:<br />

• Quadratic terms in the constraints are not allowed.<br />

• Names can be only 16 characters long.<br />

• Lines must not exceed 255 characters in length.<br />

If an LP formatted file created by <strong>MOSEK</strong> should satisfies the strict definition, then the parameter<br />

iparam.write lp strict format<br />

should be set; note, however, that some problems cannot be written correctly as a strict LP formatted<br />

file. For instance, all names are truncated to 16 characters and hence they may loose their uniqueness<br />

and change the problem.<br />

To get around some of the inconveniences converting from other problem formats, <strong>MOSEK</strong> allows lines<br />

to contain 1024 characters and names may have any length (shorter than the 1024 characters).<br />

Internally in <strong>MOSEK</strong> names may contain any (printable) character, many of which cannot be used in<br />

LP names. Setting the parameters<br />

iparam.read lp quoted names<br />

and<br />

iparam.write lp quoted names<br />

allows <strong>MOSEK</strong> to use quoted names. <strong>The</strong> first parameter tells <strong>MOSEK</strong> to remove quotes from quoted<br />

names e.g, "x1", when reading LP formatted files. <strong>The</strong> second parameter tells <strong>MOSEK</strong> to put quotes<br />

around any semi-illegal name (names beginning with a number or a period) and fully illegal name<br />

(containing illegal characters). As double quote is a legal character in the LP format, quoting semiillegal<br />

names makes them legal in the pure LP format as long as they are still shorter than 16 characters.<br />

Fully illegal names are still illegal in a pure LP file.<br />

F.2.3<br />

<strong>The</strong> strict LP format<br />

<strong>The</strong> LP format is not a formal standard and different vendors have slightly different interpretations of<br />

the LP format. To make <strong>MOSEK</strong>’s definition of the LP format more compatible with the definitions<br />

of other vendors, use the parameter setting<br />

iparam.write lp strict format = onoffkey.on<br />

This setting may lead to truncation of some names and hence to an invalid LP file. <strong>The</strong> simple solution<br />

to this problem is to use the parameter setting

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

Saved successfully!

Ooh no, something went wrong!