Skip to content

"all input arrays must have the same shape" error on the elevator example #114

@gorczyca

Description

@gorczyca

Running the examples example with the command provided in its respective README.md raises the following error:

clingo examples/elevator/encoding.lp examples/elevator/viz.lp examples/elevator/instance.lp --outf=2 | clingraph --out=animate --select-model=0 --dir='out/elevator' --fps=1 --sort=asc-int

Traceback (most recent call last):
  File "/home/piotr/anaconda3/envs/potassco/bin/clingraph", line 10, in <module>
    sys.exit(main())
  File "/home/piotr/anaconda3/envs/potassco/lib/python3.10/site-packages/clingraph/__init__.py", line 402, in main
    paths = save_gif(graphs,
  File "/home/piotr/anaconda3/envs/potassco/lib/python3.10/site-packages/clingraph/gif.py", line 75, in save_gif
    imageio.mimsave(gif_path,
  File "/home/piotr/anaconda3/envs/potassco/lib/python3.10/site-packages/imageio/v2.py", line 495, in mimwrite
    return file.write(ims, is_batch=True, **kwargs)
  File "/home/piotr/anaconda3/envs/potassco/lib/python3.10/site-packages/imageio/plugins/pillow.py", line 417, in write
    ndimage = np.stack(ndimage, axis=0)
  File "/home/piotr/anaconda3/envs/potassco/lib/python3.10/site-packages/numpy/core/shape_base.py", line 449, in stack
    raise ValueError('all input arrays must have the same shape')
ValueError: all input arrays must have the same shape

My guess is that the width of the image changes when the time integer becomes 2 digits, that is between Time:9 and Time:10. I tested that with success on the following instance:

instance.lp

#const floors=5.
floor(1..floors).

at((floors+1)/2,10). 
called(floors,10).
called(1,10).

encoding.lp

#const horizon=25.
time(10..horizon).
...

I attached the resulting gif.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions