The MOSEK Python optimizer API manual Version 7.0 (Revision 141)

Optimizer API for Python - Documentation - Mosek Optimizer API for Python - Documentation - Mosek

25.11.2015 Views

84 CHAPTER 6. NONLINEAR API TUTORIAL Constants used to define : Entropy function, fxln(x) Exponential function,fe gx+h Logarithm, fln(gx + h) Power function, f(x + h) g

Chapter 7 Advanced API tutorial This chapter provides information about additional problem classes and functionality provided in the Python API. 7.1 The progress call-back Some of the API function calls, notably Task.optimize, may take a long time to complete. Therefore, during the optimization a call-back function is called frequently, to provide information on the progress of the call. From the call-back function it is possible • to obtain information on the solution process, • to report of the optimizer’s progress, and • to ask MOSEK to terminate, if desired. 7.1.1 Source code example The following source code example documents how the progress call-back function can be used. 1 ## [ callback.py ] 2 # Copyright: Copyright (c) MOSEK ApS, Denmark. All rights reserved. 3 # 4 # File: callback.py 5 # 6 # Purpose: To demonstrate how to use the progress 7 # callback. 8 # 9 # Use this script as follows: 10 # callback.py psim 25fv47.mps 11 # callback.py dsim 25fv47.mps 12 # callback.py intpnt 25fv47.mps 85

Chapter 7<br />

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

This chapter provides information about additional problem classes and functionality provided in the<br />

<strong>Python</strong> <strong>API</strong>.<br />

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

Some of the <strong>API</strong> function calls, notably Task.optimize, may take a long time to complete. <strong>The</strong>refore,<br />

during the optimization a call-back function is called frequently, to provide information on the progress<br />

of the call. From the call-back function it is possible<br />

• to obtain information on the solution process,<br />

• to report of the <strong>optimizer</strong>’s progress, and<br />

• to ask <strong>MOSEK</strong> to terminate, if desired.<br />

7.1.1 Source code example<br />

<strong>The</strong> following source code example documents how the progress call-back function can be used.<br />

1 ##<br />

[ callback.py ]<br />

2 # Copyright: Copyright (c) <strong>MOSEK</strong> ApS, Denmark. All rights reserved.<br />

3 #<br />

4 # File: callback.py<br />

5 #<br />

6 # Purpose: To demonstrate how to use the progress<br />

7 # callback.<br />

8 #<br />

9 # Use this script as follows:<br />

10 # callback.py psim 25fv47.mps<br />

11 # callback.py dsim 25fv47.mps<br />

12 # callback.py intpnt 25fv47.mps<br />

85

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

Saved successfully!

Ooh no, something went wrong!