Questions tagged [cvxpy]

CVXPY is a Python-embedded modeling language for convex optimization problems.

Filter by
Sorted by
Tagged with
2 votes
2 answers
151 views

How to represent the objective function of the Weapon Target Assignment problem in CVXPY?

I am trying to use CVXPY to analyse a problem and the objective function for this problem involves calculating a product and a sum as per the problem description below (taken from a draft paper I am ...
  • 29
2 votes
0 answers
46 views

How to rewrite a constraint with sum of convex and concave components to satisfy DCP rule?

suppose that decision variable is X with N dimensions, and one type of the constraint is ...
5 votes
2 answers
245 views

Simple OLS problem can only be solved in SCS. Is the dual infeasible?

Essentially, I am trying to solve a simple orthogonal least-squares (OLS) problem with some constraints — the coefficients must sum to $1$, no coefficient can be less than $0$, and no coefficient can ...
4 votes
3 answers
471 views

Determining the optimize lambda in Multi-Objective Optimization

I have a convex optimization problem: Maximize obj1 Minimize obj2 Some constraint Now to solve this problem, I used lambda to make it one problem: ...
1 vote
2 answers
100 views

Does the cvxpy replace the max function by MIP formulation under the hood?

Does the cvxpy replace the max function, which is convex, by MIP formulation under the hood when shows up in the constraints (for example, $\max(x,y)\le z$) or in the objective function? In gurobipy, ...
3 votes
2 answers
763 views

Is solving a quadratic programming optimization problem using python slower than C++?

I am using the cvxpy library in python to solve a quadratic programming problem and the solver used is scip. I found that when the amount of data becomes large, the solution process will be ...
  • 63
1 vote
1 answer
147 views

MIQP — CVXPY unable to treat summation of variables as a variable

I have a quadratic integer programming assignment problem. The goal is to assign riders seats on a bus such that distance between any two riders is maximized; however, the importance of each objective ...
  • 471
3 votes
1 answer
61 views

Is not the substitution method supposed to reduce the computation cost?

Is the substitution method expected to reduce the computation cost? We know it will reduce the number of variables and constraints. I mean by substitution method is to eliminate the equality ...
1 vote
2 answers
178 views

How to solve this mixed integer quadratic program using cvxpy or other method?

My problem is described in this picture: $$ \begin{array}{l} \left\{\begin{array}{l} \text { objective function: } \\ f = \min \sum_\limits{l=1}^2 \sum_\limits{i=0}^{2^l-1} \sum_\limits{j=0}^{2^l-2}\...
  • 63
2 votes
0 answers
75 views

Does Gurobipy exploits sparsity of the optimization problem?

What happens when a (sparse) csr matrix / array is submitted to Gurobi (via Cvxpy framework in python). Does it exploit the sparsity Information about the matrix or ...
  • 450
4 votes
1 answer
148 views

Geometric Programming with Simple Affine Equality Constraint

Consider a Geometric Program (GP), $$ \begin{array}{cl} \operatorname{minimize} & f_{0}(x) \\ \text { subject to } & f_{i}(x) \leq 1, \quad i=1, \ldots, m, \\ & g_{i}(x)=1, \quad i=1, \...
5 votes
1 answer
186 views

Constraints like "max(column a + column b) == 2" are not DCP

I am struggling with the following constraint on a minimization problem cvx.max(z[:, i] + z[:, j]) == 2 where z is a Boolean ...
  • 762
7 votes
1 answer
232 views

Translate LP format to Numpy matrices

We have a large-scale optimization problem (~10K vars and ~10K constraints) in the form of LP format file (generated using Cplex ...
  • 450
3 votes
1 answer
265 views

Adding CVXPY abs to optimization problem turns out to be non-DCP

I have tried to solve an optimization problem using CVXPY library. This problem aims to minimize the distance between a vector of $n$ variables ($\beta$), which can be positive or negative real ...
  • 39
1 vote
1 answer
68 views

Convex Optimization with Variable Dependency / no unmet demand carry forward

I'm running into an issue with a Linear Optimization Problem. The ultimate goal is to come back with an optimal production quantity (prod_qty) across several items ...
  • 11
4 votes
1 answer
139 views

DCP formulation of sum of nonconvex and convex functions

I am trying to find a DCP formulation for the following convex objective function (using CVXPY): Let $x$ be the $N$-dimensional vector variable on which we optimize on, $c$ be a known scalar value ...
  • 41
2 votes
1 answer
114 views

Constraint raises DCP Error

I have defined a problem which will minimize the cost of to run a pump. That is defined as the objective of the problem. ...
5 votes
1 answer
271 views

Practical open source LP solvers for large linear programming problem with $10^7$ parameters

I have an LP problem of the form $\min\ c^Tx$ subject to $Ax\leq b$ where $x$ consists of 30 million parameters and $A$ is a very very sparse matrix of size 30M by 30M (with only 3 ones per row). I ...
  • 151
1 vote
0 answers
138 views

Optimization Multiple Constraints

I am trying to solve a linear algebra problem: an optimization problem and I am using CVXOPT. I've split the problem into 3 components In its simplest form, The general formulation for CVXOPT is \...
  • 173
1 vote
0 answers
196 views

Minimum trade size in CVXPY

I'm trying to replicate some of the suggestions of this paper. On page 40-41, it's made the following suggestion when it comes to enforcing a minimum trade size: In this context, ...
  • 119
2 votes
1 answer
1k views

Impose binary constraint on integer matrix with CVXPY

So I have the following matrix: \begin{equation} P_{i,j}= \begin{bmatrix} x_0 & x_1 & x_2 \\ y_0 & y_1 & y_2 \\ z_0 & z_1 & z_2 \end{bmatrix} \end{equation} where ...
  • 193
2 votes
1 answer
202 views

Matrix Singularity Constraint

I'm using CVXPY. Given a $2\times2$ matrix $A$, is it possible to add a singularity constraint? Anything equivalent to: $|A| = 0$: The determinant is $0$ $\operatorname{rank}(A) \leq 1$ Smallest ...
6 votes
2 answers
305 views

Directly calling gurobipy API causes substantially longer runtime than calling cvxpy

Background I am trying to implement the reranking algorithm proposed in the paper (Eqn 3). The algorithm is cast into an integer linear program which is trying to find permutation matrix $\mathbf{X} \...
  • 163
7 votes
1 answer
206 views

Maximizing a Ratio/Percent

I'm using cvxpy to model a problem. Inside a very large and complex LP, I create two continuous, affine (unconstrained) expressions: $x$ and $y$. Due to how they ...
3 votes
1 answer
381 views

Portfolio optimization with indicator function constraint in CVXPY

I have the following portfolio optimization problem that I want to solve using CVXPY: \begin{align}\min_w&\quad w^\top\Pi\\\text{s.t.}&\quad\sum_{i=1}^nw_i=1\\&\quad w^\top\Sigma w\le\...
2 votes
1 answer
852 views

Mixed integer quadratic programming (MIQP) in CVXPY

There's something I don't understand about CVXPY's example on its MIQP use. It says that the algorithm returns a solution $x \in \mathbb{Z}^n$ but I thought in general the point of MIQP algorithms was ...
  • 157
4 votes
1 answer
186 views

Make Optimization term fit into DCP rules

I want to make a term in an objective function I am working with fit into DCP for CVXPY. I am working on replicating this research paper for an active learning problem. Specifically equations 5 is ...
4 votes
0 answers
1k views

cvxpy: Code that works for default solver doesn't work for cp.GLPK_MI

The following code works: ...