Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvxcore optimization #1255

Merged
merged 15 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cvxpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
ECOS, SCS, DIFFCP, GUROBI, MOSEK, XPRESS, SCIP, ECOS_BB,
OPTIMAL, UNBOUNDED, INFEASIBLE, SOLVER_ERROR, ROBUST_KKTSOLVER,
OPTIMAL_INACCURATE, UNBOUNDED_INACCURATE, INFEASIBLE_INACCURATE)
from cvxpy.settings import get_num_threads, set_num_threads
from cvxpy.transforms import linearize, partial_optimize, suppfunc
from cvxpy.reductions import *
from cvxpy.reductions.solvers.defines import installed_solvers
9 changes: 7 additions & 2 deletions cvxpy/cvxcore/python/canonInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
from cvxpy.lin_ops import lin_op as lo
import cvxpy.cvxcore.python.cvxcore as cvxcore
import cvxpy.settings as s
import numbers
import numpy as np
import scipy.sparse
Expand Down Expand Up @@ -308,10 +309,12 @@ def get_problem_matrix(linOps,
build_lin_op_tree(lin, linPy_to_linC)
tree = linPy_to_linC[lin]
lin_vec.push_back(tree)

problemData = cvxcore.build_matrix(lin_vec,
int(var_length),
id_to_col_C,
param_to_size_C)
param_to_size_C,
s.get_num_threads())

# Populate tensors with info from problemData.
tensor_V = {}
Expand Down Expand Up @@ -348,7 +351,9 @@ def get_problem_matrix(linOps,
I = np.concatenate(I)
J = np.concatenate(J)
A = scipy.sparse.csc_matrix(
(V, (I, J)), shape=(np.int64(constr_length)*np.int64(var_length+1), param_size_plus_one))
(V, (I, J)),
shape=(np.int64(constr_length)*np.int64(var_length+1),
param_size_plus_one))
return A


Expand Down
3 changes: 2 additions & 1 deletion cvxpy/cvxcore/python/cvxcore.i
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ namespace std {
ProblemData build_matrix(std::vector< const LinOp* > constraints,
int var_length,
std::map<int, int> id_to_col,
std::map<int, int> param_to_size);
std::map<int, int> param_to_size,
int num_threads);
ProblemData build_matrix(std::vector< const LinOp* > constraints,
int var_length,
std::map<int, int> id_to_col,
Expand Down