CVXGEN: Code Generation for Convex Optimization

Variable specification

Optimization variables are found during solution, and may be used in the objective and constraints. Variables are specified by a name and dimension. Dimensions can use symbolic values from dimensions blocks. CVXGEN supports scalar and vector variables, and indexed variables.

Some examples (assuming m and n were specified in a dimensions block):

  x (n)
  y (2*n)
  z[i] (3), i=1..5


  • Simple arithmetic is allowed in the dimension specification.

  • The variable name must consist only of numbers, letters and underscores, and must start with a letter or an underscore.