conroylau / lpinfer

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

limSolve no longer works in estbounds? #68

Closed a-torgovitsky closed 4 years ago

a-torgovitsky commented 4 years ago
rm(list = ls())
library("tidyverse")
library("lpinfer")
load("dgp1.RData")

r <- estbounds(data, lpm, solver = "limSolve", norm = 1, kappa = .1)

yields

Error in limSolve::linp(E = Emat, F = Fvec, G = Gmat, H = Hvec, Cost = fcost) : 
  cannot solve linear programming problem - Cost not compatible

dgp1.RData.zip

conroylau commented 4 years ago

Done! The bug here is similar to issue #69, and it has been fixed. Now it is giving:

> r <- estbounds(data, lpm, solver = "limSolve", norm = 1, kappa = .1)
> r
Estimated bounds: [0.13468, 0.1891]

However, limSolve cannot handle the quadratically constrained QP problem in the second stage of the 2-norm problem, i.e. the following constraint: image Do you think I should include an error message whenever the user is trying to use limSolve with a 2-norm, or should I remove limSolve from the module? Thanks!

a-torgovitsky commented 4 years ago

I think just error message if they try to use limSolve with the 2-norm.

conroylau commented 4 years ago

Sure! I have just added this error message into the estbounds function when the 2-norm is chosen with the limSolve or Rcplex solver. The following error message will be printed:

Error: This function with a 2-norm in the estimation procedure and a quadratically constrained quadratic program is only compatible with 'gurobi'. Please install 'gurobi' (version 8.1-1 or later). 

I am adding this message for Rcplex too because they only support a quadratically constrained QP with the RHS constant being zero, which is typically not the case for the second step of the estbounds procedure.