The MOSEK Python optimizer API manual Version 7.0 (Revision 141)
Optimizer API for Python - Documentation - Mosek Optimizer API for Python - Documentation - Mosek
112 CHAPTER 8. A CASE STUDY c j ≥ z p/q j where p and q are both integers and p ≥ q can be modelled using quadratic cones. See [7] for details. One more reformulation of (8.13) is needed, maximize µ T x subject to e T x + m T c = w + e T x 0 , G T x − t = 0, z j − x j ≥ − x 0 j, j = 1, . . . , n, z j + x j ≥ x 0 j, j = 1, . . . , n, [v j ; c j ; z j ] − f j,1:3 = 0, j = 1, . . . , n, [z j ; 0; v j ] − g j,1:3 = [0; −1/8; 0], j = 1, . . . , n, [s; t] ∈ Q n+1 , fj,1:3 T ∈ Q 3 r, j = 1, . . . , n, gj,1:3 T ∈ Q 3 r, j = 1, . . . , n, x ≥ 0, s = γ, (8.14) where f, g ∈ R n×3 . These additional variables f and g are only introduced to bring the problem on the API standard form. The formulation (8.14) is not the most compact possible. However, the MOSEK presolve will automatically make it more compact and since it is easier to implement (8.14) than a more compact form then the form (8.14) is preferred. The first step in developing the optimizer API implementation is to chose an ordering of the variables. In this case the ordering ⎡ ˆx = ⎢ ⎣ x s t c v z f T (:) g T (:) will be used. Note f T (:) means the rows of f are transposed and stacked on top of each other to form a long column vector. The Table 8.2 shows the mapping between the ˆx and the model variables. ⎤ ⎥ ⎦ The next step is to consider how the columns of A is defined. Reusing the idea in Section 8.1.2 then the following pseudo code describes the setup of A.
8.1. PORTFOLIO OPTIMIZATION 113 Variable Length Offset x n 1 s 1 n+1 t n n+2 c n 2n+2 v n 3n+2 z n 4n+2 f(:) T 3n 7n+2 g(:) T 3n 10n+2 Figure 8.2: Storage layout for the ˆx for j = 1 : n ˆx j = x j A 1,j = 1.0 A 2:n+1,j = G T j,1:n A n+1+j,j = −1.0 A 2n+1+j,j = 1.0 ˆx n+1 = s for for for for for for j = 1 : n ˆx n+1+j = t j A 1+j,n+1+j = −1.0 j = 1 : n ˆx 2n+1+j = c j A 1,2n+1+j = m j A 3n+1+3(j−1)+2,2n+1+j = 1.0 j = 1 : n ˆx 3n+1+j = v j A 3n+1+3(j−1)+1,3n+1+j = 1.0 A 6n+1+3(j−1)+3,3n+1+j = 1.0 j = 1 : n ˆx 4n+1+j = z j A 1+n+j,4n+1+j = 1.0 A 1+2n+j,4n+1+j = 1.0 A 3n+1+3(j−1)+3,4n+1+j = 1.0 A 6n+1+3(j−1)+1,4n+1+j = 1.0 j = 1 : n ˆx 7n+1+3(j−1)+1 = f j,1 A 3n+1+3(j−1)+1,7n+(3(j−1)+1 = −1.0 ˆx 7n+1+3(j−1)+2 = f j,2 A 3n+1+3(j−1)+2,7n+(3(j−1)+2 = −1.0 ˆx 7n+1+3(j−1)+3 = f j,3 A 3n+1+3(j−1)+3,7n+(3(j−1)+3 = −1.0 j = 1 : n ˆx 10n+1+3(j−1)+1 = g j,1 A 6n+1+3(j−1)+1,7n+(3(j−1)+1 = −1.0 ˆx 10n+1+3(j−1)+2 = g j,2 A 6n+1+3(j−1)+2,7n+(3(j−1)+2 = −1.0 ˆx 10n+1+3(j−1)+3 = g j,3 A 6n+1+3(j−1)+3,7n+(3(j−1)+3 = −1.0
- Page 83 and 84: 5.9. RESPONSE HANDLING 61 Note that
- Page 85 and 86: 5.10. PROBLEM MODIFICATION AND REOP
- Page 87 and 88: 5.10. PROBLEM MODIFICATION AND REOP
- Page 89 and 90: 5.11. SOLUTION ANALYSIS 67 151 # Pu
- Page 91 and 92: 5.13. CONVENTIONS EMPLOYED IN THE A
- Page 93 and 94: 5.13. CONVENTIONS EMPLOYED IN THE A
- Page 95 and 96: 5.13. CONVENTIONS EMPLOYED IN THE A
- Page 97 and 98: 5.13. CONVENTIONS EMPLOYED IN THE A
- Page 99 and 100: Chapter 6 Nonlinear API tutorial Th
- Page 101 and 102: 6.1. SEPARABLE CONVEX (SCOPT) INTER
- Page 103 and 104: 6.1. SEPARABLE CONVEX (SCOPT) INTER
- Page 105 and 106: 6.1. SEPARABLE CONVEX (SCOPT) INTER
- Page 107 and 108: Chapter 7 Advanced API tutorial Thi
- Page 109 and 110: 7.1. THE PROGRESS CALL-BACK 87 71 p
- Page 111 and 112: 7.2. SOLVING LINEAR SYSTEMS INVOLVI
- Page 113 and 114: 7.2. SOLVING LINEAR SYSTEMS INVOLVI
- Page 115 and 116: 7.2. SOLVING LINEAR SYSTEMS INVOLVI
- Page 117 and 118: 7.2. SOLVING LINEAR SYSTEMS INVOLVI
- Page 119 and 120: Chapter 8 A case study 8.1 Portfoli
- Page 121 and 122: 8.1. PORTFOLIO OPTIMIZATION 99 e T
- Page 123 and 124: 8.1. PORTFOLIO OPTIMIZATION 101 is
- Page 125 and 126: 8.1. PORTFOLIO OPTIMIZATION 103 15
- Page 127 and 128: 8.1. PORTFOLIO OPTIMIZATION 105 63
- Page 129 and 130: 8.1. PORTFOLIO OPTIMIZATION 107 8.1
- Page 131 and 132: 8.1. PORTFOLIO OPTIMIZATION 109 110
- Page 133: 8.1. PORTFOLIO OPTIMIZATION 111 z j
- Page 137 and 138: 8.1. PORTFOLIO OPTIMIZATION 115 56
- Page 139 and 140: 8.1. PORTFOLIO OPTIMIZATION 117 172
- Page 141 and 142: Chapter 9 Usage guidelines The purp
- Page 143 and 144: 9.3. WRITING TASK DATA TO A FILE 12
- Page 145 and 146: Chapter 10 Problem formulation and
- Page 147 and 148: 10.1. LINEAR OPTIMIZATION 125 be a
- Page 149 and 150: 10.2. CONIC QUADRATIC OPTIMIZATION
- Page 151 and 152: 10.2. CONIC QUADRATIC OPTIMIZATION
- Page 153 and 154: 10.3. SEMIDEFINITE OPTIMIZATION 131
- Page 155 and 156: 10.4. QUADRATIC AND QUADRATICALLY C
- Page 157 and 158: Chapter 11 The optimizers for conti
- Page 159 and 160: 11.1. HOW AN OPTIMIZER WORKS 137 11
- Page 161 and 162: 11.2. LINEAR OPTIMIZATION 139 11.2.
- Page 163 and 164: 11.2. LINEAR OPTIMIZATION 141 Whene
- Page 165 and 166: 11.2. LINEAR OPTIMIZATION 143 11.2.
- Page 167 and 168: 11.2. LINEAR OPTIMIZATION 145 • R
- Page 169 and 170: 11.5. NONLINEAR CONVEX OPTIMIZATION
- Page 171 and 172: 11.6. SOLVING PROBLEMS IN PARALLEL
- Page 173 and 174: 11.6. SOLVING PROBLEMS IN PARALLEL
- Page 175 and 176: 11.6. SOLVING PROBLEMS IN PARALLEL
- Page 177 and 178: Chapter 12 The optimizers for mixed
- Page 179 and 180: 12.3. THE MIXED-INTEGER CONIC OPTIM
- Page 181 and 182: 12.5. TERMINATION CRITERION 159 •
- Page 183 and 184: 12.7. UNDERSTANDING SOLUTION QUALIT
112 CHAPTER 8. A CASE STUDY<br />
c j ≥ z p/q<br />
j<br />
where p and q are both integers and p ≥ q can be modelled using quadratic cones. See [7] for details.<br />
One more reformulation of (8.13) is needed,<br />
maximize µ T x<br />
subject to e T x + m T c = w + e T x 0 ,<br />
G T x − t = 0,<br />
z j − x j ≥ − x 0 j, j = 1, . . . , n,<br />
z j + x j ≥ x 0 j, j = 1, . . . , n,<br />
[v j ; c j ; z j ] − f j,1:3 = 0, j = 1, . . . , n,<br />
[z j ; 0; v j ] − g j,1:3 = [0; −1/8; 0], j = 1, . . . , n,<br />
[s; t] ∈ Q n+1 ,<br />
fj,1:3 T ∈ Q 3 r, j = 1, . . . , n,<br />
gj,1:3 T ∈ Q 3 r, j = 1, . . . , n,<br />
x ≥ 0,<br />
s = γ,<br />
(8.14)<br />
where f, g ∈ R n×3 . <strong>The</strong>se additional variables f and g are only introduced to bring the problem on<br />
the <strong>API</strong> standard form.<br />
<strong>The</strong> formulation (8.14) is not the most compact possible. However, the <strong>MOSEK</strong> presolve will automatically<br />
make it more compact and since it is easier to implement (8.14) than a more compact form<br />
then the form (8.14) is preferred.<br />
<strong>The</strong> first step in developing the <strong>optimizer</strong> <strong>API</strong> implementation is to chose an ordering of the variables.<br />
In this case the ordering<br />
⎡<br />
ˆx =<br />
⎢<br />
⎣<br />
x<br />
s<br />
t<br />
c<br />
v<br />
z<br />
f T (:)<br />
g T (:)<br />
will be used. Note f T (:) means the rows of f are transposed and stacked on top of each other to form<br />
a long column vector. <strong>The</strong> Table 8.2 shows the mapping between the ˆx and the model variables.<br />
⎤<br />
⎥<br />
⎦<br />
<strong>The</strong> next step is to consider how the columns of A is defined. Reusing the idea in Section 8.1.2 then<br />
the following pseudo code describes the setup of A.