Code Monkey home page Code Monkey logo

generalqp.jl's Introduction

GeneralQP.jl

This package is a Julia implementation of the following paper

Gill, Philip E., and Walter Murray.
Numerically stable methods for quadratic programming.
Mathematical programming 14.1 (1978): 349-372.

i.e. an inertia-controlling active-set solver for general (definite/indefinite) dense quadratic programs

minimize    ½x'Px + q'x
subject to  Ax ≤ b

given an initial feasible point x_init.

To avoid further restrictions on the initial point, an artificial constraints approach is taken as described in QPOPT's 1.0 User manual, Section 3.2.

Installation

The solver can be installed by running

add https://github.com/oxfordcontrol/GeneralQP.jl

in Julia's Pkg REPL mode.

Usage

The solver can be used by calling the function

solve(P, q, A, b, x_init; kwargs) -> x

with inputs (T is any real numerical type):

  • P::Matrix{T}: the quadratic cost;
  • q::Vector{T}: the linear cost;
  • A::Matrix{T} and b::AbstractVector{T}: the constraints; and
  • x_init::Vector{T}: the initial, feasible point

keywords (optional):

  • max_iter::Int=5000 Maximum number of iterations.
  • verbosity::Int=1 the verbosity of the solver ranging from 0 (no output) to 2 (most verbose). Note that setting verbosity=2 affects the algorithm's performance.
  • printing_interval::Int=50.
  • r_max::T=Inf Maximum radius. The algorithm terminates if ‖x‖ ≥ r with a return solution of ‖x‖ = r. This is particularly useful for unbounded problems.

and output x::Vector{T}, the calculated optimizer.

Updatable factorizations

This package includes UpdatableQR, an updatable QR factorization F of a "thin" n x m matrix

X = F.Q*F.R

that allows efficient O(n^2) update of the factors when adding/removing rows in the matrix X. This is critical for efficient execution of (dense) active-set algorithms.

These updates can be simply performed using

add_column!(F::UpdatableQR{T}, a::AbstractVector{T})
remove_column!(F::UpdatableQR{T}, idx::Int).

Similarly, UpdatableHessianLDL provides an updatable LDLt factorization for the projection of the hessian P on the nullspace of the working constraints.

UpdatableHessianLDL is based on UpdatableQR and implements functionality for artificial constraints (QPOPT 1.0 Manual, Section 3.2).

Obtaining an initial feasible point

An initial feasible point can be obtained e.g. by performing Phase-I Simplex on the polyhedron Ax ≤ b:

using JuMP, Gurobi
# Choose Gurobi's primal simplex method
model = Model(solver=GurobiSolver(Presolve=0, Method=0))
@variable(model, x[1:size(A, 2)])
@constraint(model, A*x - b .<=0)
status = JuMP.solve(model)

x_init = getvalue(x)  # Initial point to be passed to our solver

generalqp.jl's People

Contributors

nrontsis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

b4rtdc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.