You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to use cvxpygen but running into an error when I try using CLARABEL as a solver.
Minimal example
import cvxpy as cp
from cvxpygen import cpg
import numpy as np
# define CVXPY problem
m, n = 3, 2
x = cp.Variable(n, name='x')
A = cp.Parameter((m, n), name='A', sparsity=[(0, 0), (0, 1), (1, 1)])
b = cp.Parameter(m, name='b')
problem = cp.Problem(cp.Minimize(cp.sum_squares(A @ x - b)), [x >= 0])
# assign parameter values and test-solve
np.random.seed(0)
A.value = np.zeros((m, n))
A.value[0, 0] = np.random.randn()
A.value[0, 1] = np.random.randn()
A.value[1, 1] = np.random.randn()
b.value = np.random.randn(m)
problem.solve(solver='CLARABEL')
# generate code
cpg.generate_code(problem, code_dir='nonneg_LS', solver='CLARABEL')
Output
Generating code with CVXPYgen ...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kunalmenda/anaconda3/envs/test/lib/python3.10/site-packages/cvxpygen/cpg.py", line 155, in generate_code
for dual_id in dual_id_maps[0].keys():
IndexError: list index out of range
Is there any way to avoid this error?
Thanks,
Kunal
The text was updated successfully, but these errors were encountered:
Hi @kunalmenda, you can use Clarabel now if you are a Mac or Linux user. See #28. Feel free to install from sources by cloning the repo via git clone --recurse-submodules https://github.com/cvxgrp/cvxpygen.git and installing via python setup.py install. You will need Rust and Eigen (more info here).
Hello, I'm trying to use
cvxpygen
but running into an error when I try usingCLARABEL
as a solver.Minimal example
Output
Is there any way to avoid this error?
Thanks,
Kunal
The text was updated successfully, but these errors were encountered: