BQPB#

purpose#

The bqpb package uses a primal-dual interior-point method to solve a given bound-constrained convex quadratic program. The aim is to minimize the quadratic objective function

\[q(x) = f + g^T x + \frac{1}{2} x^T H x,\]
or the shifted-least-distance objective function
\[s(x) = f + g^T x + \frac{1}{2} \sum_{j=1}^n w_j^2 (x_j - x_j^0)^2,\]
subject to the simple bounds
\[x_l \leq x \leq x_u,\]
where \(H\) is a given \(n\) by \(n\) symmetric postive-semi-definite matrix, \(g\), \(w\) and \(x^0\) are vectors, \(f\) is a scalar, and any of the components of the vectors \(x_l\) or \(x_u\) may be infinite. The method offers the choice of direct and iterative solution of the key regularization subproblems, and is most suitable for problems involving a large number of unknowns \(x\).

See Section 4 of $GALAHAD/doc/bqpb.pdf for additional details.

terminology#

Any required solution \(x\) necessarily satisfies the primal optimality conditions

\[x_l \leq x \leq x_u,\;\;\mbox{(1)}\]
the dual optimality conditions
\[H x + g = z,\;\;\mbox{and}\;\; z = z_l + z_u,\;\;\mbox{(2a)}\]
and
\[z_l \geq 0 \;\;\mbox{and}\;\; z_u \leq 0,\;\;\mbox{(2b)}\]
and the complementary slackness conditions
\[(x -x_l )^{T} z_l = 0 \;\;\mbox{and}\;\;(x -x_u )^{T} z_u = 0,\;\;\mbox{(3)}\]
where the vector \(z\) is known as the dual variables for the bounds, and where the vector inequalities hold component-wise.

In the shifted-least-distance case, \(g\) is shifted by \(-W^2 x^0\), and \(H = W^2\), where \(W\) is the diagonal matrix whose entries are the \(w_j\).

method#

Primal-dual interior point methods iterate towards a point that satisfies these optimality conditions by ultimately aiming to satisfy (2a) and (3), while ensuring that (1) and (2b) are satisfied as strict inequalities at each stage. Appropriate norms of the amounts by which (2a) and (3) fail to be satisfied are known as the dual infeasibility, and the violation of complementary slackness, respectively. The fact that (1) and (2b) are satisfied as strict inequalities gives such methods their other title, namely interior-point methods.

The method aims at each stage to reduce the overall violation of (2a) and (3), rather than reducing each of the terms individually. Given an estimate \(v = (x, \; z, \; z^{l}, \; z^{u})\) of the primal-dual variables, a correction \(\Delta v = \Delta (x, \;z,\;z^{l} ,\;z^{u} )\) is obtained by solving a suitable linear system of Newton equations for the nonlinear systems (2a) and a parameterized ``residual trajectory’’ perturbation of (3); residual trajectories proposed by Zhang (1994) and Zhao and Sun (1999) are possibilities. An improved estimate \(v + \alpha \Delta v\) is then used, where the step-size \(\alpha\) is chosen as close to 1.0 as possible while ensuring both that (1) and (2b) continue to hold and that the individual components which make up the complementary slackness (3) do not deviate too significantly from their average value. The parameter that controls the perturbation of (3) is ultimately driven to zero.

The Newton equations are solved by applying the matrix factorization package SBLS, but there are options to factorize the matrix as a whole (the so-called “augmented system” approach), to perform a block elimination first (the “Schur-complement” approach), or to let the method itself decide which of the two previous options is more appropriate. The “Schur-complement” approach is usually to be preferred when all the weights are nonzero or when every variable is bounded (at least one side).

The package is actually just a front-end to the more-sophisticated package CQP that saves users from setting unnecessary arguments.

references#

The basic algorithm is a generalisation of those of

Y. Zhang, ``On the convergence of a class of infeasible interior-point methods for the horizontal linear complementarity problem’’. SIAM J. Optimization 4(1) (1994) 208-227,

and

G. Zhao and J. Sun, ``On the rate of local convergence of high-order infeasible path-following algorithms for \(P_*\) linear complementarity problems’’. Computational Optimization and Applications **14(1)* (1999) 293-307,

with many enhancements described by

N. I. M. Gould, D. Orban and D. P. Robinson, ``Trajectory-following methods for large-scale degenerate convex quadratic programming’’, Mathematical Programming Computation 5(2) (2013) 113-142.

