miqps_master

miqps_master(H, c, A, l, u, xmin, xmax, x0, vtype, opt)

miqps_master() - Mixed Integer Quadratic Program Solver wrapper function.

[X, F, EXITFLAG, OUTPUT, LAMBDA] = ...
    MIQPS_MASTER(H, C, A, L, U, XMIN, XMAX, X0, VTYPE, OPT)
[X, F, EXITFLAG, OUTPUT, LAMBDA] = MIQPS_MASTER(PROBLEM)
A common wrapper function for various MILP/MIQP solvers.
Solves the following MILP/MIQP (mixed integer linear programming/
mixed integer quadratic programming) problem:

    min 1/2 X'*H*X + C'*X
     X

subject to

    L <= A*X <= U       (linear constraints)
    XMIN <= X <= XMAX   (variable bounds)
    X(i) is integer, for i in I (integer variable constraints)
    X(b) is binary, for b in B (binary variable constraints)

Inputs (all optional except H, C, A and L):
    H : matrix (possibly sparse) of quadratic cost coefficients
    C : vector of linear cost coefficients
    A, L, U : define the optional linear constraints. Default
        values for the elements of L and U are -Inf and Inf,
        respectively.
    XMIN, XMAX : optional lower and upper bounds on the
        X variables, defaults are -Inf and Inf, respectively.
    X0 : optional starting value of optimization vector X
    VTYPE : character string of length NX (number of elements in X),
            or 1 (value applies to all variables in x),
            allowed values are 'C' (continuous), 'B' (binary),
            'I' (integer), 'S' (semi-continuous), or 'N' (semi-integer).
            (MOSEK, GLPK, OT allow only 'C', 'B', or 'I')
    OPT : optional options structure with the following fields,
        all of which are also optional (default values shown in
        parentheses)
        alg ('DEFAULT') : determines which solver to use, can be either
                a string (new-style) or a numerical alg code (old-style)
            'DEFAULT' : (or 0) automatic, first available of Gurobi,
                    CPLEX, MOSEK, Opt Tbx (MILPs only), GLPK (MILPs only)
            'CPLEX'   : (or 500) CPLEX
            'GLPK'    : GLPK, (MILP problems only, i.e. empty H matrix)
            'GUROBI'  : (or 700) Gurobi
            'MOSEK'   : (or 600) MOSEK
            'OT'      : (or 300) Optimization Toolbox, INTLINPROG
                        (MILP problems only, i.e. empty H matrix)
        verbose (0) - controls level of progress output displayed
            0 = no progress output
            1 = some progress output
            2 = verbose progress output
        skip_prices (0) - flag that specifies whether or not to
            skip the price computation stage, in which the problem
            is re-solved for only the continuous variables, with all
            others being constrained to their solved values
        price_stage_warn_tol (1e-7) - tolerance on the objective fcn
            value and primal variable relative match required to avoid
            mis-match warning message
        cplex_opt - options struct for CPLEX
        glpk_opt    - options struct for GLPK
        grb_opt   - options struct for GUROBI
        intlinprog_opt - options struct for INTLINPROG
        linprog_opt - options struct for LINPROG
        mosek_opt - options struct for MOSEK
    PROBLEM : The inputs can alternatively be supplied in a single
        PROBLEM struct with fields corresponding to the input arguments
        described above: H, c, A, l, u, xmin, xmax, x0, vtype, opt

Outputs:
    X : solution vector
    F : final objective function value
    EXITFLAG : exit flag
        1 = converged
        0 or negative values = solver specific failure codes
    OUTPUT : output struct with the following fields:
        alg - algorithm code of solver used
        (others) - algorithm specific fields
    LAMBDA : struct containing the Langrange and Kuhn-Tucker
        multipliers on the constraints, with fields:
        mu_l - lower (left-hand) limit on linear constraints
        mu_u - upper (right-hand) limit on linear constraints
        lower - lower bound on optimization variables
        upper - upper bound on optimization variables

Note the calling syntax is almost identical to that of QUADPROG
from MathWorks' Optimization Toolbox. The main difference is that
the linear constraints are specified with A, L, U instead of
A, B, Aeq, Beq.

Calling syntax options:
    [x, f, exitflag, output, lambda] = ...
        miqps_master(H, c, A, l, u, xmin, xmax, x0, vtype, opt)

    x = miqps_master(H, c, A, l, u)
    x = miqps_master(H, c, A, l, u, xmin, xmax)
    x = miqps_master(H, c, A, l, u, xmin, xmax, x0)
    x = miqps_master(H, c, A, l, u, xmin, xmax, x0, vtype)
    x = miqps_master(H, c, A, l, u, xmin, xmax, x0, vtype, opt)
    x = miqps_master(problem), where problem is a struct with fields:
                    H, c, A, l, u, xmin, xmax, x0, vtype, opt
                    all fields except 'c', 'A' and 'l' or 'u' are optional
    x = miqps_master(...)
    [x, f] = miqps_master(...)
    [x, f, exitflag] = miqps_master(...)
    [x, f, exitflag, output] = miqps_master(...)
    [x, f, exitflag, output, lambda] = miqps_master(...)

Example: (problem from from %% from MOSEK 6.0 Guided Tour, section  7.13.1
          https://docs.mosek.com/6.0/toolbox/node009.html)
    c = [-2; -3];
    A = sparse([195 273; 4 40]);
    u = [1365; 140];
    xmax = [4; Inf];
    vtype = 'I';
    opt = struct('verbose', 2);
    p = struct('c', c, 'A', A, 'u', u, 'xmax', xmax, 'vtype', vtype, 'opt', opt);
    [x, f, s, out, lam] = miqps_master(p);