image thumbnail

PROB2MATRICES: A selective version of prob2struct

version 1.1.6 (8.85 KB) by Matt J
Obtains matrices for select parts of an optimization problem from problem-based description.

31 Downloads

Updated 04 Jul 2021

View License

The problem-based framework introduced by the Optimization Toolbox in R2017b provides convenient tools for setting up optimization problems that are naturally expressed in terms of multiple distinct parameter vectors. It also provides a way to specify linear constraints involving summations and other linear operations in terms of direct commands, rather than mentally reformulating them as matrix-vector multiplications. However, the problem-based framework was originally designed for linear programming and, as of the time of this FEX submission, extends only in limited ways to non-linear objectives and constraints (although work on that appears to be ongoing at TMW).
To get the advantages of the problem-based framework for arbitrary non-linear problems, this FEX package offers the conversion tool prob2matrices(). This tool will transform specific parts of the problem-based description to their solver-based matrix forms, which is arguably the most difficult part in going from the problem-based to the solver-based framework. The tool is different from prob2struct() in that it is not necessary to specify a full optimproblem. Instead, one may specify just the problem components that need re-expressing as matrices and vectors. These can include linear in/equalities, bounds, integer constraints, an objective function (if it is linear), and an initial guess in solution structure form. Thus, you can use the power of the problem-based framework to set up all the matrices for any given non-linear solver, which could be fmincon(), or even optimizers in the Global Optimization Toolbox like ga(), patternsearch(), or particleswarm(). The rest of the work is simply a matter of supplying the function handles needed for the non-linear parts of the problem.
See the Examples tab for illustrations of usage.

Cite As

Matt J (2021). PROB2MATRICES: A selective version of prob2struct (https://www.mathworks.com/matlabcentral/fileexchange/74481-prob2matrices-a-selective-version-of-prob2struct), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2018a
Compatible with R2017b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!