Mac OS cvxpy TypeError came up

Asked by At

I tried to run on Mac OS. But it was successfully run on Windows.

I failed so many times to install cvxpy and scipy and so on on Mac OS by anaconda

import numpy as np
import matplotlib.pyplot as plt
import cvxpy as cvx

f = np.array([[1, 1]])
A = np.array([[2, 1], [1, 2]])
b = np.array([[29], [25]])
lb = np.array([[2], [5]])

x = cvx.Variable(2, 1)

objective = cvx.Minimize(-f * x)
constraints = [A * x <= b, lb <= x]

prob = cvx.Problem(objective, constraints)
result = prob.solve()

print(x.value)
print(result)

Traceback (most recent call last):
File "", line 1, in File "/.../variable.py", line 75, in __init__raise TypeError("Variable name %s must be a string." % name)
TypeError: Variable name 1 must be a string.

0 Answers