CVXGEN: Code Generation for Convex Optimization

Problem specification

Specify your optimization problem using a single block of text. Here is the general structure:

dimensions
  # Zero or more dimensions for use in the rest of the specification.
end

parameters
  # Zero or more parameters, to be filled with problem data at solve time.
end

variables
  # One or more optimization variables.
end

minimize
  # An optional objective.
subject to
  # Zero or more constraints.
end

Notes

  • You can use maximize instead of minimize.

  • The dimensions, parameters and variables blocks can be repeated.

  • The dimensions and parameters blocks can be omitted.

  • Lines starting with # are treated as comments and ignored.

  • Blocks can appear in any order.

  • Within a block, you can use a semicolon ‘;’ instead of a newline.

Additional blocks

Two other block types are possible:

comment
  Any text in here is treated as a comment and ignored.
end

constraints
  # Zero or more constraints.
end

These can be repeated.