numpy.bool_' object has no attribute 'parameters'

19 views
Skip to first unread message

Xu Siyuan

unread,
Sep 16, 2021, 5:27:28 PM9/16/21
to cvxpy
Hello,

I have encountered a weird error, reporting  AttributeError: 'numpy.bool_' object has no attribute 'parameters'

def offline_opt(overall_load):

    power_signal = cp.Variable(time_slot)
   
    obj_constraints = []
   
    for time in range(time_slot):
        SoC = 0
        for i in range(time):
            SoC += ((1-agg[3])**(i))*power_signal[time-i]
        obj_constraints += [-agg[0]<=SoC, SoC<= agg[0]]

    prob = cp.Problem(cp.Minimize(max_peak(power_signal, overall_load)), \
                      constraints=obj_constraints)
    prob.solve(solver=cp.MOSEK)

The problem lies in the red line. But if I replace agg[0] by 10, then it goes through and gives me a result. So I checked the type and value of agg[0], 

IPdb [2]: agg[0]
10.0

IPdb [4]: type(agg[0])
<class 'numpy.float64'>

So what is going on?

Thanks!

Steven Diamond

unread,
Sep 16, 2021, 9:50:43 PM9/16/21
to cvxpy
That is puzzling. Maybe you can create a snippet that we could run that reproduces the error? Also we are moving off this google group, into the discord: https://discord.gg/qmNer7P7
Reply all
Reply to author
Forward
0 new messages