conroylau / lpinfer

lpinfer: An R Package for Inference in Linear Programs
GNU General Public License v3.0
3 stars 5 forks source link

Estbounds error with 2 norm #44

Closed a-torgovitsky closed 4 years ago

a-torgovitsky commented 4 years ago

This works fine

r <- estbounds(data, lpm, solver = "gurobi", norm = 1) # ok

this

r <- estbounds(data, lpm, solver = "gurobi", norm = 2)

leads to

Error: model$quadcon[[i]]$q is NOT vector or sparseVector

Data is attached

debug.RData.zip

a-torgovitsky commented 4 years ago

This file has the betaobs function in it mixedlogit.R.zip

conroylau commented 4 years ago

Thanks! It looks like the error disappears when I use this new R file.

a-torgovitsky commented 4 years ago

I am still getting the error

conroylau commented 4 years ago

I am afraid that I am still unable to reproduce the error with the above data and code. The following is returned when I run the code:

Estimated bounds: [0.13121, 0.1371]

I went to check the vector in model$quadcon[[i]]$q and find that it is indeed a column matrix, so it looks like that it does not match with the error message.

a-torgovitsky commented 4 years ago

Hmm, I am still having the same error message. Please try running "debug-44.R" in the following zip file.

issue44.zip

conroylau commented 4 years ago

I am still not getting any error message. I tried upgrading my gurobi version from 8.1-1 to 9.0-2, and also tried running the code in RStudio and the original R console, but I am unable to get any error message. I am also getting the same bounds as in my earlier comment.

a-torgovitsky commented 4 years ago

I am also using Gurobi 9.0.2 and still had this problem.

I think I fixed it in 99ea13063427c8bb487edde48614b0e1838bfb46.

Consistent with Gurobi's error message, it wants an array or sparse matrix. It was getting a 1-dimensional non-sparse matrix. So I convert it to a vector first.

Not sure why it gives something different on your end? That is strange. Also, the bounds I am getting are:

Estimated bounds: [0.13339, 0.13481] 

which do not seem to match yours

a-torgovitsky commented 4 years ago

Oh, maybe the difference in bounds is due to me changing something between when I first posted and when I checked the other day. Let me know what you get from the new .zip.

conroylau commented 4 years ago

I am getting the same bound, i.e. [0.13121, 0.1371]. In addition, the mincriterion that I get is 0.001710744. May I know is it different from yours? Thanks!

a-torgovitsky commented 4 years ago

Yes I'm getting the same mincriterion.

I guess we can close this now. A bit strange/uncomfortable that we had a system-dependent error, but not much we can do about that I suppose. Let's just keep this in mind in case we come across this error in the future.

conroylau commented 4 years ago

Sure, no problem!