Questions tagged [cvxr]

39 questions
11
votes
2 answers

Maximum determinant of sub-matrix

Assuming we have a square matrix M, e.g., set.seed(1) M <- matrix(rnorm(5*5), 5, 5) > M [,1] [,2] [,3] [,4] [,5] [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 0.91897737 [2,] 0.1836433 0.4874291 …
ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
5
votes
1 answer

Fast nonnegative quantile and Huber regression in R

I am looking for a fast way to do nonnegative quantile and Huber regression in R (i.e. with the constraint that all coefficients are >0). I tried using the CVXR package for quantile & Huber regression and the quantreg package for quantile…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
2
votes
0 answers

In CVXR, how to use an external c++ function?

I am using CVXR to code a penalized linear regression. My global loss is composed of 4 elements: two differents SSE losses loss_u, loss_b on two different data sets, a ridge penalty and a specific distance D. The code works if I use the 'distance ==…
Malex
  • 41
  • 4
2
votes
1 answer

R CVXR matrix multiplication %*% Error in mul_dims_promote(lh_dim, rh_dim) : Incompatible dimensions

Hello I am trying to run the example from here: http://rtutorial.altervista.org/lp_solvers.html A snippet and test where it goes wrong: library(CVXR) #create Variable objects that can be manipulated by the solver. x<-Variable(3) #coefficients for…
Greg Nowak
  • 68
  • 5
2
votes
1 answer

CVXR Elementwise multiplication of matrix with vector

I want to use CVXR to find the optimal values of a vector. In the objective function i need to multiply a matrix with a vector in an elementwise way: b: Nx1 vector X: Nxp matrix result: Nxp matrix Example: # Set the dims N <- 50 p <- 5 X <-…
fp2
  • 21
  • 1
2
votes
0 answers

Is it possibile, with CVXR package, to optimize function that works on a data frame?

I have a following problem. In first step suppose I have a data frame with 3 facts (a, b, c). library(dplyr) library(tidyr) library(CVXR) library(RcppRoll) library(purrr) set.seed(1234) df = tibble( a =…
ppar
  • 21
  • 2
2
votes
2 answers

CVXR using Mosek for a quadratic minimization problem

I'm trying to solve a Quadratic optimization problem with linear constrains using the R package CVXR. Although the default solver is able to solve the optimization, Mosek solver is not. The reason I'm looking to use Mosek is because I need to solve…
Alejandro Andrade
  • 2,196
  • 21
  • 40
1
vote
0 answers

How to find k solutions of an optimization with CVXR

I'm trying to find multiple solutions (TXs[1],TXs[2],TXs[3],TXs[4],TXs[5],TZs) that respect the following conditions: # Variables : TXs <- Variable(5) TZs <- Variable(1) # Objectif : obj = abs(TXs[1] + TXs[2] + TXs[3] + TXs[4] + TXs[5] + TZs -…
AnonX
  • 167
  • 8
1
vote
1 answer

CVXR incorrectly claiming problem is infeasible?

I want to solve the following convex optimization problem, where b is a matrix of variables and p is a vector of variables. The matrix u is a matrix of fixed non-negative values. Here is my formulation in R, using the CVXR package. When I run it,…
grapher
  • 43
  • 4
1
vote
0 answers

Solving a large constrained least squares regression with CVXR

I’m trying to use CVXR to solve a large weighted least squares regression with constraints. But I am currently running into issues with the problem size. My data set has around 8 million observations and 500 variables. In addition, I have two types…
camel_o
  • 11
  • 2
1
vote
0 answers

Solving SDP problem with cvx - difference between MATLAB and R solution

I solved the following Linear Matrix Inequality (LMI) problem using cvx in Matlab: Lhs = [19.467593196, 1.82394007, 0.1625838, 0.01685267, 0.002495194; 1.823940068, 1.78664305, 0.9845668, 0.32951706, 0.010431878; 0.162583843, 0.98456679, 1.2333818,…
momomi
  • 23
  • 9
1
vote
1 answer

Multiply two variables in an objective function using cvxr

I want to minimize the following objective function with some constraints And another user (I think it was G. Grothendieck) suggested to use the CVXR package of R. So I followed the instructions on A Gentle Introduction to CVXR to make my…
tueftla
  • 369
  • 1
  • 3
  • 16
1
vote
1 answer

Solving optimization problem with CVXR in R, using several constraints

I am trying to solve an mixed integer problem with CVXR in R. Following code is used to solve it: n <- 6 beta <- Variable(n, n, integer = TRUE) epsilon <- 0.1*10^-5 objective <- Minimize(1) constraints <- list(beta >= 1, beta <=…
Jb11
  • 23
  • 2
1
vote
1 answer

How to solve an objective function having an exponential term with a different base in CVXR?

I am using CVXR to solve a concave objective function. The decision variable (x) is one-dimensional and the objective function is the summation of 2 logarithmic terms in which the second term is exponential with different bases of “a and b” (e.g.,…
1
vote
1 answer

Usign Mosek for CVXR

I have already installed 3 times Mosek. It is working in python but CVXR (r package) function installed_solvers() is not able to find MOSEK. I'm working on a MACos Mojave. I installed Mosek via conda comand, got an academic license, create a…
Alejandro Andrade
  • 2,196
  • 21
  • 40
1
2 3