# 7.1 Separable Convex (SCopt) Interface¶

The Optimization Toolbox for MATLAB provides a way to add simple non-linear functions composed from a limited set of non-linear terms. Non-linear terms can be mixed with quadratic terms in objective and constraints. We consider problems which can be formulated as:

where \(x\in\real^n\) and each \(z_i : \real^n\rightarrow\real\) is separable, that is can be written as a sum

The interface implements a limited set of functions which can appear as \(z_{i,j}\). They are:

Separable function | Operator name | Name |
---|---|---|

\(f x \ln (x)\) | ent | Entropy function |

\(f e^{g x + h}\) | exp | Exponential function |

\(f \ln (g x + h)\) | log | Logarithm |

\(f (x+h)^g\) | pow | Power function |

where \(f,g,h\in\real\) are constants. This formulation does not guarantee convexity. For **MOSEK** to be able to solve the problem, the following requirements must be met:

- If the objective is minimized, the sum of non-linear terms must be convex, otherwise it must be concave.
- Any constraint bounded below must be concave, and any constraint bounded above must be convex.
- Each separable term must be twice differentiable within the bounds of the variable it is applied to.

Some simple rules can be followed 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. These bounds are defined in Table 7.2.

Separable function | Operator name | Safe \(x\) bounds |
---|---|---|

\(f x \ln (x)\) | ent | \(0 < x\). |

\(f e^{g x + h}\) | exp | \(-\infty <x <\infty\). |

\(f \ln (g x + h)\) | log | If \(g > 0\): \(-h/g < x\). |

If \(g < 0\): \(x < -h/g\). | ||

\(f (x+h)^g\) | pow | If \(g > 0\) and integer: \(-\infty <x <\infty\). |

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. Table 7.3 lists convexity conditions for the relevant ranges for \(f>0\) — changing the sign of \(f\) switches concavity/convexity.

Separable function | Operator name | Convexity conditions |
---|---|---|

\(f x \ln (x)\) | ent | Convex within safe bounds. |

\(f e^{g x + h}\) | exp | Convex for all \(x\). |

\(f \ln (g x + h)\) | log | Concave within safe bounds. |

\(f (x+h)^g\) | pow | If \(g\) is even integer: convex within safe bounds. |

If \(g\) is odd integer: - concave if \((-\infty,-h)\),
- convex if \((-h,\infty)\)
If \(0<g<1\): concave within safe bounds. |
||

Otherwise: convex within safe bounds. |

A problem involving linear combinations of variables (such as \(\ln(x_1+x_2)\)), can be converted to a separable problem using slack variables and additional equality constraints.

## 7.1.1 Example¶

Consider the following separable convex problem:

Note that all nonlinear functions are well defined for \(x\) values satisfying the variable bounds strictly. This assures that function evaluation errors will not occur during the optimization process because **MOSEK**.

The **MOSEK** Toolbox for MATLAB provides a simple interface for separable convex problem called SCopt, and composed by a single function `mskscopt`

.

When using the SCopt interface to solve problem (1), the linear part of the problem, such as a \(c\) and \(A\), is specified as usual using MATLAB vectors and matrices. However, the nonlinear functions must be specified using five arrays which in the case of problem (1) can have the form:

```
opr = ['log'; 'exp'; 'ent'; 'pow'];
opri = [0 ; 0; 1; 2];
oprj = [1 ; 2; 2; 1];
oprf = [-1 ; 1; 1; 1];
oprg = [1 ; 1; 0; 0.5];
oprh = [0 ; 0; 0; 0];
```

Hence,

`opr(k,:)`

specifies the type of a nonlinear function,`opri(k)`

specifies in which constraint the nonlinear function should be added (zero means objective),`oprj(k)`

means that the nonlinear function should be applied to \(x_j\),`oprf(k)`

,`oprg(k)`

and`oprh(k)`

are parameters used by the`mskscopt`

function according to Table 7.1.

The `i`

value indicates which constraint the nonlinear function belongs to. However, if `i`

is identical to zero, then the function belongs to the objective.