mpcActiveSetOptions
Create default option set for mpcActiveSetSolver
Description
creates a
structure of default options for options
= mpcActiveSetOptionsmpcActiveSetSolver
, which solves a quadratic programming (QP)
problem using an active-set algorithm.
Examples
Create Default Option Set for Active-Set QP Solver
Create and Modify Default Active-Set QP Solver Option Set
Create a default option set.
opt = mpcActiveSetOptions;
Specify the maximum number of iterations allowed during computation.
opt.MaxIterations = 100;
Specify a constraint tolerance for verifying that the optimal solution satisfies the inequality constraints.
opt.ConstraintTolerance = 1.0e-4;
Create Active-Set Option Set Specifying Input Argument Type
Create a default option set, specifying the input argument type.
opt = mpcActiveSetOptions('single');
Input Arguments
type
— Solver input argument data type
'double'
(default) | 'single'
Solver input argument data type, specified as either
'double'
or 'single'
. This data
type is used for both simulation and code generation. All real options in
the option set are specified using this data type, and all real input
arguments to mpcActiveSetSolver
must match this
type.
Output Arguments
options
— Option set for mpcActiveSetSolver
structure
Option set for mpcActiveSetSolver
, returned as a
structure with the following fields.
Field | Description | Default |
---|---|---|
DataType | Input argument data type, specified as either
'double' or
'single' . This data type is used for
both simulation and code generation, and all real input
arguments to the solver function must match this
type. | 'double' |
MaxIterations | Maximum number of iterations allowed when computing the QP solution, specified as a positive integer. | 200 |
ConstraintTolerance | Tolerance used to verify that inequality constraints are
satisfied by the optimal solution, specified as a positive
scalar. A larger ConstraintTolerance
value allows for larger constraint violations. | 1e-6 |
UseHessianAsInput | Indicator of whether the first input argument to
If your application requires
repetitive calls of
| true |
IntegrityChecks | Indicator of whether integrity checks are performed on
the solver function input data, specified as a logical
value. If IntegrityChecks is
true , then integrity checks are
performed and diagnostic messages are displayed. Use
false for code generation
only. | true |
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
You can use
mpcActiveSetSolver
as a general-purpose QP solver that supports code generation. To specify solver options, usempcActiveSetOptions
. Create the functionmyCode
, which usesmpcActiveSetSolver
andmpcActiveSetOptions
.function [out1,out2] = myCode(in1,in2) %#codegen ... options = mpcActiveSetOptions; [x,status] = mpcActiveSetSolver(Linv,f,A,b,Aeq,Beq,iA0,options); ...
Generate C code with MATLAB® Coder™.
func = 'myCode'; cfg = coder.config('mex'); % or 'lib', 'dll' codegen('-config',cfg,func,'-o',func);
For code generation, use the same precision for all real inputs, including options. Configure the precision as
'double'
or'single'
usingmpcActiveSetOptions
.
Version History
Introduced in R2020a
See Also
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)