Reference
Contents
Index
QuadraticModels.QuadraticModel
QuadraticModels.QuadraticModel
QuadraticModels.empty_rows!
QuadraticModels.postsolve
QuadraticModels.presolve
QuadraticModels.remove_ifix!
QuadraticModels.singleton_rows!
QuadraticModels.QuadraticModel
— Typeqp = 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:
meta
of typeNLPModels.NLPModelMeta
fromNLPModels.jl
,data
, of typeQuadraticModels.QPData
depending on the input types of theA
andH
matrices.counters
of typeNLPModels.Counters
fromNLPModels.jl
.
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.
QuadraticModels.QuadraticModel
— MethodQuadraticModel(nlp, x)
Creates a quadratic Taylor model of nlp
around x
.
QuadraticModels.empty_rows!
— Methodnew_ncon = empty_rows!(Arows, lcon, ucon, ncon, row_cnt, empty_rows, Arows_s)
Removes the empty rows of A, and the corresponding elements in lcon and ucon that are in empty_rows
. Arows_s
is a view of Arows
sorted in ascending order. row_cnt
is a vector of the number of elements per row.
Returns the new number of constraints new_ncon
and updates in-place Arows
, lcon
, ucon
.
QuadraticModels.postsolve
— Methodx, y, s_l, s_u = postsolve(qm::QuadraticModel{T, S}, psqm::PresolvedQuadraticModel{T, S},
x_in::S, y_in::S,
s_l_in::SparseVector{T, Int},
s_u_in::SparseVector{T, Int}) where {T, S}
Retrieve the solution x, y, s_l, s_u
of the original QP qm
given the solution of the presolved QP (psqm
) x_in, y_in, s_l_in, s_u_in
.
QuadraticModels.presolve
— Methodstats_ps = presolve(qm::QuadraticModel{T, S}; kwargs...)
Apply a presolve routine to qm
and returns a GenericExecutionStats
from the package SolverCore.jl
. The presolve operations currently implemented are:
empty_rows!
: remove empty rowssingleton_rows!
: remove singleton rowsremove_ifix!
: 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
.
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
.
QuadraticModels.remove_ifix!
— Methodxrm, c0ps, nvarrm = remove_ifix!(ifix, Hrows, Hcols, Hvals, nvar,
Arows, Acols, Avals, c, c0,
lvar, uvar, lcon, ucon)
Remove rows and columns in H, columns in A, and elements in lcon and ucon corresponding to fixed variables, that are in ifix
(They should be the indices i
where lvar[i] == uvar[i]
).
Returns the removed elements of lvar
(or uvar
), the constant term in the QP objective c0ps
resulting from the fixed variables, and the new number of variables nvarrm
. Hrows
, Hcols
, Hvals
, Arows
, Acols
, Avals
, c
, lvar
, uvar
, lcon
and ucon
are updated in-place.
QuadraticModels.singleton_rows!
— Methodnew_ncon = singleton_rows!(Arows, Acols, Avals, lcon, ucon,
lvar, uvar, nvar, ncon, row_cnt, singl_rows)
Removes the singleton rows of A, and the corresponding elements in lcon and ucon that are in singl_rows
. row_cnt
is a vector of the number of elements per row.
Returns the new number of constraints new_ncon
and updates in-place Arows
, Acols
, Avals
, lcon
, ucon
, lvar
, uvar
.