25.11.2015 Views

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

Optimizer API for Python - Documentation - Mosek

Optimizer API for Python - Documentation - Mosek

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8.1. PORTFOLIO OPTIMIZATION 117<br />

172 stddev = zeros(1,float)<br />

173 task.getxxslice(mosek.soltype.itr,offsets+0,offsets+1,stddev)<br />

174<br />

175 print("\nExpected return %e for gamma %e\n" % (expret,stddev[0]))<br />

<strong>The</strong> example code above produces the result<br />

Interior-point solution summary<br />

Problem status : PRIMAL AND DUAL FEASIBLE<br />

Solution status : OPTIMAL<br />

Primal. obj: 7.4390660228e-002 Viol. con: 2e-007 var: 0e+000 cones: 1e-009<br />

Dual. obj: 7.4390669047e-002 Viol. con: 1e-008 var: 1e-008 cones: 0e+000<br />

Expected return 7.439066e-02 for gamma 5.000000e-02<br />

If the problem is dumped to an OPF formatted file, then it has the following content.<br />

[comment]<br />

Written by <strong>MOSEK</strong> version <strong>7.0</strong>.0.86<br />

Date 01-10-13<br />

Time 07:47:34<br />

[/comment]<br />

[hints]<br />

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

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

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

[hint NUMQNZ] 0 [/hint]<br />

[hint NUMCONE] 7 [/hint]<br />

[/hints]<br />

[variables disallow new variables]<br />

’x[1]’ ’x[2]’ ’x[3]’ s ’t[1]’<br />

’t[2]’ ’t[3]’ ’c[1]’ ’c[2]’ ’c[3]’<br />

’v[1]’ ’v[2]’ ’v[3]’ ’z[1]’ ’z[2]’<br />

’z[3]’ ’f[1,1]’ ’f[1,2]’ ’f[1,3]’ ’f[2,1]’<br />

’f[2,2]’ ’f[2,3]’ ’f[3,1]’ ’f[3,2]’ ’f[3,3]’<br />

’g[1,1]’ ’g[1,2]’ ’g[1,3]’ ’g[2,1]’ ’g[2,2]’<br />

’g[2,3]’ ’g[3,1]’ ’g[3,2]’ ’g[3,3]’<br />

[/variables]<br />

[objective maximize]<br />

1.073e-001 ’x[1]’ + 7.37e-002 ’x[2]’ + 6.270000000000001e-002 ’x[3]’<br />

[/objective]<br />

[constraints]<br />

[con ’budget’] ’x[1]’ + ’x[2]’ + ’x[3]’ + 1e-002 ’c[1]’ + 1e-002 ’c[2]’<br />

+ 1e-002 ’c[3]’ = 1e+000 [/con]<br />

[con ’GT[1]’] 1.667e-001 ’x[1]’ + 2.32e-002 ’x[2]’ + 1.3e-003 ’x[3]’ - ’t[1]’ = 0e+000 [/con]<br />

[con ’GT[2]’] 1.033e-001 ’x[2]’ - 2.2e-003 ’x[3]’ - ’t[2]’ = 0e+000 [/con]<br />

[con ’GT[3]’] 3.38e-002 ’x[3]’ - ’t[3]’ = 0e+000 [/con]<br />

[con ’zabs1[1]’] 0e+000

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

Saved successfully!

Ooh no, something went wrong!