matrix storage#

The symmetric \(n\) by \(n\) matrix \(H\) may be presented and stored in a variety of formats. But crucially symmetry is exploited by only storing values from the lower triangular part (i.e, those entries that lie on or below the leading diagonal).

Dense storage format: The matrix \(H\) is stored as a compact dense matrix by rows, that is, the values of the entries of each row in turn are stored in order within an appropriate real one-dimensional array. Since \(H\) is symmetric, only the lower triangular part (that is the part \(H_{ij}\) for \(0 \leq j \leq i \leq n-1\)) need be held. In this case the lower triangle should be stored by rows, that is component \(i * i / 2 + j\) of the storage array H_val will hold the value \(H_{ij}\) (and, by symmetry, \(H_{ji}\)) for \(0 \leq j \leq i \leq n-1\). The string H_type = ‘dense’ should be specified.

Sparse co-ordinate storage format: Only the nonzero entries of the matrices are stored. For the \(l\)-th entry, \(0 \leq l \leq ne-1\), of \(H\), its row index i, column index j and value \(H_{ij}\), \(0 \leq j \leq i \leq n-1\), are stored as the \(l\)-th components of the integer arrays H_row and H_col and real array H_val, respectively, while the number of nonzeros is recorded as H_ne = \(ne\). Note that only the entries in the lower triangle should be stored. The string H_type = ‘coordinate’ should be specified.

Sparse row-wise storage format: Again only the nonzero entries are stored, but this time they are ordered so that those in row i appear directly before those in row i+1. For the i-th row of \(H\) the i-th component of the integer array H_ptr holds the position of the first entry in this row, while H_ptr(n) holds the total number of entries. The column indices j, \(0 \leq j \leq i\), and values \(H_{ij}\) of the entries in the i-th row are stored in components l = H_ptr(i), …, H_ptr(i+1)-1 of the integer array H_col, and real array H_val, respectively. Note that as before only the entries in the lower triangle should be stored. For sparse matrices, this scheme almost always requires less storage than its predecessor. The string H_type = ‘sparse_by_rows’ should be specified.

Diagonal storage format: If \(H\) is diagonal (i.e., \(H_{ij} = 0\) for all \(0 \leq i \neq j \leq n-1\)) only the diagonals entries \(H_{ii}\), \(0 \leq i \leq n-1\) need be stored, and the first n components of the array H_val may be used for the purpose. The string H_type = ‘diagonal’ should be specified.

Multiples of the identity storage format: If \(H\) is a multiple of the identity matrix, (i.e., \(H = \alpha I\) where \(I\) is the n by n identity matrix and \(\alpha\) is a scalar), it suffices to store \(\alpha\) as the first component of H_val. The string H_type = ‘scaled_identity’ should be specified.

The identity matrix format: If \(H\) is the identity matrix, no values need be stored. The string H_type = ‘identity’ should be specified.

The zero matrix format: The same is true if \(H\) is the zero matrix, but now the string H_type = ‘zero’ or ‘none’ should be specified.

functions#

bqpb.initialize()#

Set default option values and initialize private data

Returns:

optionsdict
dictionary containing default control options:
errorint

error and warning diagnostics occur on stream error.

outint

general output occurs on stream out.

print_levelint

the level of output required is specified by print_level. Possible values are

  • <=0

    gives no output,

  • 1

    gives a one-line summary for every iteration.

  • 2

    gives a summary of the inner iteration for each iteration.

  • >=3

    gives increasingly verbose (debugging) output.

start_printint

any printing will start on this iteration.

stop_printint

any printing will stop on this iteration.

maxitint

at most maxit inner iterations are allowed.

infeas_maxint

the number of iterations for which the overall infeasibility of the problem is not reduced by at least a factor reduce_infeas before the problem is flagged as infeasible (see reduce_infeas).

muzero_fixedint

the initial value of the barrier parameter will not be changed for the first muzero_fixed iterations.

restore_problemint

indicate whether and how much of the input problem should be restored on output. Possible values are

  • 0

    nothing restored

  • 1

    scalar and vector parameters

  • 2

    all parameters.

indicator_typeint

specifies the type of indicator function used. Possible values are

  • 1

    primal indicator: a constraint is active if and only if the distance to its nearest bound <= indicator_p_tol.

  • 2

    primal-dual indicator: a constraint is active if and only if the distance to its nearest bound <= indicator_tol_pd times the size of the corresponding multiplier.

  • 3

    primal-dual indicator: a constraint is active if and only if the distance to its nearest bound <= indicator_tol_tapia times the distance to same bound at the previous iteration.

