| Title: | Linear Programming via Regularized Least Squares |
|---|---|
| Description: | The Linear Programming via Regularized Least Squares (LPPinv) is a two-stage estimation method that reformulates linear programs as structured least-squares problems. Based on the Convex Least Squares Programming (CLSP) framework, LPPinv solves linear inequality, equality, and bound constraints by (1) constructing a canonical constraint system and computing a pseudoinverse projection, followed by (2) a convex-programming correction stage to refine the solution under additional regularization (e.g., Lasso, Ridge, or Elastic Net). LPPinv is intended for underdetermined and ill-posed linear problems, for which standard solvers fail. |
| Authors: | Ilya Bolotov [aut, cre] (ORCID: <https://orcid.org/0000-0003-1148-7144>) |
| Maintainer: | Ilya Bolotov <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.0.0 |
| Built: | 2026-06-07 23:09:06 UTC |
| Source: | https://github.com/econcz/rlppinv |
Solve a linear program via Convex Least Squares Programming (CLSP).
lppinv( c = NULL, A_ub = NULL, b_ub = NULL, A_eq = NULL, b_eq = NULL, non_negative = TRUE, bounds = NULL, replace_value = NA_real_, tolerance = sqrt(.Machine$double.eps), final = TRUE, alpha = NULL, cond_tolerance = NULL, ... )lppinv( c = NULL, A_ub = NULL, b_ub = NULL, A_eq = NULL, b_eq = NULL, non_negative = TRUE, bounds = NULL, replace_value = NA_real_, tolerance = sqrt(.Machine$double.eps), final = TRUE, alpha = NULL, cond_tolerance = NULL, ... )
c |
numeric vector of length |
A_ub |
numeric matrix of size |
b_ub |
numeric vector of length |
A_eq |
numeric matrix of size |
b_eq |
numeric vector of length |
non_negative |
logical scalar, default = |
bounds |
NULL, |
replace_value |
numeric scalar or |
tolerance |
numeric scalar, default = |
final |
logical scalar, default = |
alpha |
numeric scalar, numeric vector, or |
cond_tolerance |
numeric scalar or |
... |
Additional arguments passed to the rclsp solver. |
An object of class "clsp" containing the fitted CLSP model.
## Linear Programming via Regularized Least Squares (LPPinv) ## Underdetermined and potentially infeasible LP system RNGkind("L'Ecuyer-CMRG") set.seed(123456789) # sample (dataset) A_ub <- matrix(rnorm(50 * 500), nrow = 50L, ncol = 500L) A_eq <- matrix(rnorm(25 * 500), nrow = 25L, ncol = 500L) b_ub <- matrix(rnorm(50), ncol = 1L) b_eq <- matrix(rnorm(25), ncol = 1L) # model (no default non-negativity, unique MNBLUE solution) model <- lppinv( A_ub = A_ub, A_eq = A_eq, b_ub = b_ub, b_eq = b_eq, non_negative = FALSE, final = TRUE, alpha = 1.0 # unique MNBLUE estimator ) # coefficients print("x hat (x_M hat):") print(round(model$x, 4)) # numerical stability (if available) if (!is.null(model$kappaC)) { cat("\nNumerical stability:\n") cat(" kappaC :", round(model$kappaC, 4), "\n") } if (!is.null(model$kappaB)) { cat(" kappaB :", round(model$kappaB, 4), "\n") } if (!is.null(model$kappaA)) { cat(" kappaA :", round(model$kappaA, 4), "\n") } # goodness-of-fit diagnostics (if available) if (!is.null(model$nrmse)) { cat("\nGoodness-of-fit:\n") cat(" NRMSE :", round(model$nrmse, 6), "\n") } if (!is.null(model$x_lower)) { cat(" Diagnostic band (min):", round(min(model$x_lower), 4), "\n") } if (!is.null(model$x_upper)) { cat(" Diagnostic band (max):", round(max(model$x_upper), 4), "\n") } # bootstrap NRMSE t-test (if supported by rclsp) if ("ttest" %in% names(model)) { cat("\nBootstrap t-test:\n") tt <- model$ttest(sample_size = 30L, seed = 123456789, distribution = "normal") for (nm in names(tt)) { cat(" ", nm, ": ", round(tt[[nm]], 6), "\n", sep = "") } }## Linear Programming via Regularized Least Squares (LPPinv) ## Underdetermined and potentially infeasible LP system RNGkind("L'Ecuyer-CMRG") set.seed(123456789) # sample (dataset) A_ub <- matrix(rnorm(50 * 500), nrow = 50L, ncol = 500L) A_eq <- matrix(rnorm(25 * 500), nrow = 25L, ncol = 500L) b_ub <- matrix(rnorm(50), ncol = 1L) b_eq <- matrix(rnorm(25), ncol = 1L) # model (no default non-negativity, unique MNBLUE solution) model <- lppinv( A_ub = A_ub, A_eq = A_eq, b_ub = b_ub, b_eq = b_eq, non_negative = FALSE, final = TRUE, alpha = 1.0 # unique MNBLUE estimator ) # coefficients print("x hat (x_M hat):") print(round(model$x, 4)) # numerical stability (if available) if (!is.null(model$kappaC)) { cat("\nNumerical stability:\n") cat(" kappaC :", round(model$kappaC, 4), "\n") } if (!is.null(model$kappaB)) { cat(" kappaB :", round(model$kappaB, 4), "\n") } if (!is.null(model$kappaA)) { cat(" kappaA :", round(model$kappaA, 4), "\n") } # goodness-of-fit diagnostics (if available) if (!is.null(model$nrmse)) { cat("\nGoodness-of-fit:\n") cat(" NRMSE :", round(model$nrmse, 6), "\n") } if (!is.null(model$x_lower)) { cat(" Diagnostic band (min):", round(min(model$x_lower), 4), "\n") } if (!is.null(model$x_upper)) { cat(" Diagnostic band (max):", round(max(model$x_upper), 4), "\n") } # bootstrap NRMSE t-test (if supported by rclsp) if ("ttest" %in% names(model)) { cat("\nBootstrap t-test:\n") tt <- model$ttest(sample_size = 30L, seed = 123456789, distribution = "normal") for (nm in names(tt)) { cat(" ", nm, ": ", round(tt[[nm]], 6), "\n", sep = "") } }