python segmentation fault
進行中Hi,
I'm running on macbook pro 13" 2020, python 3.7.8, cvxpy 1.1.4, gurobi 9.0.3 the following problem:
N, aas = O.shape
P = len(P_sizes)
S = cp.Variable(N, boolean=True)
# A = cp.Variable(aas, boolean=True)
chi = cp.Variable(N, boolean=True)
# Op = cp.Parameter(O.shape, boolean=True)
# Op.value = O
constrains = []
A = S @ O
# for i in range(N):
# exp = A @ Op[i] - P + (1+P)*(1-chi[i])
# constrains.append(exp >= 0)
# constrains.append(exp <= P)
exp = O @ A.T - P + (1+P)*(1-chi)
constrains.append(exp >= 0)
constrains.append(exp <= P)
exp = 2 * S - chi
constrains.append(exp >= 0)
constrains.append(exp <= 1)
lib_sizes = []
ind_lib_sizes = {}
ind_constrains = []
log_ind_constrains = []
pointer = 0
for i in range(P):
s = cp.sum(A[pointer:pointer + P_sizes[i]])
lib_sizes.append(s)
ind_lib_sizes[i] = [cp.Variable(boolean=True) for j in range(P_sizes[i])]
exp = cp.sum([ind_lib_sizes[i][j] * (j+1) for j in range(P_sizes[i])]) == s
ind_constrains.append(exp)
log_ind_constrains.extend([ind_lib_sizes[i][j] * np.log(j) for j in range(1, P_sizes[i])])
pointer += P_sizes[i]
constrains.extend(ind_constrains)
constrains.append(cp.sum(log_ind_constrains) <= cp.log(limit))
prob = cp.Problem(cp.Maximize(c.T @ S), constrains)
Where O is a numpy boolean matrix.
I'm not sure why trying to run
prob.solve(solver=cp.GUROBI, verbose=True)
causes segmentation fault.
Thank you
0
-
正式なコメント
Hi Shlomo,
Could you please also share the error message about the segmentation fault? Do you have a (minimal) reproducible example code that you can share so we can inspect this error?
Thanks for reporting,
Matthias -
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
投稿コメントは受け付けていません。
コメント
2件のコメント