The MOSEK Python optimizer API manual Version 7.0 (Revision 141)
Optimizer API for Python - Documentation - Mosek Optimizer API for Python - Documentation - Mosek
82 CHAPTER 6. NONLINEAR API TUTORIAL 76 77 oprc = [ mosek.scopr.exp, mosek.scopr.exp ] 78 opric = [ 0, 0 ] 79 oprjc = [ 4, 5 ] 80 oprfc = [ 1.0, 1.0 ] 81 oprgc = [ 1.0, 1.0 ] 82 oprhc = [ 0.0, 0.0 ] 83 84 task.putSCeval(opro, oprjo, oprfo, oprgo, oprho, 85 oprc, opric, oprjc, oprfc, oprgc, oprhc) 86 87 task.optimize() 88 89 res = [ 0.0 ] * numvar 90 task.getsolutionslice( 91 mosek.soltype.itr, 92 mosek.solitem.xx, 93 0, numvar, 94 res) 95 96 print ( "Solution is: %s" % res ) 97 98 main() 6.1.3 Ensuring convexity and differentiability Some simple rules can be set up to ensure that the problem satisfies MOSEK’s convexity and differentiability requirements. First of all, for any variable x i used in a separable term, the variable bounds must define a range within which the function is twice differentiable. We can define these bounds as follows: Separable function Operator name Safe x bounds fxln(x) scopr.ent 0 < x. fe gx+h scopr.exp −∞ < x < ∞. fln(gx + h) scopr.log If g > 0: −h/g < x. If g < 0: x < −h/g. f(x + h) g scopr.pow If g > 0 and integer: −∞ < x < ∞. If g < 0 and integer: either −h < x or x < −h. Otherwise: −h < x. To ensure convexity, we require that each z i (x) is either a sum of convex terms or a sum of concave terms. The following table lists convexity for the relevant ranges for f > 0 — changing the sign of f switches concavity/convexity.
6.1. SEPARABLE CONVEX (SCOPT) INTERFACE 83 Separable function Operator name fxln(x) scopr.ent Convex within safe bounds. fe gx+h scopr.exp Convex for all x. fln(gx + h) scopr.log Concave within safe bounds. f(x + h) g scopr.pow If g is even integer: convex within safe bounds. If g is odd integer: concave (−∞, −h), convex (−h, ∞). If 0 < g < 1: concave within safe bounds. Otherwise: convex within safe bounds. 6.1.4 SCopt Reference Functions used to manipulate separable terms: (opro, oprjo, oprfo, oprgo, oprho, oprc, opric, oprjc, oprfc, oprgc, oprhc) Replace all current non-linear separable terms with a new set. opro List of function indicators defining the objective terms; see scopr. oprjo List of variable indexes for the objective terms. oprfo List of f values for the objective terms oprgo List of g values for the objective terms oprho List of h values for the objective terms oprc List of function indicators defining the constraint terms; see scopr. opric List of variable indexes for the constraint terms. oprjc List of constraint indexes for the constraint terms. oprfc List of f values for the constraint terms oprgc List of g values for the constraint terms oprhc List of h values for the constraint terms () Remove all non-linear separable terms from the task.
- Page 53 and 54: 5.2. LINEAR OPTIMIZATION 31 88 task
- Page 55 and 56: 5.2. LINEAR OPTIMIZATION 33 51 mose
- Page 57 and 58: 5.3. CONIC QUADRATIC OPTIMIZATION 3
- 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: 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 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
6.1. SEPARABLE CONVEX (SCOPT) INTERFACE 83<br />
Separable function Operator name<br />
fxln(x) scopr.ent Convex within safe bounds.<br />
fe gx+h scopr.exp Convex for all x.<br />
fln(gx + h) scopr.log Concave within safe bounds.<br />
f(x + h) g scopr.pow If g is even integer: convex within safe bounds.<br />
If g is odd integer: concave (−∞, −h), convex (−h, ∞).<br />
If 0 < g < 1: concave within safe bounds.<br />
Otherwise: convex within safe bounds.<br />
6.1.4 SCopt Reference<br />
Functions used to manipulate separable terms:<br />
(opro, oprjo, oprfo, oprgo, oprho, oprc, opric, oprjc, oprfc, oprgc, oprhc)<br />
Replace all current non-linear separable terms with a new set.<br />
opro<br />
List of function indicators defining the objective terms; see scopr.<br />
oprjo<br />
List of variable indexes for the objective terms.<br />
oprfo<br />
List of f values for the objective terms<br />
oprgo<br />
List of g values for the objective terms<br />
oprho<br />
List of h values for the objective terms<br />
oprc<br />
List of function indicators defining the constraint terms; see scopr.<br />
opric<br />
List of variable indexes for the constraint terms.<br />
oprjc<br />
List of constraint indexes for the constraint terms.<br />
oprfc<br />
List of f values for the constraint terms<br />
oprgc<br />
List of g values for the constraint terms<br />
oprhc<br />
List of h values for the constraint terms<br />
()<br />
Remove all non-linear separable terms from the task.