arcint

which residual trajectory should be used to aim from the current iterate to the solution. Possible values are

  • 1

    the Zhang linear residual trajectory.

  • 2

    the Zhao-Sun quadratic residual trajectory.

  • 3

    the Zhang arc ultimately switching to the Zhao-Sun residual trajectory.

  • 4

    the mixed linear-quadratic residual trajectory.

  • 5

    the Zhang arc ultimately switching to the mixed linear-quadratic residual trajectory.

series_orderint

the order of (Taylor/Puiseux) series to fit to the path data.

sif_file_deviceint

specifies the unit number to write generated SIF file describing the current problem.

qplib_file_deviceint

specifies the unit number to write generated QPLIB file describing the current problem.

infinityfloat

any bound larger than infinity in modulus will be regarded as infinite.

stop_abs_pfloat

the required absolute and relative accuracies for the primal infeasibility.

stop_rel_pfloat

see stop_abs_p.

stop_abs_dfloat

the required absolute and relative accuracies for the dual infeasibility.

stop_rel_dfloat

see stop_abs_d.

stop_abs_cfloat

the required absolute and relative accuracies for the complementarity.

stop_rel_cfloat

see stop_abs_c.

perturb_hfloat

perturb_h will be added to the Hessian.

prfeasfloat

initial primal variables will not be closer than prfeas from their bounds.

dufeasfloat

initial dual variables will not be closer than dufeas from their bounds.

muzerofloat

the initial value of the barrier parameter. If muzero is not positive, it will be reset to an appropriate value.

taufloat

the weight attached to primal-dual infeasibility compared to complementa when assessing step acceptance.

gamma_cfloat

individual complementarities will not be allowed to be smaller than gamma_c times the average value.

gamma_ffloat

the average complementarity will not be allowed to be smaller than gamma_f times the primal/dual infeasibility.

reduce_infeasfloat

if the overall infeasibility of the problem is not reduced by at least a factor reduce_infeas over infeas_max iterations, the problem is flagged as infeasible (see infeas_max).

obj_unboundedfloat

if the objective function value is smaller than obj_unbounded, it will be flagged as unbounded from below.

potential_unboundedfloat

if W=0 and the potential function value is smaller than potential_unbounded \(\ast\) number of one-sided bounds, the analytic center will be flagged as unbounded.

identical_bounds_tolfloat

any pair of constraint bounds \((c_l,c_u)\) or \((x_l,x_u)\) that are closer than identical_bounds_tol will be reset to the average of their values.

mu_pouncefloat

start terminal extrapolation when mu reaches mu_pounce.

indicator_tol_pfloat

if indicator_type = 1, a constraint/bound will be deemed to be active if and only if the distance to its nearest bound <= indicator_p_tol.

indicator_tol_pdfloat

if indicator_type = 2, a constraint/bound will be deemed to be active if and only if the distance to its nearest bound <= indicator_tol_pd * size of corresponding multiplier.

indicator_tol_tapiafloat

if indicator_type = 3, a constraint/bound will be deemed to be active if and only if the distance to its nearest bound <= indicator_tol_tapia * distance to same bound at previous iteration.

cpu_time_limitfloat

the maximum CPU time allowed (-ve means infinite).

clock_time_limitfloat

the maximum elapsed clock time allowed (-ve means infinite).

remove_dependenciesbool

the equality constraints will be preprocessed to remove any linear dependencies if True.

treat_zero_bounds_as_generalbool

any problem bound with the value zero will be treated as if it were a general value if True.

treat_separable_as_generalbool

if just_feasible is True, the algorithm will stop as soon as a feasible point is found. Otherwise, the optimal solution to the problem will be found.

just_feasiblebool

if treat_separable_as_general, is True, any separability in the problem structure will be ignored.

getduabool

if getdua, is True, advanced initial values are obtained for the dual variables.

puiseuxbool

decide between Puiseux and Taylor series approximations to the arc.

every_orderbool

try every order of series up to series_order?.

feasolbool

if feasol is True, the final solution obtained will be perturbed so that variables close to their bounds are moved onto these bounds.

balance_initial_complentaritybool

if balance_initial_complentarity is True, the initial complemetarity is required to be balanced.

