Main Content

InteriorPoint

R2026b

Options object for interior point QP solver used in mpc object

Since R2024a

    Description

    Use the InteriorPoint object to set options for the active-set QP solver used within an mpc object. To set options for mpcInteriorPointSolver, use mpcInteriorPointOptions instead.

    Creation

    Creating an mpc object automatically creates an InteriorPoint object set to default options. If you set the Optimizer.Solver property of the mpc object to 'interior-point', the InteriorPoint object is assigned to the Optimizer.SolverOption property of the mpc object. You can access the object and its properties using dot notation.

    Properties

    expand all

    Maximum number of iterations allowed when computing the QP solution, specified as a positive integer. The QP solver stops after the specified number of iterations.

    Note

    The solver terminates when either of the following conditions is met:

    • The maximum number of iterations (MaxIterations) is reached.

    • The maximum allowed elapsed time (MaxTime) is exceeded.

    If the solver fails to converge in the final iteration, the controller:

    • Freezes the controller movement if UseSuboptimalSolution is false.

    • Applies the suboptimal solution reached after the final iteration if UseSuboptimalSolution is true.

    Using MaxTime for code generation is supported.

    Example: mpcobj.Optimizer.SolverOptions.MaxIterations = 30

    Maximum wall-clock execution time allowed to the solver, specified as a positive scalar (in seconds) or as a scalar duration object. By default, this property is set to Inf.

    Note

    The solver terminates when either of the following conditions is met:

    • The maximum number of iterations (MaxIterations) is reached

    • The maximum allowed elapsed time (MaxTime) has been exceeded.

    If the solver fails to converge in the final iteration, the controller:

    • Freezes the controller movement if UseSuboptimalSolution is false.

    • Applies the suboptimal solution reached after the final iteration if UseSuboptimalSolution is true.

    Example: mpcobj.Optimizer.SolverOptions.Maxtime = seconds(0.02)

    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.

    Example: mpcobj.Optimizer.SolverOptions.ConstraintTolerance = 1e-5

    Termination tolerance for first-order optimality (KKT dual residual), specified as a positive scalar.

    Example: mpcobj.Optimizer.SolverOptions.OptimalityTolerance = 1e-5

    Termination tolerance for first-order optimality (KKT average complementarity residual), specified as a positive scalar. Increasing this value improves robustness. Decreasing this value increases accuracy.

    Example: mpcobj.Optimizer.SolverOptions.ComplementarityTolerance = 1e-6

    Termination tolerance for decision variables, specified as a positive scalar.

    Example: mpcobj.Optimizer.SolverOptions.StepTolerance = 1e-7

    Object Functions

    Examples

    collapse all

    Create an mpc object.

    plant = ss(0.8,0.5,0.25,0,0.1); 
    mpcobj=mpc(plant);
    -->"PredictionHorizon" is empty. Assuming default 10.
    -->"ControlHorizon" is empty. Assuming default 2.
    -->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
    -->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
    -->"Weights.OutputVariables" is empty. Assuming default 1.00000.
    

    Display the fields of the Optimizer property.

    mpcobj.Optimizer
    ans = struct with fields:
             OptimizationType: 'QP'
                       Solver: 'active-set'
                SolverOptions: [1×1 mpc.solver.options.qp.ActiveSet]
                 MinOutputECR: 0
        UseSuboptimalSolution: 0
                 CustomSolver: 0
          CustomSolverCodeGen: 0
    
    

    Set the solver property to "interior-point".

    mpcobj.Optimizer.Solver = "interior-point";

    Display the properties of the SolverOptions object.

    mpcobj.Optimizer.SolverOptions
    ans = 
      InteriorPoint with properties:
    
                   MaxIterations: 50
                         MaxTime: Inf sec
             ConstraintTolerance: 1.0000e-06
             OptimalityTolerance: 1.0000e-06
        ComplementarityTolerance: 1.0000e-08
                   StepTolerance: 1.0000e-08
    
    

    Modify the ConstraintTolerance property.

    mpcobj.Optimizer.SolverOptions.ConstraintTolerance = 1e-5;

    Extract the object.

    ipopts = mpcobj.Optimizer.SolverOptions;

    Modify the MaxIterations property.

    ipopts.MaxIterations = 45;

    Reassign the object to the SolverOptions field of the Optimizer property of mpcobj.

    mpcobj.Optimizer.SolverOptions = ipopts;

    Display the fields of the Optimizer property again.

    mpcobj.Optimizer.SolverOptions
    ans = 
      InteriorPoint with properties:
    
                   MaxIterations: 45
                         MaxTime: Inf sec
             ConstraintTolerance: 1.0000e-05
             OptimalityTolerance: 1.0000e-06
        ComplementarityTolerance: 1.0000e-08
                   StepTolerance: 1.0000e-08
    
    

    Version History

    Introduced in R2024a