Main Content


Options object for branch and bound MIQP solver used in mpc object

Since R2024a


    Use the BranchBound object to set options for the active-set QP solver used within an mpc object.


    Creating an mpc object automatically creates an BranchBound object set to default options. If the Type property of any manipulated variable is set to anything different than "continuous", the BranchBound object is assigned to the Optimizer.SolverOption property of the mpc object. You can access the object and its properties using dot notation.


    expand all

    This property is read-only.

    QP solver, returned as 'active-set'. This property indicates the algorithm used to solve the relaxed, continuous, QP problem.

    QP solver options, specified as an ActiveSet object. This object contains the settings for the QP algorithm used to solve the relaxed, continuous QP problem.

    Tolerance used to verify that constraints in the discrete manipulated variables are satisfied by the optimal solution, specified as a positive scalar. A larger DiscreteConstraintTolerance value allows for larger constraint violations.

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

    Option to round the solution at the root node, specified as a boolean. When RoundingAtRootNode is 1, the solver rounds the solution of the relaxed QP problem solved at the root node of the search tree, so that discrete constraints are satisfied. Then, an additional QP is solved with respect to the remaining (continuous) variables. If such a QP has a feasible solution, the corresponding cost is used as a valid upper-bound on the optimal solution of the original mixed-integer problem. Having such an upper-bound can eliminate entire subtrees in the rest of the execution of the solver and accelerate the solution of the following QP relaxations. Unless the number of iterations MaxIterations is small, set RoundingAtRootNode to 1. Set RoundingAtRootNode to 0 to avoid solving the additional QP.

    Example: mpcobj.Optimizer.SolverOptions.RoundingAtRootNode = true

    Maximum number of pending QP relaxations that can be stored, specified as a positive scalar. This property determines the memory allocated to store all pending QP relaxations, which is proportional to (2*m+3*Nd)*MaxPendingNodes, where m is the number of inequality constraints and Nd is the number of discrete variables. If the number of pending relaxations exceeds MaxPendingNodes, then the solver is stopped with status code -3, -4 or -5.

    Example: mpcobj.Optimizer.SolverOptions.MaxPendingNodes = 2000

    Object Functions


    collapse all

    Create an mpc object.

    plant = ss(0.8,0.5,0.25,0,0.1); 
    -->"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.

    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 Type property of the manipulated variable to "integer". Doing so makes the problem noncontinuous, therefore requiring an MIQP solver instead of a simple QP solver.


    Display the properties of the SolverOptions object.

    ans = 
      BranchBound with properties:
                           QPSolver: 'active-set'
                    QPSolverOptions: [1×1 mpc.solver.options.qp.ActiveSet]
        DiscreteConstraintTolerance: 1.0000e-06
                 RoundingAtRootNode: 1
                    MaxPendingNodes: 1000

    Modify the DiscreteConstraintTolerance property.

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

    Extract the object.

    bbopts = mpcobj.Optimizer.SolverOptions;

    Modify the MaxPendingNodes property.

    bbopts.MaxPendingNodes = 500;

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

    mpcobj.Optimizer.SolverOptions = bbopts;

    Display the fields of the Optimizer property again.

    ans = 
      BranchBound with properties:
                           QPSolver: 'active-set'
                    QPSolverOptions: [1×1 mpc.solver.options.qp.ActiveSet]
        DiscreteConstraintTolerance: 1.0000e-05
                 RoundingAtRootNode: 1
                    MaxPendingNodes: 500

    Version History

    Introduced in R2024a

    See Also