crossoverbool

if crossover is True, cross over the solution to one defined by linearly-independent constraints if possible.

space_criticalbool

if space_critical is True, every effort will be made to use as little space as possible. This may result in longer computation time.

deallocate_error_fatalbool

if deallocate_error_fatal is True, any array/pointer deallocation error will terminate execution. Otherwise, computation will continue.

generate_sif_filebool

if generate_sif_file is True, a SIF file describing the current problem is to be generated.

generate_qplib_filebool

if generate_qplib_file is True, a QPLIB file describing the current problem is to be generated.

sif_file_namestr

name of generated SIF file containing input problem.

qplib_file_namestr

name of generated QPLIB file containing input problem.

prefixstr

all output lines will be prefixed by the string contained in quotes within prefix, e.g. ‘word’ (note the qutoes) will result in the prefix word.

fdc_optionsdict

default control options for FDC (see fdc.initialize).

sbls_optionsdict

default control options for SBLS (see sbls.initialize).

fit_optionsdict

default control options for FIT (see fit.initialize).

roots_optionsdict

default control options for ROOTS (see roots.initialize).

cro_optionsdict

default control options for CRO (see cro.initialize).

bqpb.load(n, H_type, H_ne, H_row, H_col, H_ptr, options=None)#

Import problem data into internal storage prior to solution.

Parameters:

nint

holds the number of variables.

H_typestring

specifies the symmetric storage scheme used for the Hessian \(H\). It should be one of ‘coordinate’, ‘sparse_by_rows’, ‘dense’, ‘diagonal’, ‘scaled_identity’, ‘identity’, ‘zero’ or ‘none’; lower or upper case variants are allowed.

H_neint

holds the number of entries in the lower triangular part of \(H\) in the sparse co-ordinate storage scheme. It need not be set for any of the other schemes.

H_rowndarray(H_ne)

holds the row indices of the lower triangular part of \(H\) in the sparse co-ordinate storage scheme. It need not be set for any of the other schemes, and in this case can be None.

H_colndarray(H_ne)

holds the column indices of the lower triangular part of \(H\) in either the sparse co-ordinate, or the sparse row-wise storage scheme. It need not be set when the other storage schemes are used, and in this case can be None.

H_ptrndarray(n+1)

holds the starting position of each row of the lower triangular part of \(H\), as well as the total number of entries, in the sparse row-wise storage scheme. It need not be set when the other schemes are used, and in this case can be None.

optionsdict, optional

dictionary of control options (see bqpb.initialize).

bqpb.solve_qp(n, f, g, H_ne, H_val, x_l, x_u, x, z)#

Find a solution to the bound-constrained convex quadratic program involving the quadratic objective function \(q(x)\).

Parameters:

nint

holds the number of variables.

ffloat

holds the constant term \(f\) in the objective function.

gndarray(n)

holds the values of the linear term \(g\) in the objective function.

H_neint

holds the number of entries in the lower triangular part of the Hessian \(H\).

H_valndarray(H_ne)

holds the values of the nonzeros in the lower triangle of the Hessian \(H\) in the same order as specified in the sparsity pattern in bqpb.load.

x_lndarray(n)

holds the values of the lower bounds \(x_l\) on the variables. The lower bound on any component of \(x\) that is unbounded from below should be set no larger than minus options.infinity.

x_undarray(n)

holds the values of the upper bounds \(x_l\) on the variables. The upper bound on any component of \(x\) that is unbounded from above should be set no smaller than options.infinity.

xndarray(n)

holds the initial estimate of the minimizer \(x\), if known. This is not crucial, and if no suitable value is known, then any value, such as \(x=0\), suffices and will be adjusted accordingly.

zndarray(n)

holds the initial estimate of the dual variables \(z\) associated with the simple bound constraints, if known. This is not crucial, and if no suitable value is known, then any value, such as \(z=0\), suffices and will be adjusted accordingly.

Returns:

xndarray(n)

holds the values of the approximate minimizer \(x\) after a successful call.

zndarray(n)

holds the values of the dual variables associated with the simple bound constraints.

x_statndarray(n)

holds the return status for each variable. The i-th component will be negative if the \(i\)-th variable lies on its lower bound, positive if it lies on its upper bound, and zero if it lies between bounds.

bqpb.solve_sldqp(n, f, g, w, x0, x_l, x_u, x, z)#

