Comments (6)
You have to solve the problem.
from cvxpy.
I was able to reproduce the issue.
from cvxpy.
import cvxpy as cp
import numpy as np
d = 10
np.random.seed(0)
A = np.random.randn(5, 10)
B = np.random.randn(4, 10)
C = np.random.randn(3, 10)
x = cp.Variable(d)
objective = cp.Minimize(cp.sum_squares(A@x) + cp.mixed_norm(cp.hstack([B @ x, C @ x, np.ones(d)]), 1, 2))
I was unable to reproduce the issue with this script. Is there any info I'm missing?
from cvxpy.
@raff0722 you're hitting this bug #1963
In your problem mixed_norm isn't doing anything different than regular norm because the hstack output is 1D. Possibly you didn't mean for it to be 1D. We follow NumPy conventions for hstack, vstack, concatenate, etc.
from cvxpy.
Here's the minimized script:
import cvxpy as cp
import numpy as np
d = 10
objective = cp.Minimize(0)
constr = [cp.mixed_norm(cp.hstack([np.ones(d)]), 1, 2) <= 1]
cp.Problem(objective, constr).solve()
It is worth at least fixing its error message.
from cvxpy.
@raff0722 you're hitting this bug #1963 In your problem mixed_norm isn't doing anything different than regular norm because the hstack output is 1D. Possibly you didn't mean for it to be 1D. We follow NumPy conventions for hstack, vstack, concatenate, etc.
Yes, that was the issue. Thank you! I expected a matrix with d rows and 3 columns. Now I used bmat
as follows
cp.mixed_norm( cp.bmat([ [B@x], [C@x], [np.ones(d)] ), 1, 2 )
which works.
However, I find the doc about bmat
a bit confusing. It says
Takes a list of lists. Each internal list is stacked horizontally. The internal lists are stacked vertically.
Morevoer, based on Meaning in
I would expect that I have to transpose the matrix, i.e., use
cp.mixed_norm( cp.bmat( [ [B@x], [C@x], [np.ones(d)] ] ).T, 1, 2 )
which however gave the wrong result.
from cvxpy.
Related Issues (20)
- Audit code for use of list comprehensions where generators would be faster HOT 2
- Type annotation for `dims` in `partial_trace` is incorrect HOT 5
- Index exceeds matrix dimension when solving a simple quadratic programming model HOT 1
- Allow to disable "too many subexpressions" warnings. HOT 1
- ortools 9.10.4067 support missing HOT 3
- Incompatibility with numpy 2.0 not written in `pyproject.toml` HOT 3
- Support for solving a batch of problems HOT 4
- Trouble finding sparse optima HOT 3
- TypeError: Wrong number or type of arguments for overloaded function 'IntIntMap___setitem__'. HOT 1
- ValueError and OverflowError with NumPy 2.0 HOT 4
- Strange error of CVXPY 1.5.2 HOT 3
- Negative duality gap for semidefinite program example HOT 4
- Somethings wrong with DPP
- Can you make `cvxpy` a meta-package that depends on `cvxpy-base` and the solvers? HOT 1
- DCPError
- No solver status is returned when SolverError is raised
- warm start with a start point user defined? HOT 2
- Getting int32 overflows when trying to solve a simple SDP on 100 x 100 matrices HOT 2
- MOSEK IIS hard to interpret HOT 2
- Queuing design example HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvxpy.