The MOSEK Python optimizer API manual Version 7.0 (Revision 141)
Optimizer API for Python - Documentation - Mosek Optimizer API for Python - Documentation - Mosek
88 CHAPTER 7. ADVANCED API TUTORIAL 7.2 Solving linear systems involving the basis matrix A linear optimization problem always has an optimal solution which is also a basic solution. In an optimal basic solution there are exactly m basic variables where m is the number of rows in the constraint matrix A. Define B ∈ R m×m as a matrix consisting of the columns of A corresponding to the basic variables. The basis matrix B is always non-singular, i.e. det(B) ≠ 0 or equivalently that B −1 exists. This implies that the linear systems and B¯x = w (7.1) each has a unique solution for all w . B T ¯x = w (7.2) MOSEK provides functions for solving the linear systems (7.1) and (7.2) for an arbitrary w-¿. 7.2.1 Identifying the basis To use the solutions to (7.1) and (7.2) it is important to know how the basis matrix B is constructed. Internally MOSEK employs the linear optimization problem where maximize c T x subject to Ax − x c = 0, l x ≤ x ≤ u x , l c ≤ x c ≤ u c . (7.3) x c ∈ R m and x ∈ R n . The basis matrix is constructed of m columns taken from [ A − I ]. If variable x j is a basis variable, then the j ’th column of A denoted a :,j will appear in B. Similarly, if x c i is a basis variable, then the i ’th column of −I will appear in the basis. The ordering of the
7.2. SOLVING LINEAR SYSTEMS INVOLVING THE BASIS MATRIX 89 basis variables and therefore the ordering of the columns of B is arbitrary. The ordering of the basis variables may be retrieved by calling the function task.initbasissolve(basis) where basis is an array of variable indexes. This function initializes data structures for later use and returns the indexes of the basic variables in the array basis. The interpretation of the basis is as follows. If basis[i] < numcon, then the i’th basis variable is x c i . Moreover, the i ’th column in B will be the i’th column of −I. On the other hand if then the i ’th basis variable is variable basis[i] ≥ numcon, and the i ’th column of B is the column x basis[i]−numcon A :,(basis[i]−numcon) . For instance if basis[0] = 4 and numcon = 5 , then since basis[0] < numcon , the first basis variable is x c 4. Therefore, the first column of B is the fourth column of −I. Similarly, if basis[1] = 7, then the second variable in the basis is x basis[1]−numcon = x 2 . Hence, the second column of B is identical to a :,2 . 7.2.2 An example Consider the linear optimization problem: minimize x 0 + x 1 subject to x 0 + 2x 1 ≤ 2, x 0 + x 1 ≤ 6, x 0 , x 1 ≥ 0. (7.4) Suppose a call to Task.initbasissolve returns an array basis so that basis[0] = 1, basis[1] = 2. Then the basis variables are x c 1 and x 0 and the corresponding basis matrix B is [ 0 1 − 1 1 ] .
- Page 59 and 60: 5.3. CONIC QUADRATIC OPTIMIZATION 3
- Page 61 and 62: 5.4. SEMIDEFINITE OPTIMIZATION 39 m
- Page 63 and 64: 5.4. SEMIDEFINITE OPTIMIZATION 41 4
- Page 65 and 66: 5.4. SEMIDEFINITE OPTIMIZATION 43 1
- Page 67 and 68: 5.5. QUADRATIC OPTIMIZATION 45 with
- Page 69 and 70: 5.5. QUADRATIC OPTIMIZATION 47 68 #
- Page 71 and 72: 5.5. QUADRATIC OPTIMIZATION 49 5.5.
- Page 73 and 74: 5.5. QUADRATIC OPTIMIZATION 51 81 a
- Page 75 and 76: 5.6. THE SOLUTION SUMMARY 53 • Th
- Page 77 and 78: 5.7. INTEGER OPTIMIZATION 55 21 # f
- Page 79 and 80: 5.7. INTEGER OPTIMIZATION 57 137 sy
- Page 81 and 82: 5.8. THE SOLUTION SUMMARY FOR MIXED
- 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: 7.1. THE PROGRESS CALL-BACK 87 71 p
- 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 and 134: 8.1. PORTFOLIO OPTIMIZATION 111 z j
- Page 135 and 136: 8.1. PORTFOLIO OPTIMIZATION 113 Var
- 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
7.2. SOLVING LINEAR SYSTEMS INVOLVING THE BASIS MATRIX 89<br />
basis variables and therefore the ordering of the columns of B is arbitrary. <strong>The</strong> ordering of the basis<br />
variables may be retrieved by calling the function<br />
task.initbasissolve(basis)<br />
where basis is an array of variable indexes.<br />
This function initializes data structures for later use and returns the indexes of the basic variables in<br />
the array basis. <strong>The</strong> interpretation of the basis is as follows. If<br />
basis[i] < numcon,<br />
then the i’th basis variable is x c i . Moreover, the i ’th column in B will be the i’th column of −I. On<br />
the other hand if<br />
then the i ’th basis variable is variable<br />
basis[i] ≥ numcon,<br />
and the i ’th column of B is the column<br />
x basis[i]−numcon<br />
A :,(basis[i]−numcon) .<br />
For instance if basis[0] = 4 and numcon = 5 , then since basis[0] < numcon , the first basis variable<br />
is x c 4. <strong>The</strong>refore, the first column of B is the fourth column of −I. Similarly, if basis[1] = 7, then the<br />
second variable in the basis is x basis[1]−numcon = x 2 . Hence, the second column of B is identical to a :,2 .<br />
7.2.2 An example<br />
Consider the linear optimization problem:<br />
minimize x 0 + x 1<br />
subject to x 0 + 2x 1 ≤ 2,<br />
x 0 + x 1 ≤ 6,<br />
x 0 , x 1 ≥ 0.<br />
(7.4)<br />
Suppose a call to Task.initbasissolve returns an array basis so that<br />
basis[0] = 1,<br />
basis[1] = 2.<br />
<strong>The</strong>n the basis variables are x c 1 and x 0 and the corresponding basis matrix B is<br />
[<br />
0 1<br />
− 1 1<br />
]<br />
.