Find a solution to the bound-constrained convex quadratic program involving the shifted least-distance objective function \(s(x)\).

Parameters:

nint

holds the number of variables.

ffloat

holds the constant term \(f\) in the objective function.

gndarray(n)

holds the values of the linear term \(g\) in the objective function.

wndarray(n)

holds the values of the weights \(w\) in the objective function.

x0ndarray(n)

holds the values of the shifts \(x^0\) in the objective function.

x_lndarray(n)

holds the values of the lower bounds \(x_l\) on the variables. The lower bound on any component of \(x\) that is unbounded from below should be set no larger than minus options.infinity.

x_undarray(n)

holds the values of the upper bounds \(x_l\) on the variables. The upper bound on any component of \(x\) that is unbounded from above should be set no smaller than options.infinity.

xndarray(n)

holds the initial estimate of the minimizer \(x\), if known. This is not crucial, and if no suitable value is known, then any value, such as \(x=0\), suffices and will be adjusted accordingly.

zndarray(n)

holds the initial estimate of the dual variables \(z\) associated with the simple bound constraints, if known. This is not crucial, and if no suitable value is known, then any value, such as \(z=0\), suffices and will be adjusted accordingly.

Returns:

xndarray(n)

holds the values of the approximate minimizer \(x\) after a successful call.

zndarray(n)

holds the values of the dual variables associated with the simple bound constraints.

x_statndarray(n)

holds the return status for each variable. The i-th component will be negative if the \(i\)-th variable lies on its lower bound, positive if it lies on its upper bound, and zero if it lies between bounds.

[optional] bqpb.information()

Provide optional output information

Returns:

informdict
dictionary containing output information:
statusint

return status. Possible values are:

  • 0

    The run was successful.

  • -1

    An allocation error occurred. A message indicating the offending array is written on unit options[‘error’], and the returned allocation status and a string containing the name of the offending array are held in inform[‘alloc_status’] and inform[‘bad_alloc’] respectively.

  • -2

    A deallocation error occurred. A message indicating the offending array is written on unit options[‘error’] and the returned allocation status and a string containing the name of the offending array are held in inform[‘alloc_status’] and inform[‘bad_alloc’] respectively.

  • -3

    The restriction n > 0 or m > 0 or requirement that type contains its relevant string ‘dense’, ‘coordinate’, ‘sparse_by_rows’, ‘diagonal’, ‘scaled_identity’, ‘identity’, ‘zero’ or ‘none’ has been violated.

  • -4

    The bound constraints are inconsistent.

  • -7

    The objective function appears to be unbounded from below on the feasible set.

  • -9

    The analysis phase of the factorization failed; the return status from the factorization package is given by inform[‘factor_status’].

  • -10

    The factorization failed; the return status from the factorization package is given by inform[‘factor_status’].

  • -11

    The solution of a set of linear equations using factors from the factorization package failed; the return status from the factorization package is given by inform[‘factor_status’].

  • -16

    The problem is so ill-conditioned that further progress is impossible.

  • -18

    Too many iterations have been performed. This may happen if options[‘maxit’] is too small, but may also be symptomatic of a badly scaled problem.

  • -19

    The CPU time limit has been reached. This may happen if options[‘cpu_time_limit’] is too small, but may also be symptomatic of a badly scaled problem.

  • -20

    The Hessian \(H\) appears to be indefinite.

  • -23

    An entry from the strict upper triangle of \(H\) has been specified.

alloc_statusint

the status of the last attempted allocation/deallocation.

bad_allocstr

the name of the array for which an allocation/deallocation error occurred.

iterint

the total number of iterations required.

factorization_statusint

the return status from the factorization.

factorization_integerlong

the total integer workspace required for the factorization.

factorization_reallong

the total real workspace required for the factorization.

nfactsint

the total number of factorizations performed.

nbactsint

the total number of “wasted” function evaluations during the linesearch.

threadsint

the number of threads used.

objfloat

the value of the objective function at the best estimate of the solution determined by BQPB_solve.

primal_infeasibilityfloat

the value of the primal infeasibility.

dual_infeasibilityfloat

the value of the dual infeasibility.

complementary_slacknessfloat

the value of the complementary slackness.

init_primal_infeasibilityfloat

these values at the initial point (needed by GALAHAD_CCQP).

init_dual_infeasibilityfloat

see init_primal_infeasibility.

init_complementary_slacknessfloat

