-
Notifications
You must be signed in to change notification settings - Fork 1k
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
TypeError: Wrong number or type of arguments for overloaded function 'IntIntMap___setitem__'. #2446
Comments
Hi! Can you run with python 3.8 and CVXPY 1.4 or higher? Python 3.7 is no
longer supported by the Python Software Foundation, and we no longer
support CVXPY 1.3 (following the recent release of 1.5).
…On Wed, May 15, 2024 at 4:59 AM LP123MYM ***@***.***> wrote:
*Describe the bug*
The following error occurred when I ran the code for a long time
pgon = o.set.polygon()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 107, in polygon
V = self.vertices()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 47, in vertices
return self.vertices2D()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 59, in vertices2D
p = self.center()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 91, in center
prob.solve(solver="ECOS")
File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/problems/problem.py",
line 495, in solve
return solve_func(self, *args, **kwargs)
File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/problems/problem.py",
line 1057, in
*solve solver, gp, enforce_dpp, ignore_dpp, verbose, canon_backend, kwargs
File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/problems/problem.py",
line 683, in get_problem_data data, inverse_data =
solving_chain.apply(self, verbose) File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/reductions/chain.py",
line 76, in apply problem, inv = r.apply(problem) File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/reductions/dcp2cone/cone_matrix_stuffing.py",
line 336, in apply problem, extractor) File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/reductions/dcp2cone/cone_matrix_stuffing.py",
line 327, in stuffed_objective params_to_c =
extractor.affine(problem.objective.expr) File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/utilities/coeff_extractor.py",
line 92, in affine self.canon_backend) File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/cvxcore/python/canonInterface.py",
line 325, in get_problem_matrix id_to_col_C[int(id)] = int(col) File
"/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/cvxcore/python/cvxcore.py",
line 738, in setitem return cvxcore.IntIntMap___setitem*(self, *args)
TypeError: Wrong number or type of arguments for overloaded function
'IntIntMap___setitem__'.
Possible C/C++ prototypes are:
std::map< int,int >::*setitem*(std::map< int,int >::key_type const &)
std::map< int,int >::*setitem*(std::map< int,int >::key_type const
&,std::map< int,int >::mapped_type const &)
p = self.center()
def center(self):
"""compute Chebychev center of a polytope"""
tmp = np.expand_dims(np.linalg.norm(self.c, axis=1), axis=1)
c = np.concatenate((self.c, tmp), axis=1)
cost = np.zeros(self.c.shape[1] + 1)
cost[-1] = -1.
x = cp.Variable((len(cost), 1))
prob = cp.Problem(cp.Minimize(np.expand_dims(cost, axis=0) @ x), [c @ x <= self.d])
prob.solve(solver="ECOS")
# solve with another solver for optimal_inaccurate
if prob.status != "optimal":
prob.solve(solver="MOSEK")
assert prob.status == "optimal", f"id={self.id}, status={prob.status}"
p = x.value[:-1]
if not np.all(np.dot(self.c, p) <= self.d):
raise Exception('Computation of the Chebychev center failed!')
return p
*Version*
- OS: ubuntu18.04
- CVXPY Version:1.3.1
—
Reply to this email directly, view it on GitHub
<#2446>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACRLIFFAONFX3Y5FMOITOGDZCMPWHAVCNFSM6AAAAABHXW4O2OVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4TOMRXGYYDKMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thank you for your reply. I will try using Python 3.8 |
I tried Python=3.8.1 and cvxpy=1.5.1, but still reported the above error。I ran it for about two days and reported an error,Below is the minimum error example:
|
The minimum number of running steps for error reporting is 28633115 steps in version 1.5.1, 30678338 steps in version 1.3.1, and 30678338 steps in version 1.2.1. The number of running steps referred to here is s_t in the minimum example |
Describe the bug
The following error occurred when I ran the code for a long time
File "/home/mym/code_GPU/src/sets/Polytope.py", line 107, in polygon
V = self.vertices()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 47, in vertices
return self.vertices2D()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 59, in vertices2D
p = self.center()
File "/home/mym/code_GPU/src/sets/Polytope.py", line 91, in center
prob.solve(solver="ECOS")
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/problems/problem.py", line 495, in solve
return solve_func(self, *args, **kwargs)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/problems/problem.py", line 1057, in solve
solver, gp, enforce_dpp, ignore_dpp, verbose, canon_backend, kwargs
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/problems/problem.py", line 683, in get_problem_data
data, inverse_data = solving_chain.apply(self, verbose)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/reductions/chain.py", line 76, in apply
problem, inv = r.apply(problem)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/reductions/dcp2cone/cone_matrix_stuffing.py", line 336, in apply
problem, extractor)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/reductions/dcp2cone/cone_matrix_stuffing.py", line 327, in stuffed_objective
params_to_c = extractor.affine(problem.objective.expr)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/utilities/coeff_extractor.py", line 92, in affine
self.canon_backend)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/cvxcore/python/canonInterface.py", line 325, in get_problem_matrix
id_to_col_C[int(id)] = int(col)
File "/home/mym/anaconda3/envs/safe_rl_gpu/lib/python3.7/site-packages/cvxpy/cvxcore/python/cvxcore.py", line 738, in setitem
return cvxcore.IntIntMap___setitem(self, *args)
TypeError: Wrong number or type of arguments for overloaded function 'IntIntMap___setitem__'.
Possible C/C++ prototypes are:
std::map< int,int >::setitem(std::map< int,int >::key_type const &)
std::map< int,int >::setitem(std::map< int,int >::key_type const &,std::map< int,int >::mapped_type const &)
p = self.center()
def center(self):
"""compute Chebychev center of a polytope"""
Version
The text was updated successfully, but these errors were encountered: