# 16.11 Nonlinear extensions¶

## 16.11.1 Separable Convex Optimization (SCopt)¶

SCopt is an easy-to-use interface to the nonlinear optimizer when solving separable convex problems. See Section 8.1 for a tutorial and example code. As currently implemented, SCopt can handle only the nonlinear expressions $$x\ln (x)$$, $$e^x$$, $$\ln (x)$$, and $$x^g$$. However, it should be fairly easy to extend the interface to other nonlinear function of a single variable if needed.

All the linear data of the problem, such as $$c$$ and $$A$$, is inputted to MOSEK as usual, i.e. using the relevant functions in the MOSEK API. Every nonlinear expression added to the objective should be specified by a 5-tuple of parameters:

opro[k] oprjo[k] oprfo[k] oprgo[k] oprho[k] Expression added in objective
scopt.ent j $$f$$ $$g$$ $$h$$ $$f x_j \ln (x_j)$$
scopt.exp j $$f$$ $$g$$ $$h$$ $$f e^{g x_j + h}$$
scopt.log j $$f$$ $$g$$ $$h$$ $$f \ln (g x_j +h)$$
scopt.pow j $$f$$ $$g$$ $$h$$ $$f (x_j+h)^g$$

Every nonlinear expression added to the constraints should be specified by a 6-tuple of parameters:

oprc[k] opric[k] oprjc[k] oprfc[k] oprgc[k] oprhc[k] Expression added to constraint $$i$$
scopt.ent i j $$f$$ $$g$$ $$h$$ $$f x_j \ln (x_j)$$
scopt.exp i j $$f$$ $$g$$ $$h$$ $$f e^{g x_j + h}$$
scopt.log i j $$f$$ $$g$$ $$h$$ $$f \ln (g x_j +h)$$
scopt.pow i j $$f$$ $$g$$ $$h$$ $$f (x_j+h)^g$$

In each case opr specifies the kind of expression to be added, oprf, oprg and oprh are the parameters and opri, oprj determine the variable and/or constraint to be considered. The concrete API specification follows.

scopr

Type of nonlinear term in the SCopt interface.

scopt.ent

Entropy function $$f x \ln (x)$$

scopt.exp

Exponential function $$f e^{g x + h}$$

scopt.log

Logarithm $$f \ln (g x + h)$$

scopt.pow

Power function $$f (x+h)^g$$

Task.putSCeval
void putSCeval(
scopr[]  opro,
int[]    oprjo,
double[] oprfo,
double[] oprgo,
double[] oprho,
scopr[]  oprc,
int[]    opric,
int[]    oprjc,
double[] oprfc,
double[] oprgc,
double[] oprhc)


Define the nonlinear part of the problem in the format specified by the SCopt interface. The first five arguments describe the nonlinear terms added to the objective, and should have the same length. The remaining six arguments describe the nonlinear terms added to the constraints and should have the same length. Multiple terms involving the same variable and constraint are possible, they will be added up.

Parameters:

• opro (scopr[]) – List of function indicators defining the objective terms. (input)
• oprjo (int[]) – List of variable indexes for the objective terms. (input)
• oprfo (double[]) – List of $$f$$ values for the objective terms. (input)
• oprgo (double[]) – List of $$g$$ values for the objective terms. (input)
• oprho (double[]) – List of $$h$$ values for the objective terms. (input)
• oprc (scopr[]) – List of function indicators defining the constraint terms. (input)
• opric (int[]) – List of constraint indexes for the constraint terms. (input)
• oprjc (int[]) – List of variable indexes for the constraint terms. (input)
• oprfc (double[]) – List of $$f$$ values for the constraint terms. (input)
• oprgc (double[]) – List of $$g$$ values for the constraint terms. (input)
• oprhc (double[]) – List of $$h$$ values for the constraint terms. (input)
Task.clearSCeval
void clearSCeval ()


Remove all non-linear separable terms from the task.

Task.writeSC
void writeSC
(string scfilename,

• scfilename (string) – Name of SCopt terms file. (input)
• taskfilename (string) – Name of problem file. (input)