Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.6 #54

Merged
merged 59 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ba28379
add generalized power cones, but haven't debugged it yet
yuwenchen95 Aug 7, 2023
0716833
genpow draft
yuwenchen95 Aug 11, 2023
457e603
fix LP style initialization (#41)
goulart-paul Aug 30, 2023
5a932ce
faster convergence for equality constrained problems (#42)
goulart-paul Aug 30, 2023
278ea33
Update LICENSE.md (#39)
tschm Aug 30, 2023
5064854
Adds additional documentation, examples and user utilities (#43)
goulart-paul Aug 30, 2023
23e36b4
Enable print of internal timers through the Julia wrapper (#44)
goulart-paul Aug 30, 2023
4319ea5
update cargo keywords (#45)
goulart-paul Aug 30, 2023
6e83238
Provides utility for making allocated cscmatrix from an adjoint. (#46)
goulart-paul Aug 30, 2023
69bc6dc
simplify relative error gap calc (#48)
goulart-paul Aug 31, 2023
f6de6a9
fix build failures.
goulart-paul Sep 1, 2023
04c2fd8
fix Julia porting error
goulart-paul Sep 2, 2023
fb55eb4
add generalized power cones, but haven't debugged it yet
yuwenchen95 Aug 7, 2023
315c4e0
genpow draft
yuwenchen95 Aug 11, 2023
df75069
fix build failures.
goulart-paul Sep 1, 2023
70c5f89
Merge branch 'yc/genpow' of https://github.com/oxfordcontrol/Clarabel…
goulart-paul Sep 3, 2023
d77704c
feature-genpowcone
goulart-paul Sep 4, 2023
5983b70
reorganize nonsym cone traits
goulart-paul Sep 4, 2023
5f7a080
add itertools
goulart-paul Sep 4, 2023
4bb1fa0
Julia porting fixes
goulart-paul Sep 5, 2023
ab31f32
add genpow test
goulart-paul Sep 5, 2023
4545290
update NR method
goulart-paul Sep 5, 2023
d0f2948
bug fix
goulart-paul Sep 5, 2023
76892d8
adds cone method. adds extra work field to GPC
goulart-paul Sep 5, 2023
738c526
spacing
goulart-paul Sep 5, 2023
6336a65
simplify implementation of Hs_is_diagonal
goulart-paul Sep 5, 2023
6355cb1
sync Julia nonsym cones
goulart-paul Sep 5, 2023
e13436d
reduce wright omega iterations
goulart-paul Sep 5, 2023
5a167d5
clippy appeasement
goulart-paul Sep 5, 2023
5877804
rewrite of KKT assembly and cone data mappings
goulart-paul Sep 7, 2023
181b1ce
rustification
goulart-paul Sep 8, 2023
a2802ab
rustification
goulart-paul Sep 8, 2023
d53ca91
fix identity init for SOCs
goulart-paul Sep 10, 2023
da1e8a3
julia impl sync
goulart-paul Sep 13, 2023
1991322
julia sync
goulart-paul Sep 13, 2023
72efa20
Merge branch 'develop' into feature-genpowcone
goulart-paul Sep 13, 2023
7751c9b
port dense SOC cones
goulart-paul Sep 14, 2023
4387dde
composite expansion is unreachable
goulart-paul Sep 14, 2023
1df1619
WIP: for arc test
goulart-paul Sep 15, 2023
7068d53
stability improvements for dense SOC
goulart-paul Sep 17, 2023
178bf28
Adds generalized power cone (#50)
goulart-paul Sep 17, 2023
4ef8cb3
merge dense alt_soc
goulart-paul Sep 17, 2023
e56ba48
remove alloc from solution finalize
goulart-paul Sep 17, 2023
21ed369
fix unit tests
goulart-paul Sep 17, 2023
940ab04
Merge branch 'develop' into pg/finalize_without_alloc
goulart-paul Sep 18, 2023
50e5622
genpowcone support for julia wrapper
goulart-paul Sep 18, 2023
5a6bcfe
genpowcone support for python wrapper
goulart-paul Sep 18, 2023
5995391
Merge pull request #52 from oxfordcontrol/pg/ffi_genpow
goulart-paul Sep 18, 2023
2c8a4eb
doc update
goulart-paul Sep 19, 2023
5d45267
qdldl error handling
goulart-paul Sep 20, 2023
68b2605
Merge pull request #53 from oxfordcontrol/pg/qdldl_errors
goulart-paul Sep 20, 2023
eac0891
update qdldl docstrings
goulart-paul Sep 20, 2023
f4e4260
fix bad assert
goulart-paul Sep 20, 2023
b2f97c4
bump version
goulart-paul Sep 20, 2023
052414d
bump version
goulart-paul Sep 20, 2023
62a2af6
Update CHANGELOG.md
goulart-paul Sep 20, 2023
ba6ee8f
Update CHANGELOG.md
goulart-paul Sep 20, 2023
606500d
Merge branch 'main' into release-v0.6
goulart-paul Sep 20, 2023
2b794ec
update feature list
goulart-paul Sep 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Version numbering in this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). We aim to keep the core solver functionality and minor releases in sync between the Rust/Python and Julia implementations. Small fixes that affect one implementation only may result in the patch release versions differing.


## [0.6.0] - 2023-20-09
### Changed

This version introduces support for the generalized power cone and implements stability and speed improvements for SOC problems. SOCs with
dimension less than or equal to 4 are now treated as special cases with dense Hessian blocks.

- Introduces support for the generalized power cone.
- Implements stability and speed improvements for SOC problems. SOCs with dimension less than or equal to 4 are now treated as special cases with dense Hessian blocks.
- Fixes bad initialization point for non-quadratic objectives
- Improved convergence speed for QPs with no constraints or only ZeroCone constraints.
- Internal code restructuring for cones with sparsifiable Hessian blocks.

### Rust specific changes
- Added additional documentation and utilities [#43](https://github.com/oxfordcontrol/Clarabel.rs/issues/43),[#46](https://github.com/oxfordcontrol/Clarabel.rs/issues/46).
- Allow printing of internal timers through Julia wrappers in ClarabelRs [#44](https://github.com/oxfordcontrol/Clarabel.rs/issues/44)
- Updated keywords for crates.io [#45](https://github.com/oxfordcontrol/Clarabel.rs/issues/45)
- Better error reporting from internal QDLDL factor methods. Fixes [#49](https://github.com/oxfordcontrol/Clarabel.rs/issues/49)


## [0.5.1] - 2023-02-06
### Changed
Fixes convergence edge case in KKT direct solve iterative refinement.
Expand Down Expand Up @@ -79,6 +99,7 @@ offline against the Julia-based benchmark problem suite, but this will not appea
- Ported all documentation to the common site [here](https://github.com/oxfordcontrol/ClarabelDocs)


[0.6.0]: https://github.com/oxfordcontrol/Clarabel.rs/compare/v0.5.1...v0.6.0
[0.5.1]: https://github.com/oxfordcontrol/Clarabel.rs/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/oxfordcontrol/Clarabel.rs/compare/v0.4.1...v0.5.0
[0.4.1]: https://github.com/oxfordcontrol/Clarabel.rs/compare/v0.4.0...v0.4.1
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "clarabel"
version = "0.5.1"
version = "0.6.0"
authors = ["Paul Goulart <[email protected]>"]
edition = "2021"
rust-version = "1.60"
license = "Apache-2.0"
description = "Clarabel Conic Interior Point Solver for Rust / Python"
readme = "README.md"
repository = "https://github.com/oxfordcontrol/Clarabel.rs"
keywords = ["convex", "optimization", "QP", "SOCP", "SDP"]
keywords = ["convex", "optimization", "conic", "solver", "linear-programming"]
categories = ["mathematics"]

#required for openssl to work on git actions
Expand All @@ -22,6 +22,7 @@ enum_dispatch = "0.3.8"
amd = "0.2.2"
thiserror = "1.0"
cfg-if = "1.0"
itertools = "0.11"

# -------------------------------
# features
Expand Down
13 changes: 1 addition & 12 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,7 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2022 University of Oxford Control Group

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Interior Point Conic Optimization for Rust and Python
<a href="https://codecov.io/gh/oxfordcontrol/Clarabel.rs"><img src="https://codecov.io/gh/oxfordcontrol/Clarabel.rs/branch/main/graph/badge.svg"></a>
<a href="https://oxfordcontrol.github.io/ClarabelDocs/stable"><img src="https://img.shields.io/badge/Documentation-stable-purple.svg"></a>
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
<a href="https://github.com/oxfordcontrol/Clarabel.rs/releases"><img src="https://img.shields.io/badge/Release-v0.5.1-blue.svg"></a>
<a href="https://github.com/oxfordcontrol/Clarabel.rs/releases"><img src="https://img.shields.io/badge/Release-v0.6.0-blue.svg"></a>
</p>

<p align="center">
Expand Down Expand Up @@ -47,7 +47,7 @@ Clarabel is also available in a Julia implementation. See [here](https://github

## Features

* __Versatile__: Clarabel.rs solves linear programs (LPs), quadratic programs (QPs), second-order cone programs (SOCPs) and semidefinite programs (SDPs). It also solves problems with exponential and power cone constraints.
* __Versatile__: Clarabel.rs 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.rs 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.
* __Open Source__: Our code is available on [GitHub](https://github.com/oxfordcontrol/Clarabel.rs) and distributed under the Apache 2.0 License
Expand Down
79 changes: 72 additions & 7 deletions src/algebra/csc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::iter::zip;
/// [2. 0. 6.]
/// [0. 4. 7.]
/// ```
///
/// ```no_run
/// use clarabel::algebra::CscMatrix;
///
Expand Down Expand Up @@ -70,20 +69,18 @@ where
J: IntoIterator<Item = &'a T>,
T: FloatT,
{
#[allow(clippy::needless_range_loop)]
fn from(rows: I) -> CscMatrix<T> {
let rows: Vec<Vec<T>> = rows
.into_iter()
.map(|r| r.into_iter().map(|&v| v).collect())
.map(|r| r.into_iter().copied().collect())
.collect();

let m = rows.len();
let n = rows.iter().map(|r| r.len()).next().unwrap_or(0);

assert!(rows.iter().all(|r| r.len() == n));
let nnz = rows
.iter()
.flat_map(|r| r)
.filter(|&&v| v != T::zero())
.count();
let nnz = rows.iter().flatten().filter(|&&v| v != T::zero()).count();

let mut colptr = Vec::with_capacity(n + 1);
let mut rowval = Vec::with_capacity(nnz);
Expand Down Expand Up @@ -363,6 +360,53 @@ impl<T> ShapedMatrix for CscMatrix<T> {
}
}

/// Make a concrete [CscMatrix] from its [Adjoint]. This operation will
/// allocate a new matrix and copy the data from the adjoint.
///
/// __Example usage__ : To construct the transpose of a 3 x 3 matrix:
/// ```text
/// A = [1., 0., 0.]
/// [2., 4., 0.]
/// [3., 5., 6.]
///```
/// ```no_run
/// use clarabel::algebra::CscMatrix;
///
/// let A : CscMatrix = (&[
/// [1., 0., 0.], //
/// [2., 4., 0.], //
/// [3., 5., 6.],
/// ]).into();
///
/// let At = A.t(); //Adjoint form. Does not copy anything.
///
/// let B : CscMatrix = At.into(); //Concrete form. Allocates and copies.
///
/// assert_eq!(A, B);
///
/// ```
impl<'a, T> From<Adjoint<'a, CscMatrix<T>>> for CscMatrix<T>
where
T: FloatT,
{
fn from(M: Adjoint<'a, CscMatrix<T>>) -> CscMatrix<T> {
let src = M.src;

let (m, n) = (src.n, src.m);
let mut A = CscMatrix::spalloc((m, n), src.nnz());

//make dummy mapping indices since we don't care
//where the entries go
let mut amap = vec![0usize; src.nnz()];

A.colcount_block(src, 0, MatrixShape::T);
A.colcount_to_colptr();
A.fill_block(src, &mut amap, 0, 0, MatrixShape::T);
A.backshift_colptrs();
A
}
}

#[test]
fn test_csc_from_slice_of_arrays() {
let A = CscMatrix::new(
Expand Down Expand Up @@ -418,3 +462,24 @@ fn test_csc_get_entry() {
assert_eq!(A.get_entry((4, 3)), None);
assert_eq!(A.get_entry((3, 4)), None);
}

#[test]
fn test_adjoint_into() {
let A: CscMatrix = (&[
[1., 0., 0.], //
[2., 4., 0.], //
[3., 5., 6.],
])
.into();

let T: CscMatrix = (&[
[1., 2., 3.], //
[0., 4., 5.], //
[0., 0., 6.],
])
.into();

let B: CscMatrix = A.t().into(); //Concrete form. Allocates and copies.

assert_eq!(B, T);
}
3 changes: 2 additions & 1 deletion src/algebra/dense/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub struct Matrix<T = f64> {
/// [0.0, 4.0]]);
// ```
//
#[allow(clippy::needless_range_loop)]
impl<'a, I, J, T> From<I> for Matrix<T>
where
I: IntoIterator<Item = J>,
Expand All @@ -51,7 +52,7 @@ where
fn from(rows: I) -> Matrix<T> {
let rows: Vec<Vec<T>> = rows
.into_iter()
.map(|r| r.into_iter().map(|&v| v).collect())
.map(|r| r.into_iter().copied().collect())
.collect();

let m = rows.len();
Expand Down
3 changes: 1 addition & 2 deletions src/algebra/floats.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(non_snake_case)]
use num_traits::{Float, FloatConst, FromPrimitive, NumAssign};
use std::fmt::{Debug, Display, LowerExp};

Expand Down Expand Up @@ -79,8 +80,6 @@ cfg_if::cfg_if! {
// NB: `AsFloatT` is a convenience trait for f32/64 and u32/64
// so that we can do things like (2.0).as_T() everywhere on
// constants, rather than the awful T::from_f32(2.0).unwrap()

#[allow(non_snake_case)]
pub trait AsFloatT<T>: 'static {
fn as_T(&self) -> T;
}
Expand Down
5 changes: 4 additions & 1 deletion src/algebra/math_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ pub trait VectorMath {
/// Standard Euclidian or 2-norm distance from `self` to `y`
fn dist(&self, y: &Self) -> Self::T;

/// Sum of elements squared.
/// Sum of elements.
fn sum(&self) -> Self::T;

/// Sum of squares of the elements.
fn sumsq(&self) -> Self::T;

/// 2-norm
Expand Down
7 changes: 6 additions & 1 deletion src/algebra/vecmath.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{FloatT, ScalarMath, VectorMath};
use itertools::izip;
use std::iter::zip;

impl<T: FloatT> VectorMath for [T] {
Expand Down Expand Up @@ -88,7 +89,7 @@ impl<T: FloatT> VectorMath for [T] {
assert_eq!(s.len(), ds.len());

let mut out = T::zero();
for ((&s, &ds), (&z, &dz)) in zip(zip(s, ds), zip(z, dz)) {
for (&s, &ds, &z, &dz) in izip!(s, ds, z, dz) {
let si = s + α * ds;
let zi = z + α * dz;
out += si * zi;
Expand All @@ -101,6 +102,10 @@ impl<T: FloatT> VectorMath for [T] {
T::sqrt(dist2)
}

fn sum(&self) -> T {
self.iter().fold(T::zero(), |acc, &x| acc + x)
}

fn sumsq(&self) -> T {
self.dot(self)
}
Expand Down
4 changes: 2 additions & 2 deletions src/julia/ClarabelRs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClarabelRs"
uuid = "a0c58a0a-712c-48b7-9fd4-64369ecb2011"
authors = ["Paul Goulart <[email protected]>"]
version = "0.5.1"
version = "0.6.0"

[deps]
Clarabel = "61c947e1-3e6d-4ee4-985a-eec8c727bd6e"
Expand All @@ -11,4 +11,4 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Clarabel = "0.5.1"
Clarabel = "0.6.0"
Loading
Loading