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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

iv<br />

CONTENTS<br />

5.3.1 Example: Conic quadratic optimization . . . . . . . . . . . . . . . . . . . . . . . 35<br />

5.4 Semidefinite optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38<br />

5.4.1 Example: Semidefinite optimization . . . . . . . . . . . . . . . . . . . . . . . . . 39<br />

5.5 Quadratic optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44<br />

5.5.1 Example: Quadratic objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45<br />

5.5.2 Example: Quadratic constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<br />

5.6 <strong>The</strong> solution summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52<br />

5.7 Integer optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54<br />

5.7.1 Example: Mixed integer linear optimization . . . . . . . . . . . . . . . . . . . . . 54<br />

5.7.2 Specifying an initial solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />

5.7.3 Example: Specifying an integer solution . . . . . . . . . . . . . . . . . . . . . . . 57<br />

5.8 <strong>The</strong> solution summary for mixed integer problems . . . . . . . . . . . . . . . . . . . . 59<br />

5.9 Response handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60<br />

5.10 Problem modification and reoptimization . . . . . . . . . . . . . . . . . . . . . . . . . . 62<br />

5.10.1 Example: Production planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62<br />

5.10.2 Changing the A matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64<br />

5.10.3 Appending variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65<br />

5.10.4 Reoptimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />

5.10.5 Appending constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />

5.11 Solution analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67<br />

5.11.1 Retrieving solution quality information with the <strong>API</strong> . . . . . . . . . . . . . . . . 67<br />

5.12 Efficiency considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67<br />

5.12.1 <strong>API</strong> overhead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68<br />

5.13 Conventions employed in the <strong>API</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />

5.13.1 Naming conventions for arguments . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />

5.13.2 Vector formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72<br />

5.13.3 Matrix formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72<br />

5.13.4 Array objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />

5.13.5 Typical problems using the <strong>Python</strong> <strong>API</strong> . . . . . . . . . . . . . . . . . . . . . . . 75<br />

5.14 <strong>The</strong> license system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76<br />

5.14.1 Waiting for a free license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76<br />

6 Nonlinear <strong>API</strong> tutorial 77<br />

6.1 Separable convex (SCopt) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78<br />

6.1.1 Adding separable terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79<br />

6.1.2 Example: Simple separable problem . . . . . . . . . . . . . . . . . . . . . . . . . 80<br />

6.1.3 Ensuring convexity and differentiability . . . . . . . . . . . . . . . . . . . . . . . 82<br />

6.1.4 SCopt Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83<br />

7 Advanced <strong>API</strong> tutorial 85<br />

7.1 <strong>The</strong> progress call-back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85<br />

7.1.1 Source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85<br />

7.2 Solving linear systems involving the basis matrix . . . . . . . . . . . . . . . . . . . . . 88<br />

7.2.1 Identifying the basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88<br />

7.2.2 An example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89<br />

7.2.3 Solving arbitrary linear systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

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

Saved successfully!

Ooh no, something went wrong!