Skip to main content

All Questions

0 votes
0 answers
82 views

CVXPY DCP error for cp.outer with two decision variables

I'm trying to solve the problem of finding an optimal choice of parallelization algorithm for each operator (v) in a Machine Learning computation graph, where each algorithm has an associated compute ...
Pedro Gimenes's user avatar
0 votes
1 answer
236 views

largest and others constraints in portfolio optimization (MILP problem) CVXPY

Here is python code in cvxpy: import numpy as np import time import cvxpy as cp n = 10 a = np.random.randint(1, 10, size=n) b = np.random.randint(1, 10, size=n) c = np.random.randint(1, 10, size=n) ...
Cino's user avatar
  • 93
0 votes
1 answer
252 views

Constraints with condition in CVXPY

I want to add constraints like this: constraint = cp.sum(cp.multiply(x, a)) > 10 if x*a != 0 where x is decision variable and a is constant. I know if condition and chain constraints are not ...
Cino's user avatar
  • 93
0 votes
1 answer
354 views

How to create a CVXPY Variable with discontinuous range?

I am trying to optimize a inventory control linear program for month to month over a year. I cannot figure out how to program a variable that can either be 0 or greater than 50. I have three ...
Ryan Mark's user avatar
1 vote
1 answer
597 views

How can I perform a calculation on my CVXPY variable?

I have a convex programming problem in which I am constrained to several periods, each of these periods represents different times of a day in minutes. Assume we are constrained to 7 periods in the ...
Aidan Donnelly's user avatar
1 vote
0 answers
452 views

How to reshape a CVXPY variable for constraint calculation?

I have an integer variable named running_times which is length N. Each index in this variable represents the running time required for each period over a 24 hour period. I need to perform a ...
Aidan Donnelly's user avatar
0 votes
0 answers
120 views

Optimize sum(B[indices]) , which indices from top n selection in array A [CVXPY]

I have a model to predict customer ltv ( called pltv), and we want to find a best cutoff of pltv to select customers with condition sum of revenue from top n customer, higher is better. objective = ...
Mithril's user avatar
  • 13.8k
3 votes
1 answer
148 views

Integer Programming for NNC

I'm trying to implement Integer Programming for Nearest Neighbor Classifier in python using cvxpy. Short intro Given a dataset of n points with a color (red or blue) we would like to choose the ...
Timor's user avatar
  • 579
1 vote
1 answer
581 views

How do I model this linear programming problem in Python?

I have been tasked to program a Dantzig Selector using Python, but I was given no guidelines and do not have much experience in linear programming or data science. I cannot find the information I need ...
Yuyu F.'s user avatar
  • 13
1 vote
1 answer
82 views

How do I prevent multiple starts/stops of my selection?

I have CVXPY problem defined with a volume array, and a cost array to match each of volumes. The problem has 192 variables and 3 constraints which I have defined. My goal is to minimize the cost in ...
Aidan Donnelly's user avatar
0 votes
0 answers
386 views

Make binary decision variable 1 when X == some value, otherwise 0 in cvxpy

I have a decision variable matrix D. I am able to obtain the max value of each column by using cp.max() and store in an another decision variable maxes. Now what I want is another decision variable ...
Crystal Carreon's user avatar
1 vote
0 answers
125 views

What is 'G' in CVXPY and how to fix it

I'm trying to use a binary integer linear program to assign members of my staff to different shift. I have a 16x9 matrix of preferences for my staff in a csv (16 staff members, 9 slots to fill) and I ...
Nakul Upadhya's user avatar
1 vote
0 answers
268 views

How to place constraints on subsets of an array dynamically in cvxpy?

I have a decision variable that consists of a matrix of power usage for an energy facility. Each column in the matrix corresponds to different energy drains (for example light bulbs or heating), with ...
ROHAN DATTA's user avatar
1 vote
0 answers
2k views

Why solver ECOS in cvxpy cannot solve this LP problem?

I am trying to solve the following LP using ECOS in CVXPY. But it tells me ''' Solver 'ECOS' failed. Try another solver, or solve with verbose=True for more information. ''' When I tried "verbose=...
Jane's user avatar
  • 21
0 votes
3 answers
391 views

How to build exe with pyinstaller from python script which uses cvxpy and CBC?

I am trying to build exe from a python script to solve LP problem using cvxpy and CBC (through cylp) with pyinstaller. The code is like this: import numpy as np import cvxpy as cp if __name__ == &...
plstone's user avatar

15 30 50 per page