Skip to content

Error loading CBLIB instances

When trying to load cblib/exp/beck751.cbf.gz using picos, I get the following error:

Invalid operation ComplexAffineExpression.mul(A[(0, 1)], x[0]): The operand shapes of 12×3 and 12×1 do not match.

Also the warning:

warnings.warn("CBF file has a version other than 1.").

Code to reproduce:

import gzip, shutil, tempfile
from pathlib import Path
import picos

def import_cbf_gz(path_gz: str):
    gz_path = Path(path_gz)
    ...:
    # Make a temporary .cbf file
    with gzip.open(gz_path, "rb") as f_in, tempfile.NamedTemporaryFile(suffix=".cbf", delete=False) as f_out:
        shutil.copyfileobj(f_in, f_out)
        cbf_path = Path(f_out.name)
    ...:
    try:
        # PICOS needs a filename, not bytes
        prob = picos.modeling.file_in.import_cbf(str(cbf_path))
        return prob
    finally:
        try:
            cbf_path.unlink()
        except FileNotFoundError:
            pass

prob = import_cbf_gz("problems/cblib/exp/beck751.cbf.gz")

The cbf.gz file can be found here: https://cblib.zib.de/

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information