ryantibs / quantgen

Tools for generalized quantile modeling
https://ryantibs.github.io/quantgen
14 stars 9 forks source link

LP within `get_lambda_max` (silently) fails converge to a solution #27

Open huisaddison opened 1 year ago

huisaddison commented 1 year ago

Reproducing example:

library(quantgen)

set.seed(1)
n = 100
p = 30
d = get_diff_mat(p, 3)

X = matrix(rnorm(n*p), nrow=n)
y = rnorm(n)

get_lambda_max(X, y, d=d) # Returns 72.50772

get_lambda_max(X, y, d=d, lp_solver='gurobi') # Returns NULL

If one inspects the returned solution object a following the lines https://github.com/ryantibs/quantgen/blob/59718548fd6b327b5f1870f9c86fb079cc500b70/quantgen/R/quantile_genlasso.R#L557-L573 one will find that with GLPK,

Called from: get_lambda_max(X, y, d = d)
Browse[1]> print(a$status)
[1] 1

and with Gurobi,

Called from: get_lambda_max(X, y, d = d, lp_solver = "gurobi")
Browse[1]> print(a$status)
[1] "INFEASIBLE"

The failure is more obvious under Gurobi because the solution will be NULL, whereas with Rglpk the supposed solution is the final iterate before it quits.

Thanks @jeremy-goldwasser for catching this

huisaddison commented 1 year ago

Next steps:

huisaddison commented 1 year ago

Just adding some notes to this so we don't forget (last discussed on 22-Dec-2022):