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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

66 CHAPTER 5. BASIC <strong>API</strong> TUTORIAL<br />

and<br />

x 0 , x 1 , x 2 , x 3 ≥ 0.<br />

5.10.4 Reoptimization<br />

When<br />

Task.optimize is called <strong>MOSEK</strong> will store the optimal solution internally. After a task has been<br />

modified and<br />

Task.optimize is called again the solution will automatically be used to reduce solution time of the<br />

new problem, if possible.<br />

In this case an optimal solution to problem (5.11) was found and then added a column was added<br />

to get (5.12). <strong>The</strong> simplex <strong>optimizer</strong> is well suited for exploiting an existing primal or dual feasible<br />

solution. Hence, the subsequent code instructs <strong>MOSEK</strong> to choose the simplex <strong>optimizer</strong> freely when<br />

optimizing.<br />

[ production.py ]<br />

142 # Change <strong>optimizer</strong> to simplex free and reoptimize<br />

143 task.putintparam(mosek.iparam.<strong>optimizer</strong>,mosek.<strong>optimizer</strong>type.free simplex)<br />

144 task.optimize()<br />

5.10.5 Appending constraints<br />

Now suppose we want to add a new stage to the production called ”Quality control” for which 30000<br />

minutes are available. <strong>The</strong> time requirement for this stage is shown below:<br />

This corresponds to adding the constraint<br />

Product no. Quality control (minutes)<br />

0 1<br />

1 2<br />

2 1<br />

3 1<br />

x 0 + 2x 1 + x 2 + x 3 ≤ 30000<br />

to the problem which is done in the following code:<br />

145 # Append a new constraint<br />

146 task.appendcons(1)<br />

147<br />

[ production.py ]<br />

148 # Set bounds on new constraint<br />

149 task.putconbound( task.getnumcon()-1, mosek.boundkey.up,-inf, 30000)<br />

150

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

Saved successfully!

Ooh no, something went wrong!