Reference

Contents

Index

QuadraticModels.QuadraticModelType
qp = QuadraticModel(c, Hrows, Hcols, Hvals; Arows = Arows, Acols = Acols, Avals = Avals, 
                    lcon = lcon, ucon = ucon, lvar = lvar, uvar = uvar, sortcols = false)

qp = QuadraticModel(c, H; A = A, lcon = lcon, ucon = ucon, lvar = lvar, uvar = uvar)

Create a Quadratic model $min ~\tfrac{1}{2} x^T H x + c^T x + c_0$ with optional bounds lvar ≦ x ≦ uvar and optional linear constraints lcon ≦ Ax ≦ ucon. The user should only give the lower triangle of H to the QuadraticModel constructor.

With the first constructor, if sortcols = true, then Hcols and Acols are sorted in ascending order (Hrows, Hvals and Arows, Avals are then sorted accordingly).

You can also use QPSReader.jl to create a Quadratic model from a QPS file:

using QPSReader
qps = readqps("QAFIRO.SIF")
qp = QuadraticModel(qps)

The instance of QuadraticModel{T, S, D} created contains the fields:

Using NLPModelsModifiers.SlackModel from NLPModelsModifiers.jl with a QuadraticModel based on a QPData with dense matrices will convert the field data to a QPData with SparseMatricesCOO.

Its in-place variant SlackModel! specific to QuadraticModels will only work with a QuadraticModel based on a QPData with SparseMatricesCOO.

source
QuadraticModels.postsolveMethod
sol = postsolve(qm::QuadraticModel{T, S}, psqm::PresolvedQuadraticModel{T, S}, 
                sol_in::QMSolution{S}) where {T, S}

Retrieve the solution sol = (x, y, s_l, s_u) of the original QP qm given the solution of the presolved QP (psqm) sol_in of type QMSolution. sol_in.s_l and sol_in.s_u can be sparse or dense vectors, but the output sol.s_l and sol.s_u are dense vectors.

source
QuadraticModels.presolveMethod
stats_ps = presolve(qm::QuadraticModel{T, S}; fixed_vars_only = false, kwargs...)

Apply a presolve routine to qm and returns a GenericExecutionStats from the package SolverCore.jl. The presolve operations currently implemented are:

  • remove empty rows
  • remove singleton rows
  • fix linearly unconstrained variables (lps)
  • remove free linear singleton columns whose associated variable does not appear in the hessian
  • remove fixed variables

The PresolvedQuadraticModel{T, S} <: AbstractQuadraticModel{T, S} is located in the solver_specific field:

psqm = stats_ps.solver_specific[:presolvedQM]

and should be used to call postsolve. Use fixed_vars_only = true if you only want to remove fixed variables. Maximization problems are transformed to minimization problems. If you need the objective of a presolved maximization problem, make sure to take the opposite of the objective of the presolved problem.

If the presolved problem has 0 variables, stats_ps.solution contains a solution of the primal problem, stats_ps.multipliers is a zero SparseVector, and, if we define

s = qm.data.c + qm.data.H * stats_ps.solution

stats_ps.multipliers_L is the positive part of s and stats_ps.multipliers_U is the opposite of the negative part of s. The presolve operations are inspired from MathOptPresolve.jl, and from:

source