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

612 APPENDIX F. MOSEK FILE FORMATS • iparam.opf write sol itg, include integer solution, if defined. • iparam.opf write sol itr, include interior solution, if defined. • iparam.opf write parameters, include all parameter settings. F.3.5 Examples This section contains a set of small examples written in OPF and describing how to formulate linear, quadratic and conic problems. F.3.5.1 Linear example lo1.opf Consider the example: having the bounds maximize 3x 0 + 1x 1 + 5x 2 + 1x 3 subject to 3x 0 + 1x 1 + 2x 2 = 30, 2x 0 + 1x 1 + 3x 2 + 1x 3 ≥ 15, 2x 1 + 3x 3 ≤ 25, 0 ≤ x 0 ≤ ∞, 0 ≤ x 1 ≤ 10, 0 ≤ x 2 ≤ ∞, 0 ≤ x 3 ≤ ∞. In the OPF format the example is displayed as shown below: [comment] The lo1 example in OPF format [/comment] [hints] [hint NUMVAR] 4 [/hint] [hint NUMCON] 3 [/hint] [hint NUMANZ] 9 [/hint] [/hints] [variables disallow new variables] x1 x2 x3 x4 [/variables] [objective maximize ’obj’] 3 x1 + x2 + 5 x3 + x4 [/objective] [constraints] [con ’c1’] 3 x1 + x2 + 2 x3 = 30 [/con] [con ’c2’] 2 x1 + x2 + 3 x3 + x4 >= 15 [/con] [con ’c3’] 2 x2 + 3 x4

F.3. THE OPF FORMAT 613 [bounds] [b] 0

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

• iparam.opf write sol itg, include integer solution, if defined.<br />

• iparam.opf write sol itr, include interior solution, if defined.<br />

• iparam.opf write parameters, include all parameter settings.<br />

F.3.5<br />

Examples<br />

This section contains a set of small examples written in OPF and describing how to formulate linear,<br />

quadratic and conic problems.<br />

F.3.5.1<br />

Linear example lo1.opf<br />

Consider the example:<br />

having the bounds<br />

maximize 3x 0 + 1x 1 + 5x 2 + 1x 3<br />

subject to 3x 0 + 1x 1 + 2x 2 = 30,<br />

2x 0 + 1x 1 + 3x 2 + 1x 3 ≥ 15,<br />

2x 1 + 3x 3 ≤ 25,<br />

0 ≤ x 0 ≤ ∞,<br />

0 ≤ x 1 ≤ 10,<br />

0 ≤ x 2 ≤ ∞,<br />

0 ≤ x 3 ≤ ∞.<br />

In the OPF format the example is displayed as shown below:<br />

[comment]<br />

<strong>The</strong> lo1 example in OPF format<br />

[/comment]<br />

[hints]<br />

[hint NUMVAR] 4 [/hint]<br />

[hint NUMCON] 3 [/hint]<br />

[hint NUMANZ] 9 [/hint]<br />

[/hints]<br />

[variables disallow new variables]<br />

x1 x2 x3 x4<br />

[/variables]<br />

[objective maximize ’obj’]<br />

3 x1 + x2 + 5 x3 + x4<br />

[/objective]<br />

[constraints]<br />

[con ’c1’] 3 x1 + x2 + 2 x3 = 30 [/con]<br />

[con ’c2’] 2 x1 + x2 + 3 x3 + x4 >= 15 [/con]<br />

[con ’c3’] 2 x2 + 3 x4

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

Saved successfully!

Ooh no, something went wrong!