oxfordcontrol / clarabel-r

Interior Point Conic Optimization Solver
Other
10 stars 2 forks source link

Cone specification #5

Closed ben-schwen closed 4 months ago

ben-schwen commented 1 year ago

The doc mentions that it is allowed to specify cones in the following way

cone_spec <- list(z1 = 2L, l1 = 2L, q1 = 2L, zb = 3L, qx = 3L)

However, then sanitize_cone_spec will stop

cone_names <- names(cone_spec)
if (length(intersect(cone_names, c("z", "l", "q", "ep", "p"))) != length(cone_spec)) {
  stop("sanitize_cone_spec: unspecified cone parameters")
}

since intersect searches for full matches.

ben-schwen commented 1 year ago

As a second issue, for the same example once it does not stop it drops all second order cones q after the first one.

cone_spec <- list(z1 = 2L, l1 = 2L, q1 = 2L, zb = 3L, qx = 3L)
clarabel:::sanitize_cone_spec(cone_spec)
#> $z1
#> [1] 2
#> 
#> $l1
#> [1] 2
#> 
#> $q1
#> [1] 3
#> 
#> $zb
#> [1] 3

Hence, qx is missing

bnaras commented 1 year ago

Yes, thank you @ben-schwen . I discovered that too. I was trying to emulate scs interface, but I think that is not needed.

bnaras commented 1 year ago

@ben-schwen I've now released version 0.5.1 which also handles PSD cones. Interface similar to SCS. Also on this issue, I have clarified in the documentation about the cone documentation. I don't expect people to ever use the internal function sanitize_cone_spec except to ensure that the types passed to Rust are correct and the cones are arranged in the order as scs also requires. Please let me know if this is satisfactory or if I am missing anything.

bnaras commented 4 months ago

Closing this as completed.