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.

38 CHAPTER 5. BASIC <strong>API</strong> TUTORIAL<br />

114 print("Primal or dual infeasibility.\n")<br />

115 elif solsta == mosek.solsta.near dual infeas cer:<br />

116 print("Primal or dual infeasibility.\n")<br />

117 elif solsta == mosek.solsta.near prim infeas cer:<br />

118 print("Primal or dual infeasibility.\n")<br />

119 elif mosek.solsta.unknown:<br />

120 print("Unknown solution status")<br />

121 else:<br />

122 print("Other solution status")<br />

123<br />

124<br />

125 # call the main function<br />

126 try:<br />

127 main ()<br />

128 except mosek.Exception as e:<br />

129 print ("ERROR: %s" % str(e.code))<br />

130 if msg is not None:<br />

131 print ("\t%s" % e.msg)<br />

132 sys.exit(1)<br />

133 except:<br />

134 import traceback<br />

135 traceback.print exc()<br />

136 sys.exit(1)<br />

137 sys.exit(0)<br />

5.3.1.2 Source code comments<br />

<strong>The</strong> only new function introduced in the example is Task.appendcone, which is called here:<br />

86 task.appendcone(mosek.conetype.quad,<br />

87 0.0,<br />

88 [ 3, 0, 1 ])<br />

[ cqo1.py ]<br />

<strong>The</strong> first argument selects the type of quadratic cone. Either conetype.quad for a quadratic cone<br />

or conetype.rquad for a rotated quadratic cone. <strong>The</strong> cone parameter 0.0 is currently not used by<br />

<strong>MOSEK</strong> — simply passing 0.0 will work.<br />

<strong>The</strong> last argument is a list of indexes of the variables in the cone.<br />

5.4 Semidefinite optimization<br />

Semidefinite optimization is a generalization of conic quadratic optimization, allowing the use of matrix<br />

variables belonging to the convex cone of positive semidefinite matrices<br />

S + r = { X ∈ S r : z T Xz ≥ 0, ∀z ∈ R r} ,<br />

where S r is the set of r×r real-valued symmetric matrices.<br />

<strong>MOSEK</strong> can solve semidefinite optimization problems of the form

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

Saved successfully!

Ooh no, something went wrong!