Skip to content

Error when running apply_milpnet.py example #2

@GalPerelman

Description

@GalPerelman

Hi
I tried to run the apply_milpnet.py example and got the following error:
Traceback (most recent call last): File "C:\Users\User\Documents\GitHub\MILPNet\apply_milpnet.py", line 29, in <module> milpnet_results = run_gurobi(inp_file, no_ts, pump_on = False) File "C:\Users\User\Documents\GitHub\MILPNet\set_up_milpnet.py", line 689, in run_gurobi largest_q = max(np.max(results.link['flowrate'])) TypeError: 'numpy.float32' object is not iterable

The error points to set_up_milpnet.py line 689:
largest_q = max(np.max(results.link['flowrate']))
smallest_q = min(np.min(results.link['flowrate']))

It seems like there is a redundant max function
Where the first np.max returns a float\int and then the outer max fails to find the maximum of a scalar
Deleting the outer max and min solved this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions