mpcInteriorPointOptions
Create default option set for
mpcInteriorPointSolver
Description
creates a structure of default options for options
= mpcInteriorPointOptionsmpcInteriorPointSolver
, which solves a quadratic programming (QP)
problem using an interior-point algorithm.
Examples
Create Default Option Set for Interior-Point QP Solver
Create and Modify Default Interior-Point QP Solver Option Set
Create a default option set.
opt = mpcInteriorPointOptions;
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 Interior-Point Option Set Specifying Input Argument Type
Create a default option set, specifying the input argument type.
opt = mpcInteriorPointOptions('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 mpcInteriorPointSolver
must match this
type.
Output Arguments
options
— Option set for mpcInteriorPointSolver
structure
Option set for mpcInteriorPointSolver
, 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. | 50 |
ConstraintTolerance | Tolerance used to verify that equality and inequality
constraints are satisfied by the optimal solution, specified
as a positive scalar. A larger
ConstraintTolerance value allows for
larger constraint violations. | 1e-6 |
OptimalityTolerance | Termination tolerance for first-order optimality (KKT dual residual), specified as a positive scalar. Increasing this value relaxes the condition for the optimality check. | 1e-6 |
ComplementarityTolerance | Termination tolerance for first-order optimality (KKT average complementarity residual), specified as a positive scalar. Increasing this value improves robustness, while decreasing this value increases accuracy. | 1e-8 |
StepTolerance | Termination tolerance for decision variables, specified as a positive scalar. | 1e-8 |
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
mpcInteriorPointSolver
as a general-purpose QP solver that supports code generation. To specify solver options, usempcInteriorPointOptions
. Create the functionmyCode
, which usesmpcInteriorPointSolver
andmpcInteriorPointOptions
.function [out1,out2] = myCode(in1,in2) %#codegen ... options = mpcInteriorPointOptions; [x,exitflag] = mpcInteriorPointSolver(H,f,A,b,Aeq,Beq,x0,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'
usingmpcInteriorPointOptions
.
Version History
See Also
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)