Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.12"
- name: install and test
run: |
pip install .
Expand Down
11 changes: 7 additions & 4 deletions backends/dpp_canonicalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
from dataclasses import dataclass, field
from typing import Callable

import numpy as np

import cvxpy as cp
import numpy as np

# Optional imports
try:
Expand Down Expand Up @@ -1184,8 +1183,12 @@ def main():
profile_problems = {
"dpp_lasso_small": ("DPP LASSO (50x100)", make_dpp_lasso(50, 100)),
"dpp_lasso_medium": ("DPP LASSO (200x500)", make_dpp_lasso(200, 500)),
"dpp_constraint_medium": ("DPP Constraint (500x200)", make_dpp_constraint_matrix(200, 500)),
"dpp_constraint_large": ("DPP Constraint (1000x500)", make_dpp_constraint_matrix(500, 1000)),
"dpp_constraint_medium": (
"DPP Constraint (500x200)", make_dpp_constraint_matrix(200, 500)
),
"dpp_constraint_large": (
"DPP Constraint (1000x500)", make_dpp_constraint_matrix(500, 1000)
),
}
if args.profile in profile_problems:
name, factory = profile_problems[args.profile]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/finance.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def time_compile_problem(self):

class FactorCovarianceModel:
def setup(self):
n = 14500
n = 25000
m = 250
np.random.seed(1)
mu = np.abs(np.random.randn(n, 1))
Expand Down
6 changes: 3 additions & 3 deletions benchmark/gini_portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Yitzhaki:
def setup(self):
rs = np.random.RandomState(123)
N = 50
T = 150
T = 300
cov = rs.rand(N, N) * 1.5 - 0.5
cov = cov @ cov.T/1000 + np.diag(rs.rand(N) * 0.7 + 0.3)/1000
mean = np.zeros(N) + 1/1000
Expand Down Expand Up @@ -51,7 +51,7 @@ class Murray:
def setup(self):
rs = np.random.RandomState(123)
N = 50
T = 350
T = 700
cov = rs.rand(N, N) * 1.5 - 0.5
cov = cov @ cov.T/1000 + np.diag(rs.rand(N) * 0.7 + 0.3)/1000
mean = np.zeros(N) + 1/1000
Expand Down Expand Up @@ -95,7 +95,7 @@ class Cajas:
def setup(self):
rs = np.random.RandomState(123)
N = 50
T = 350
T = 800
cov = rs.rand(N,N) * 1.5 - 0.5
cov = cov @ cov.T/1000 + np.diag(rs.rand(N) * 0.7 + 0.3)/1000
mean = np.zeros(N) + 1/1000
Expand Down
2 changes: 1 addition & 1 deletion benchmark/high_dim_convex_plasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def criterion(sig: cp.Variable, p: cp.Variable):
)
deps_dummy = np.full((4000, 4), particular_deps)

N = 500
N = 3000
deps_local_values = deps_dummy[:N]

deps = cp.Parameter((4, N), name="deps")
Expand Down
12 changes: 6 additions & 6 deletions benchmark/matrix_stuffing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
class ConeMatrixStuffingBench:

def setup(self):
m = 2000
n = 2000
m = 5000
n = 5000
A = np.random.randn(m, n)
C = np.random.rand(m // 2)
b = np.random.randn(m)
Expand Down Expand Up @@ -68,8 +68,8 @@ def time_compile_problem(self):
class SmallMatrixStuffing:

def setup(self):
m = 200
n = 200
m = 4000
n = 4000
A = np.random.randn(m, n)
C = np.random.rand(m // 2)
b = np.random.randn(m)
Expand All @@ -91,8 +91,8 @@ def time_compile_problem(self):
class ParamSmallMatrixStuffing:

def setup(self):
m = 100
n = 100
m = 300
n = 300
A = cp.Parameter((m, n))
C = cp.Parameter(m // 2)
b = cp.Parameter(m)
Expand Down
4 changes: 2 additions & 2 deletions benchmark/semidefinite_programming.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class SemidefiniteProgramming:

def setup(self):
# Generate a random SDP.
n = 125
p = 75
n = 200
p = 120
np.random.seed(1)
C = np.random.randn(n, n)
A = []
Expand Down
4 changes: 2 additions & 2 deletions benchmark/simple_LP_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def time_compile_problem(self):

class SimpleFullyParametrizedLPBenchmark:
def setup(self):
n = int(1e4)
n = int(1e6)
p = cp.Parameter(n)
x = cp.Variable(n)
objective = cp.Minimize(p @ x)
Expand All @@ -45,7 +45,7 @@ def time_compile_problem(self):

class SimpleScalarParametrizedLPBenchmark:
def setup(self):
n = int(1e6)
n = int(2e6)
p = cp.Parameter()
c = np.arange(n)
x = cp.Variable(n)
Expand Down
18 changes: 9 additions & 9 deletions benchmark/simple_QP_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

class SimpleQPBenchmark:
def setup(self):
m = 2000
n = 400
p = 5
m = 8000
n = 1600
p = 20
np.random.seed(1)
P = np.random.randn(n, n)
P = np.matmul(P.T, P)
Expand All @@ -43,8 +43,8 @@ def time_compile_problem(self):

class ParametrizedQPBenchmark:
def setup(self):
m = 250
n = 100
m = 6000
n = 2400
np.random.seed(1)
A = cp.Parameter((m, n))
b = cp.Parameter((m,))
Expand All @@ -61,8 +61,8 @@ def time_compile_problem(self):

class LeastSquares:
def setup(self):
m = 5000
n = 1000
m = 7000
n = 2000
np.random.seed(1)
A = np.random.randn(m, n)
b = np.random.randn(m)
Expand All @@ -81,9 +81,9 @@ class UnconstrainedQP:
Related issue: https://github.com/cvxpy/cvxpy/issues/2205
"""
def setup(self):
N_r = 16
N_r = 18
N_t = 2
N_s = 6
N_s = 7

x = np.random.randint(2, size=N_s * N_r * N_t)

Expand Down
6 changes: 3 additions & 3 deletions benchmark/slow_pruning_1668_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def setup(self):

Pruning matrices caused order-of-magnitude slow downs in compilation times.
"""
s = 2000
t = 10
s = 4000
t = 20
x = np.linspace(-100.0, 100.0, s)
rows = 50
rows = 100
var = cp.Variable(shape=(rows, t))

cost = cp.sum_squares(
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[tool.ruff]
select = ["E", "F", "I"]
line-length = 100
exclude = [
"build",
"doc",
"*__init__.py"
]
# The minimum Python version that should be supported
target-version = "py37"
target-version = "py311"

[tool.ruff.lint]
select = ["E", "F", "I"]

[tool.ruff.lint.isort]
known-third-party = ["cvxpy"]

[build-system]
requires = ["setuptools>=42"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
package_dir={"": "benchmark"},
packages=setuptools.find_packages(where="benchmark"),
python_requires=">=3.7",
python_requires=">=3.11",
license='Apache License, Version 2.0',
install_requires=[
"cvxpy",
Expand Down
Loading