Convert optimization problem to solver form
problem = prob2struct(prob)The basis for the problem structure is an implicit ordering of all problem variables
into a single vector. The order of the problem variables is the same as the order of the
Variables property in prob. See
OptimizationProblem.
For example, suppose that the problem variables are in this order:
x — a 3-by-2-by-4 array
y — a 3-by-2 array
Then the implicit variable order is as if the problem variable is vars =
[x(:);y(:)].
The first 24 elements of vars are equivalent to
x(:), and the next six elements are equivalent to
y(:), for a total of 30 elements. The lower and upper bounds
correspond to this variable ordering, and in this example, each linear constraint matrix
has 30 columns.