see init_primal_infeasibility.

potentialfloat

the value of the logarithmic potential function sum -log(distance to constraint boundary).

non_negligible_pivotfloat

the smallest pivot which was not judged to be zero when detecting linear dependent constraints.

feasiblebool

is the returned “solution” feasible?.

checkpointsIterint

checkpointsIter(i) records the iteration at which the criticality measures first fall below \(10^{-i-1}\), i = 0, .., 15 (-1 means not achieved).

checkpointsTimefloat

checkpointsIter(i) records the time at which the criticality measures first fall below \(10^{-i-1}\), i = 0, .., 15 (-1 means not achieved).

timedict
dictionary containing timing information:
totalfloat

the total CPU time spent in the package.

preprocessfloat

the CPU time spent preprocessing the problem.

find_dependentfloat

the CPU time spent detecting linear dependencies.

analysefloat

the CPU time spent analysing the required matrices prior to factorization.

factorizefloat

the CPU time spent factorizing the required matrices.

solvefloat

the CPU time spent computing the search direction.

clock_totalfloat

the total clock time spent in the package.

clock_preprocessfloat

the clock time spent preprocessing the problem.

clock_find_dependentfloat

the clock time spent detecting linear dependencies.

clock_analysefloat

the clock time spent analysing the required matrices prior to factorization.

clock_factorizefloat

the clock time spent factorizing the required matrices.

clock_solvefloat

the clock time spent computing the search direction.

fdc_informdict

inform parameters for FDC (see fdc.information).

sbls_informdict

inform parameters for SBLS (see sbls.information).

fit_informdict

return information from FIT (see fit.information).

roots_informdict

return information from ROOTS (see roots.information).

cro_informdict

inform parameters for CRO (see cro.information).

rpd_informdict

inform parameters for RPD (see rpd.information).

bqpb.terminate()#

Deallocate all internal private storage.

example code#

from galahad import bqpb
import numpy as np
np.set_printoptions(precision=4,suppress=True,floatmode='fixed')
print("\n** python test: bqpb")

# set parameters
n = 3
infinity = float("inf")

#  describe objective function

f = 1.0
g = np.array([0.0,2.0,0.0])
H_type = 'coordinate'
H_ne = 4
H_row = np.array([0,1,2,2])
H_col = np.array([0,1,1,2])
H_ptr = None
H_val = np.array([1.0,2.0,1.0,3.0])

#  describe constraints

x_l = np.array([-1.0,-infinity,-infinity])
x_u = np.array([1.0,infinity,2.0])

# allocate internal data and set default options
options = bqpb.initialize()

# set some non-default options
options['print_level'] = 0
#print("options:", options)

# load data (and optionally non-default options)
bqpb.load(n, H_type, H_ne, H_row, H_col, H_ptr, options)

#  provide starting values (not crucial)

x = np.array([0.0,0.0,0.0])
y = np.array([0.0,0.0])
z = np.array([0.0,0.0,0.0])

# find optimum of qp
print("1st problem: solve qp")
x, z, x_stat \
  = bqpb.solve_qp(n, f, g, H_ne, H_val, x_l, x_u, x, z)
print(" x:",x)
print(" z:",z)
print(" x_stat:",x_stat)

# get information
inform = bqpb.information()
print(" f: %.4f" % inform['obj'])

# deallocate internal data

bqpb.terminate()

#  describe shifted-least-distance qp

w = np.array([1.0,1.0,1.0])
x0 = np.array([1.0,1.0,1.0])
H_type = 'shifted_least_distance'

# allocate internal data
bqpb.initialize()

# load data (and optionally non-default options)
bqpb.load(n, H_type, H_ne, H_row, H_col, H_ptr, options)

#  provide starting values (not crucial)

x = np.array([0.0,0.0,0.0])
z = np.array([0.0,0.0,0.0])

# find optimum of sldqp
print("\n 2nd problem: solve sldqp")
x, z, x_stat \
  = bqpb.solve_sldqp(n, f, g, w, x0, x_l, x_u, x, z)
print(" x:",x)
print(" z:",z)
print(" x_stat:",x_stat)

# get information
inform = bqpb.information()
print(" f: %.4f" % inform['obj'])
print('** bqpb exit status:', inform['status'])

# deallocate internal data

bqpb.terminate()

This example code is available in $GALAHAD/src/bqpb/Python/test_bqpb.py .