PROB2MATRICES: A selective version of prob2struct

バージョン 1.1.6 (8.85 KB) 作成者: Matt J
Obtains matrices for select parts of an optimization problem from problem-based description.
ダウンロード: 60
更新 2021/7/4


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.


Matt J (2024). PROB2MATRICES: A selective version of prob2struct (, MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2018a
R2017b 以降のリリースと互換性あり
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート

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


Documentation fix and a workaround for mapSolution bug in R2019b


Minor summary and title edits






Description edit.


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.




Examples update


Description update.


Description update and Live Script example added.


Description update


Description update