Main Content

InteriorPoint

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. 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.MaxIterations = 30

    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
             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
             ConstraintTolerance: 1.0000e-05
             OptimalityTolerance: 1.0000e-06
        ComplementarityTolerance: 1.0000e-08
                   StepTolerance: 1.0000e-08
    
    

    Version History

    Introduced in R2024a