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.

6.1. SEPARABLE CONVEX (SCOPT) INTERFACE 79<br />

6.1.1 Adding separable terms<br />

Separable terms — both objective and constraint terms — are added in one chunk and replaces any<br />

previously added non-linear terms. Each individual term can be describes by a set of values:<br />

• opr, an indicator of which of the basic functions is applied,<br />

• i, the constraint index for terms in constraints,<br />

• j, the index of the variable the functions is applied to,<br />

• f, the constant f in the basic function,<br />

• g, the constant g in the basic function, and<br />

• h, the constant h in the basic function.<br />

For example:<br />

Term opr j f g h<br />

0.1x 1 ln(x 1 ) scopr.ent 1 0.1 0.0 0.0<br />

e x2+1.1 scopr.exp 2 1.0 1.0 1.1<br />

2.1x 1.75<br />

1 scopr.pow 1 2.1 1.75 0.0<br />

√<br />

x1 scopr.pow 1 1.0 0.5 0.0<br />

ln(x 2 + 1.2) scopr.log 2 1.0 1.0 1.2<br />

<strong>The</strong> separable terms of the objective can now be defined by a set of arrays<br />

mosek.scopr array opro # which method<br />

int array oprjo # variable index<br />

float array oprfo # f constant<br />

float array oprgo # g constant<br />

float array oprho # h constant<br />

and the separable constraint terms can be defined the same way, only using an additional array<br />

indicating which constraint each term belongs in<br />

mosek.scopr array oprc # which method<br />

int array opric # constraint index<br />

int array oprjc # variable index<br />

float array oprfc # f constant<br />

float array oprgc # g constant<br />

float array oprhc # h constant<br />

We can now input the separable terms using the Task.putSCeval function:<br />

task.putSCeval(opro, oprjo, oprfo, oprgo, oprho,<br />

oprc, opric, oprjc, oprfc, oprgc, oprhc);<br />

If we wish to input no objective terms, all opr*o arguments may be None, and similarly, if we have no<br />

constraint terms, we may let all opr*c be None.<br />

This will replace all existing non-linear separable terms. To remove all non-linear separable terms, we<br />

can call Task.clearSCeval.

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

Saved successfully!

Ooh no, something went wrong!