jijmodeling.dataset

1from ._jijmodeling import dataset as _dataset  # type: ignore
2import sys
3
4for component in _dataset.__all__:
5    setattr(sys.modules[__name__], component, getattr(_dataset, component))
class Miplib:

Automatically load problems from the MIPLIB dataset.

Warning: the whole dataset is downloaded and cached in your filesystem when first used. It is quite large (~300MB download, ~600MB extracted), so the time it takes to download will likely be significant. We recommend first trying to use this class in a REPL to assure the dataset has been cached.

The dataset is stored at {data_dir}/jijmodeling/miplib, where {data_dir} depends on your operating system:

Platform {data_dir} location Example/System Default
Linux $XDG_DATA_HOME or $HOME/.local/share|/home/alice/.local/share
macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
Windows `%AppData% C:\Users\Alice\AppData\Roaming

Examples

>>> import jijmodeling.dataset

Initialize the dataset. If not cached in your filesystem, this will take several minutes.
>>> miplib = jijmodeling.dataset.Miplib()

Show names of each available instance.
>>> miplib.available_names  # doctest: +ELLIPSIS
[...]

Get basic statistics of a specific instance.
>>> miplib.instance_statistics["unitcal_7"]
{'variable': 25755, 'constraint': 48939, 'binary': 2856, 'integer': 0, 'continuous': 22899, 'non_zero': 127595}

Load "revised-submissions/miplib2010_pg/instances/pg.mps.gz" in benchmark.zip
>>> problem, instance_data = miplib.load("pg")
def load(self, name: str) -> tuple:

Load a problem from the MIPLIB dataset.

available_names: list[str]

List of available problem names.

instance_statistics: Any

Dict of name to problem size, i.e. number of binary/integer/real variable and number of equality/inequality constraints

class Qplib:

Automatically load problems from the MIPLIB dataset.

Warning: the whole dataset is downloaded and cached in your filesystem when first used. It is quite large (~700MB download, ~1.5GB extracted), so the time it takes to download will likely be significant. We recommend first trying to use this class in a REPL to assure the dataset has been cached.

The dataset is stored at {data_dir}/jijmodeling/qplib, where {data_dir} depends on your operating system:

Platform {data_dir} location Example/System Default
Linux $XDG_DATA_HOME or $HOME/.local/share|/home/alice/.local/share
macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
Windows `%AppData% C:\Users\Alice\AppData\Roaming

Examples

>>> import jijmodeling.dataset

Initialize the dataset. If not cached in your filesystem, this will take several minutes.
>>> qplib = jijmodeling.dataset.Qplib()

Show the names of each available instance.
>>> qplib.available_names  # doctest: +ELLIPSIS
[...]

Get basic statistics of a specific instance.
>>> qplib.instance_statistics["QPLIB_2205"]
{'variables': 2884, 'constraints': 2874, 'binary': 958, 'integer': 0, 'continuous': 1926, 'non_zero': 13013}

Load a problem instance from QPLIB.
>>> problem, instance_data = qplib.load("QPLIB_1976")
def load(self, name: str) -> tuple:

Load a problem from the QPLIB dataset.

instance_statistics: Any

Dict of name to problem size, i.e. number of binary/integer/real variable and number of equality/inequality constraints

available_names: list[str]

List of available problem names.