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.
58 Downloads
Updated Sun, 04 Jul 2021 14:05:41 +0000

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 (2024). 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!
Version Published Release Notes
1.1.6

Solved compatibility problem with more current Matlab versions (due to mapSolution being removed by MathWorks).

1.1.5

Documentation fix and a workaround for mapSolution bug in R2019b

1.1.4

Minor summary and title edits

1.1.3

Minor

1.1.2

Minor

1.1.1

Description edit.

1.1.0

Created a new implementation called prob2matrices(). This re-implementation has a different input syntax than sbmatrices() had, and allows linear objective functions to be specified as well.

1.0.6

again.

1.0.5

Examples update

1.0.4

Description update.

1.0.3

Description update and Live Script example added.

1.0.2

Description update

1.0.1

Description update

1.0.0