From b972409cc859a02058af816dbaf78fd915ab3f3d Mon Sep 17 00:00:00 2001 From: cyw Date: Wed, 25 Dec 2024 15:49:18 -0500 Subject: [PATCH] update of README --- Project.toml | 2 -- README.md | 63 ++++++++++++++++++++++++++++++++++------------------ 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/Project.toml b/Project.toml index d721ed9..b896543 100644 --- a/Project.toml +++ b/Project.toml @@ -6,8 +6,6 @@ version = "0.9.0" [deps] AMD = "14f7f29c-3bd6-536c-9a0b-7339e30b5a3e" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" -ClarabelBenchmarks = "086be79b-982c-4ee0-9f3a-5052a7be4b8e" -ClarabelRs = "a0c58a0a-712c-48b7-9fd4-64369ecb2011" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" GenericLinearAlgebra = "14197337-ba66-59df-a3e3-ca00e7dcff7a" HSL = "34c5aeac-e683-54a6-a0e9-6e0fdc586c50" diff --git a/README.md b/README.md index 348da30..fd0573f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Clarabel.jl logo

-Interior Point Conic Optimization for Julia +GPU implementation of Clarabel solver for Julia

@@ -22,7 +22,7 @@ Interior Point Conic Optimization for Julia Documentation

-__Clarabel.jl__ is a Julia implementation of an interior point numerical solver for convex optimization problems using a novel homogeneous embedding. Clarabel.jl solves the following problem: +__clarabel-gpu.jl__ is the GPU implementation of the Clarabel solver, which can solve conic problems of the following form: $$ \begin{array}{r} @@ -40,35 +40,54 @@ $P=P^\top \succeq 0$, $q \in \mathbb{R}^n$, $A \in \mathbb{R}^{m \times n}$, and $b \in \mathbb{R}^m$. -The convex set $\mathcal{K}$ is a composition of convex cones. +The convex set $\mathcal{K}$ is a composition of convex cones, including zero cones (linear equality constraints), nonnegative cones (linear inequality constraints), second-order cones, exponential cone and power cones. It relies on the external package [CUDSS.jl](https://github.com/exanauts/CUDSS.jl) for the linear system solver [CUDSS](https://developer.nvidia.com/cudss). -__For more information see the Clarabel Documentation ([stable](https://oxfordcontrol.github.io/ClarabelDocs/stable) | [dev](https://oxfordcontrol.github.io/ClarabelDocs/dev)).__ +## Installation +- __clarabel-gpu.jl__ can be added via the Julia package manager (type `]`): `pkg> dev https://github.com/cvxgrp/clarabel-gpu.git`, (which will overwrite current use of Clarabel solver). -Clarabel is also available in a Rust implementation with additional language interfaces. See [here](https://github.com/oxfordcontrol/Clarabel.rs). +## Tutorial +Modelling a conic optimization problem is the same as in original [Clarabel solver](https://clarabel.org/stable/) except setting the parameter `direct_solve_method` to `:cudss` or `:cudssmixed`. Here is a portfolio optimization problem modelled via JuMP: +``` +using LinearAlgebra, SparseArrays, Random, JuMP +using Clarabel -## Features +## generate the data +rng = Random.MersenneTwister(1) +k = 5; # number of factors +n = k * 10; # number of assets +D = spdiagm(0 => rand(rng, n) .* sqrt(k)) +F = sprandn(rng, n, k, 0.5); # factor loading matrix +μ = (3 .+ 9. * rand(rng, n)) / 100. # expected returns between 3% - 12% +γ = 1.0; # risk aversion parameter +d = 1 # we are starting from all cash +x0 = zeros(n); -* __Versatile__: Clarabel.jl solves linear programs (LPs), quadratic programs (QPs), second-order cone programs (SOCPs) and semidefinite programs (SDPs). It also solves problems with exponential, power cone and generalized power cone constraints. -* __Quadratic objectives__: Unlike interior point solvers based on the standard homogeneous self-dual embedding (HSDE), Clarabel.jl handles quadratic objectives without requiring any epigraphical reformulation of the objective. It can therefore be significantly faster than other HSDE-based solvers for problems with quadratic objective functions. -* __Infeasibility detection__: Infeasible problems are detected using a homogeneous embedding technique. -* __JuMP / Convex.jl support__: We provide an interface to [MathOptInterface](https://jump.dev/JuMP.jl/stable/moi/) (MOI), which allows you to describe your problem in [JuMP](https://github.com/jump-dev/JuMP.jl) and [Convex.jl](https://github.com/jump-dev/Convex.jl). -* __Arbitrary precision types__: You can solve problems with any floating point precision, for example, Float32 or Julia's BigFloat type, using either the native interface, or via MathOptInterface / Convex.jl. -* __Open Source__: Our code is available on [GitHub](https://github.com/oxfordcontrol/Clarabel.jl) and distributed under the Apache 2.0 License +a = 1e-3 +b = 1e-1 +γ = 1.0; -## Installation -- __Clarabel.jl__ can be added via the Julia package manager (type `]`): `pkg> add Clarabel` +model = JuMP.Model(Clarabel.Optimizer) +set_optimizer_attribute(model, "direct_solve_method", :cudss) + +@variable(model, x[1:n]) +@variable(model, y[1:k]) +@variable(model, s[1:n]) +@variable(model, t[1:n]) +@objective(model, Min, x' * D * x + y' * y - 1/γ * μ' * x); +@constraint(model, y .== F' * x); +@constraint(model, x .>= 0); + +# transaction costs +@constraint(model, sum(x) + a * sum(s) == d + sum(x0) ); +@constraint(model, [i = 1:n], x0[i] - x[i] == t[i]) +@constraint(model, [i = 1:n], [s[i], t[i]] in MOI.SecondOrderCone(2)); +JuMP.optimize!(model) +``` ## Citing ``` -@misc{Clarabel_2024, - title={Clarabel: An interior-point solver for conic programs with quadratic objectives}, - author={Paul J. Goulart and Yuwen Chen}, - year={2024}, - eprint={2405.12762}, - archivePrefix={arXiv}, - primaryClass={math.OC} -} +Coming out soon ``` ## License 🔍