diff --git a/.gitignore b/.gitignore index 485205e..9beec8b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ __pycache__ /large_files/ *.h5 !/docs/data/*.h5 +!/tests/test_data/file_versions/*.h5 venv profile* *-checkpoint.ipynb diff --git a/tests/generate_file_version_data.py b/tests/generate_file_version_data.py new file mode 100644 index 0000000..18b38a9 --- /dev/null +++ b/tests/generate_file_version_data.py @@ -0,0 +1,117 @@ +import argparse +import json +import random +import shutil +from datetime import datetime, timezone +from pathlib import Path + +import h5py +import numpy as np + +from paretobench import Experiment, History +from utils import experiment_to_manifest + +DEFAULT_OUT_DIR = Path(__file__).resolve().parent / "test_data" / "file_versions" +FILENAME_FMT = "paretobench_file_format_v{version}.h5" + + +def make_experiment(): + """ + Build the synthetic experiment which gets saved into the fixtures. The contents are deterministic so that + running this script twice with the same version of the library produces the same file. Names and the + objective / constraint settings are included so that every serialized field is covered. + + Returns + ------- + Experiment + The experiment to save + """ + random.seed(0) + np.random.seed(0) + + runs = [] + for problem in ["ZDT1 (n=4)", "CTP1 (n=4)", "TNK"]: + run = History.from_random( + n_populations=4, + n_objectives=3, + n_decision_vars=4, + n_constraints=2, + pop_size=25, + generate_names=True, + generate_obj_constraint_settings=True, + ) + run.problem = problem + runs.append(run) + + return Experiment( + runs=runs, + name="file_format_regression", + author="ParetoBench test suite", + software="ParetoBench", + software_version="0.0.0", + comment="Synthetic data used by the file format regression tests", + creation_time=datetime(2025, 1, 1, tzinfo=timezone.utc), + ) + + +def write_manifest(path): + """ + Record what a saved file contains in a JSON file next to it. The description is taken from the file as it + reads back off of disk so that it captures the output of the reader and not the object which was saved. + + Parameters + ---------- + path : Path + The saved HDF5 file to describe + + Returns + ------- + Path + Path of the manifest which was written + """ + manifest_path = path.with_suffix(".json") + with open(manifest_path, "w") as fd: + json.dump(experiment_to_manifest(Experiment.load(path)), fd, indent=2, sort_keys=True) + return manifest_path + + +def main(): + parser = argparse.ArgumentParser( + description=( + "Save a file of synthetic data in the version of the ParetoBench file format the library currently " + "writes." + ) + ) + parser.add_argument("--out-dir", type=Path, default=DEFAULT_OUT_DIR, help="directory to save the file into") + parser.add_argument("--force", action="store_true", help="overwrite an existing file for this version") + parser.add_argument("--manifest", type=Path, help="rewrite the manifest of an existing file and exit") + args = parser.parse_args() + + # Refresh the manifest of a file which already exists (used to bootstrap files saved by older versions) + if args.manifest is not None: + print(f"Wrote {write_manifest(args.manifest)}") + return + + # Save the data, then name the file after the version which actually ended up in it + args.out_dir.mkdir(parents=True, exist_ok=True) + tmp_path = args.out_dir / "_generate_file_version_data.h5" + make_experiment().save(tmp_path) + with h5py.File(tmp_path) as fd: + version = fd.attrs["file_version"] + path = args.out_dir / FILENAME_FMT.format(version=version) + + # Regenerating the file of an already released version would destroy the record of how that version wrote data + if path.exists() and not args.force: + tmp_path.unlink() + raise SystemExit( + f"{path} already exists, refusing to regenerate the fixture of a released format version. " + "Pass --force to overwrite it anyway." + ) + + shutil.move(tmp_path, path) + print(f"Wrote {path} (file version {version})") + print(f"Wrote {write_manifest(path)}") + + +if __name__ == "__main__": + main() diff --git a/tests/test_containers.py b/tests/test_containers.py index b8d7438..8026072 100644 --- a/tests/test_containers.py +++ b/tests/test_containers.py @@ -3,38 +3,10 @@ import os import pytest import tempfile -from pathlib import Path -from paretobench.analyze_metrics import normalize_problem_name from paretobench.containers import Experiment, Population, History -def get_test_files(): - test_dir = Path(__file__).parent / "legacy_file_formats" - return [f for f in test_dir.glob("*.h5")] - - -@pytest.mark.parametrize("test_file", get_test_files()) -def test_load_legacy_files(test_file): - """ - Test loading different versions of saved experiment files for backwards compatibility. - """ - exp = Experiment.load(test_file) - - # Some basic checks - assert len(exp.runs) == 6 - for run in exp.runs: - assert len(run) == 8 - assert len(run.reports[0]) == 50 - assert run.reports[0].m == 2 - assert run.reports[0].n == 5 - assert run.reports[0].g.shape[1] == 0 - - # Check problems are right - probs = set(normalize_problem_name(x.problem) for x in exp.runs) - assert probs == {"ZDT2 (n=5)", "ZDT4 (n=5)", "ZDT6 (n=5)"} - - @pytest.mark.parametrize("generate_names", [False, True]) def test_experiment_save_load(generate_names): """ diff --git a/tests/test_data/file_versions/paretobench_file_format_v1.0.0.h5 b/tests/test_data/file_versions/paretobench_file_format_v1.0.0.h5 new file mode 100644 index 0000000..04fd3ff Binary files /dev/null and b/tests/test_data/file_versions/paretobench_file_format_v1.0.0.h5 differ diff --git a/tests/test_data/file_versions/paretobench_file_format_v1.0.0.json b/tests/test_data/file_versions/paretobench_file_format_v1.0.0.json new file mode 100644 index 0000000..e6fccae --- /dev/null +++ b/tests/test_data/file_versions/paretobench_file_format_v1.0.0.json @@ -0,0 +1,815 @@ +{ + "author": "", + "comment": "", + "creation_time": "2025-01-23T06:35:20.241793+00:00", + "file_version": "1.0.0", + "name": "pymoo_nsgaii", + "runs": [ + { + "metadata": {}, + "problem": "ZDT2 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6ef2547b766f5c0e0c1b4a7a669e79b0f80a0573c19bcfa92916a5bd2d0865ec", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "3b2d74eed2b6600433de939b181f2856fd70cff92d1e32909ac7ac88a1f77c28" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "d72378e6876da22c921ab3fc3eefd7819270cbbd3afa55980d0cc463780f1f92", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "119795280e0e1fb558ecef619d4b6083f4aecbcc34cee074fce3fc6954aeae39" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "63ac40cd8836c2cdab7f178f90bc5247bc5daeb2eaaf690410bece0665a1596d", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "b37443ac45a3bde81bca6686a6944783486812472181ac3619e2ee855dec6d59" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "3863e156bd760f5e00a58464aa387ac7c525ed79dbf3bd1abb96b0d2e9c6e98c", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1630ebf46c0d910fff487a13b95c3072fd90f0ff1fe24b97c36efc63bca838b0" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "90663b84faf4eeee5372ec36847b236903fe3249b28b94c844309b32ba5b218e", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "dd1e5b71e3d6215173745aae9e64219982ff4062d5a8345c977c20e649b5a5cb" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6a0df6ed710e2f349f429ccd3b29a654a20c0e6fa03cfcc77f8cd492bf7be2ad", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "be66f8a208a6bf59dc4478761cfac501d598fe3871587234d3cdeb1b275732e5" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "1a0d039137bf9e195eb911a69cccfa4348ac7b698e251b146c33ce06f7a27974", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "f991d73ee8b4949445a5f91f3dadde91552dd973a3f67bf833031a3b144241d2" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "f51f27723bda99e1d1fb58ca1258be7d8a6677257354499db60d9986c4c2116d", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "09ab4b8ea994852ca3fa95538e26ee13239892b70c3c985ba1976950ee710cc9" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT4 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "f3d8b4ddd27270ef768ad55db5e15681bc2e13d0922a12350aecc2689fbd27bf", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "5129b12bc092720878f65ea8e8e64c9c8e10bc6525b860065f50f205af1aaa30" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e94ea63c3aa76d2fc94db8501c1c2555997f6f831a83cbdfabbf55e253e928d5", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c80488e2e77c8c7fb07e192a8f9cd13b42f72f11d0fa163d719bc88f2bf1d4b7" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "1e26e89ab423e07553bc582e2df113ef849fced6d9f09809eded126e46d1e901", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "ee1f2f7ef29d5187d13ee669f998237cafc28ea07ed456c5aa3a0d0bdf515e8c" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "2796ec0c227aaec173372ba44663e84b93f38915267a8a4916d4ea860502c2bb", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "3ece64d9ccb0fb86003eaafa4f6a7856af7be2adb4e245d9ea2c853f3d71e3d8" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "50642459172aa42c87ed005b40e2414faee83b9a49e764cda5f7b6830930e46d", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c0c5551a141602e30a80a6796623b695849388591c00fc82c8b34af0520fb661" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "1cd0551d5f6aee39f63aaa34029532322ee20d2ef5e650af51d5463e915a70c9", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "42625c5e8f003a3d4a1b93de25a9b8fd26b3e2ab9886fa3a97269bcaf8bd02a2" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "33f13258d5820089d726b39d612b4620e7b7f970f4922f515a8183d64936b77f", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "d86d9f3cb6b714bf93d17bd33f7ee0a74498b52698e921a2f0438cf3a07c2df7" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e616c4109069501c99c66937c629510586c8609c22b500ccb85f825f4c4f83a6", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "40aaaf70ad4952885313cd34311f415c24465187959559f82fe86f3aab5b825f" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT6 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e0e28ec4d01a69972325c08995d5bdaf2350b759cefd2db966535d261821f665", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "6bbc30fdb0e0c1d7ec230cf6dc41d161fd6865f24c6df5df9aee491f36051a67" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "aca3ac103d4c8ee93783dadcccb6a57e9f07c37b0b4e565bc1d9028b3f64bfd3", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "8651c618c24b08877aa5dcc7ef1ec4cf8d445b25c1dccc640bbe92ad7f4a16c9" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e09b9166f63c5d4671e954dce67bc03eb832926235a985507030be9d9fb7b5a1", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1ceb5e1607a108f9ab4b93837b9901ddede725dda4d8502d713dd706dbbb6825" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "83e855037241345ec506d23e8855f72fe72b52a262be903a0ad25a9399038aaa", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "8ab0082734025e52fbfe729d76979a91b9c83e39c31320dbb264176f90e38514" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "76d7c3debac2f2ee57adfce503a336dce3838f361952b8d44a63462d6e74c9e0", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "22837213bf2a410f53800c2a28a20a6e650916366556d5f5bd47f2dfd13e7853" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "a435a96b611bdcc901285f96f66cac5943e3358b8421e9f8fb1bf749cfca538c", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "0acad307f3e412fbffc9c901a205f8931d569841749089bc8956539d7c24a281" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "cf4556c4ca7eccf6eeddf758f8a7ef66ae593d0d8be93b7a21ecf502c89d0654", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c2be26ae7b20916e87308eaaab9fffc0462d05f28fe74bdc6c61eac8b1532991" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "58248818992f25f4e508e52d95ca1cce4659004a41950b5a3764aa11d98178dc", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "df3e9b06e4777cfbadd0412e78484785b22d667a11dc906b1659f49b79894f4e" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT4 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "d691cd18dbb18838bec4123a4d0d8c7e835f90b22aafdeda4095b28c80b8a7e0", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "240594fa871c1c47eaa65f8d603b06fad4a635e8a45ddc31a0029e2a6b2d4d1b" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "7a6d8919e0fb1aaed020d49a99a9a2d17f36ceb8edd8a46693c6770661f246bc", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "5ff66c434ffbd1aa9b95d04dd3bd39ce9403d91d0f1034ed30b9cfef08de24b7" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6797bd8f28f60e669261e6022bdff0b5c2e1c0de47ff85bcc6b992c00e3846d3", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "20d33df82efff7fbfcb1657e6fa3bfeac1282030eae63e31511481710a1b4926" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "5b596b5c97559e325701fc5868653604c4d2616367e02d5741fb2ff7e63dbec3", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "d86606ca44168d2515236f57472e6b1ae3731eb10ef7c201567682043228db3b" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "f4e175ab6306bdd5671530108de4f44bc656d3fabdf8550a8df955404c364b25", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "6fdfff6603e039d843b46a1cfaf5b217b8c8d51c7978cbcfbbc541b1a5b8aa81" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "272a5b3264b1e33176c5324090104f631d08ca5f7d22d64a81ddaad26aee50df", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "0a6febc59f3123b6f80343dc5b424dc154f8a53d8bb1948e0c2b56f5eff95c24" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "0170cad4cb821f3f58c066960e3b0fcb54794f75aa42be3cace7b7eca12c4f12", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c22b349b1a39dda308828bd41499db3b9fef874516ce53e0e08a4af716d9ff9c" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "392486399ede2b9157b1df8a6d9d4f90fcd5777950ad01dbf31940e262f06071", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "270bcb920898d79b9fd67c9a5c89133bf40a76366641cf3d0227ed42259cef19" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT2 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "d08c61f3f2168b0f6e226b2548fc375cd36cf85cb2d7f89c6c961f0063b9348d", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "936910b0844695c0bdb24f530781a2d6c2436c76d19958de2f391c13648a9da5" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "02e88b3e3d7e7fdc8bfc088532a514da6e43f4a0afc45c7b7141e77429b4d8fb", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1d5b2eff103a96a2046b11f9e416750346ebb1359bd9e376ea1f24893be184b2" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "06f3d123e38631cf0151cd1da0bc3c3e7aa1f7203120b204af7fc56746aaa78e", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "55d78e8bf10287f6857049b720c1f83f8a81db87521dc44a8a3b14a165150e7f" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "8ddbf319c9a91e37aa3ccf7921c64cdef577e895dee39eb473cf2804cf3ec24c", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "5172e91510bc1f18b8f47edc1e13604ba0be6d7e2e7f2bad3a49efec6d9fbe51" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "7c21bcd2a979adee4a1d01fda724e8d06925d324585514eca9ff45e18c025455", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "de77677aa32987444792688788dec6c1bc7d3c2509397e1fa9766627625877fb" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6385699107219f7cf1139d33cff4229ac892af89468858d729c1ffe5271746ad", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "733ce3a1c45dcd1f511cd507cdf708d53b2809be50e60cf3a1b0260d47fd3f54" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "551e107bed89f7419eb51492751ec5a432a6185ab620f6fc092f16204185269d", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "a1362da78318ba8f67e36d6cd22d3e50b2345721cc6d308a6dc08e690cc7f8db" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "aca355ba71e0e4af537f8f21116978cded04c2a069c9626f83cbdea23e78aa2c", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "ef9d2bb572962c77dd566adf13ae1ef7d32400b064adbce3f8b023f14c612225" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT6 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "a2d379ca5413eae4f46c3f4c177c5deea378c2ee38e05a6c7d28c7dbf11c573e", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "e6b663e84e7955e5ddf753f9b0d55d89b31305e5c5eb17ae0bdb10dec010e709" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "78329ff6bc79bc0ab6cd38d1578707bbcd8bb0030d6107802fe52b8a4cecbef8", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "45edf82f5a101789bfa222ed329243abcc781ce1a21bbd403ead41260543a9a6" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "fb3c4dee89c97b684c7102a00485c4745cbc91e076d10357a5969732793e7fb4", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "fab599d313a85a247de1647da245c6a43b36833cb171776ea21afcbf1bf0d585" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "445013051931f4bd4453b4d10e02ac5e4659fd2d08b9815eaa672a6593708efb", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "8466b5596f0214a13d971f6552ef11bf90295c22e4c40dd631c659660fe95597" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "432183d689123fca2acaf249a879c67bc723e73a9370a9ebd90055fa92b986e4", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "9a395681bfa39ffdf8de35f84efff9f7aea3e78922fc83a4d592b426894eb3f1" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "79b07472505c0e404300f800870e06986c72fbd1c0616fa5ac98fd756be51e6f", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c19e3f2d09a32777ce4dd264d88d9668d9c3a4d6213f8685b1a75651bf0d8eba" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "75144bd6e9490e2069be779fa5caf7ef3cdb3e26b4b737e2b58e2b85d2354e07", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1103dbced7246f9385555edbd1058382a322f2e52bf2a5909543ac5233193c3b" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "41d6481e13ed66e64cebfd5825d36bb1386802546c1475bb03ea324626da05e9", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "29b0adcb029240572c1254f6184dc30a4a447ee011c62a9fc065af4d420fb715" + } + ] + } + ], + "software": "", + "software_version": "" +} \ No newline at end of file diff --git a/tests/test_data/file_versions/paretobench_file_format_v1.1.0.h5 b/tests/test_data/file_versions/paretobench_file_format_v1.1.0.h5 new file mode 100644 index 0000000..831337a Binary files /dev/null and b/tests/test_data/file_versions/paretobench_file_format_v1.1.0.h5 differ diff --git a/tests/test_data/file_versions/paretobench_file_format_v1.1.0.json b/tests/test_data/file_versions/paretobench_file_format_v1.1.0.json new file mode 100644 index 0000000..bfbb218 --- /dev/null +++ b/tests/test_data/file_versions/paretobench_file_format_v1.1.0.json @@ -0,0 +1,815 @@ +{ + "author": "", + "comment": "", + "creation_time": "2025-01-23T06:35:20.241793+00:00", + "file_version": "1.1.0", + "name": "pymoo_nsgaii", + "runs": [ + { + "metadata": {}, + "problem": "ZDT2 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6ef2547b766f5c0e0c1b4a7a669e79b0f80a0573c19bcfa92916a5bd2d0865ec", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "3b2d74eed2b6600433de939b181f2856fd70cff92d1e32909ac7ac88a1f77c28" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "d72378e6876da22c921ab3fc3eefd7819270cbbd3afa55980d0cc463780f1f92", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "119795280e0e1fb558ecef619d4b6083f4aecbcc34cee074fce3fc6954aeae39" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "63ac40cd8836c2cdab7f178f90bc5247bc5daeb2eaaf690410bece0665a1596d", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "b37443ac45a3bde81bca6686a6944783486812472181ac3619e2ee855dec6d59" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "3863e156bd760f5e00a58464aa387ac7c525ed79dbf3bd1abb96b0d2e9c6e98c", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1630ebf46c0d910fff487a13b95c3072fd90f0ff1fe24b97c36efc63bca838b0" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "90663b84faf4eeee5372ec36847b236903fe3249b28b94c844309b32ba5b218e", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "dd1e5b71e3d6215173745aae9e64219982ff4062d5a8345c977c20e649b5a5cb" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6a0df6ed710e2f349f429ccd3b29a654a20c0e6fa03cfcc77f8cd492bf7be2ad", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "be66f8a208a6bf59dc4478761cfac501d598fe3871587234d3cdeb1b275732e5" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "1a0d039137bf9e195eb911a69cccfa4348ac7b698e251b146c33ce06f7a27974", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "f991d73ee8b4949445a5f91f3dadde91552dd973a3f67bf833031a3b144241d2" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "f51f27723bda99e1d1fb58ca1258be7d8a6677257354499db60d9986c4c2116d", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "09ab4b8ea994852ca3fa95538e26ee13239892b70c3c985ba1976950ee710cc9" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT4 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "f3d8b4ddd27270ef768ad55db5e15681bc2e13d0922a12350aecc2689fbd27bf", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "5129b12bc092720878f65ea8e8e64c9c8e10bc6525b860065f50f205af1aaa30" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e94ea63c3aa76d2fc94db8501c1c2555997f6f831a83cbdfabbf55e253e928d5", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c80488e2e77c8c7fb07e192a8f9cd13b42f72f11d0fa163d719bc88f2bf1d4b7" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "1e26e89ab423e07553bc582e2df113ef849fced6d9f09809eded126e46d1e901", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "ee1f2f7ef29d5187d13ee669f998237cafc28ea07ed456c5aa3a0d0bdf515e8c" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "2796ec0c227aaec173372ba44663e84b93f38915267a8a4916d4ea860502c2bb", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "3ece64d9ccb0fb86003eaafa4f6a7856af7be2adb4e245d9ea2c853f3d71e3d8" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "50642459172aa42c87ed005b40e2414faee83b9a49e764cda5f7b6830930e46d", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c0c5551a141602e30a80a6796623b695849388591c00fc82c8b34af0520fb661" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "1cd0551d5f6aee39f63aaa34029532322ee20d2ef5e650af51d5463e915a70c9", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "42625c5e8f003a3d4a1b93de25a9b8fd26b3e2ab9886fa3a97269bcaf8bd02a2" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "33f13258d5820089d726b39d612b4620e7b7f970f4922f515a8183d64936b77f", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "d86d9f3cb6b714bf93d17bd33f7ee0a74498b52698e921a2f0438cf3a07c2df7" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e616c4109069501c99c66937c629510586c8609c22b500ccb85f825f4c4f83a6", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "40aaaf70ad4952885313cd34311f415c24465187959559f82fe86f3aab5b825f" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT6 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e0e28ec4d01a69972325c08995d5bdaf2350b759cefd2db966535d261821f665", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "6bbc30fdb0e0c1d7ec230cf6dc41d161fd6865f24c6df5df9aee491f36051a67" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "aca3ac103d4c8ee93783dadcccb6a57e9f07c37b0b4e565bc1d9028b3f64bfd3", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "8651c618c24b08877aa5dcc7ef1ec4cf8d445b25c1dccc640bbe92ad7f4a16c9" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "e09b9166f63c5d4671e954dce67bc03eb832926235a985507030be9d9fb7b5a1", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1ceb5e1607a108f9ab4b93837b9901ddede725dda4d8502d713dd706dbbb6825" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "83e855037241345ec506d23e8855f72fe72b52a262be903a0ad25a9399038aaa", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "8ab0082734025e52fbfe729d76979a91b9c83e39c31320dbb264176f90e38514" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "76d7c3debac2f2ee57adfce503a336dce3838f361952b8d44a63462d6e74c9e0", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "22837213bf2a410f53800c2a28a20a6e650916366556d5f5bd47f2dfd13e7853" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "a435a96b611bdcc901285f96f66cac5943e3358b8421e9f8fb1bf749cfca538c", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "0acad307f3e412fbffc9c901a205f8931d569841749089bc8956539d7c24a281" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "cf4556c4ca7eccf6eeddf758f8a7ef66ae593d0d8be93b7a21ecf502c89d0654", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c2be26ae7b20916e87308eaaab9fffc0462d05f28fe74bdc6c61eac8b1532991" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "58248818992f25f4e508e52d95ca1cce4659004a41950b5a3764aa11d98178dc", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "df3e9b06e4777cfbadd0412e78484785b22d667a11dc906b1659f49b79894f4e" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT4 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "d691cd18dbb18838bec4123a4d0d8c7e835f90b22aafdeda4095b28c80b8a7e0", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "240594fa871c1c47eaa65f8d603b06fad4a635e8a45ddc31a0029e2a6b2d4d1b" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "7a6d8919e0fb1aaed020d49a99a9a2d17f36ceb8edd8a46693c6770661f246bc", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "5ff66c434ffbd1aa9b95d04dd3bd39ce9403d91d0f1034ed30b9cfef08de24b7" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6797bd8f28f60e669261e6022bdff0b5c2e1c0de47ff85bcc6b992c00e3846d3", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "20d33df82efff7fbfcb1657e6fa3bfeac1282030eae63e31511481710a1b4926" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "5b596b5c97559e325701fc5868653604c4d2616367e02d5741fb2ff7e63dbec3", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "d86606ca44168d2515236f57472e6b1ae3731eb10ef7c201567682043228db3b" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "f4e175ab6306bdd5671530108de4f44bc656d3fabdf8550a8df955404c364b25", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "6fdfff6603e039d843b46a1cfaf5b217b8c8d51c7978cbcfbbc541b1a5b8aa81" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "272a5b3264b1e33176c5324090104f631d08ca5f7d22d64a81ddaad26aee50df", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "0a6febc59f3123b6f80343dc5b424dc154f8a53d8bb1948e0c2b56f5eff95c24" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "0170cad4cb821f3f58c066960e3b0fcb54794f75aa42be3cace7b7eca12c4f12", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c22b349b1a39dda308828bd41499db3b9fef874516ce53e0e08a4af716d9ff9c" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "392486399ede2b9157b1df8a6d9d4f90fcd5777950ad01dbf31940e262f06071", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "270bcb920898d79b9fd67c9a5c89133bf40a76366641cf3d0227ed42259cef19" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT2 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "d08c61f3f2168b0f6e226b2548fc375cd36cf85cb2d7f89c6c961f0063b9348d", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "936910b0844695c0bdb24f530781a2d6c2436c76d19958de2f391c13648a9da5" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "02e88b3e3d7e7fdc8bfc088532a514da6e43f4a0afc45c7b7141e77429b4d8fb", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1d5b2eff103a96a2046b11f9e416750346ebb1359bd9e376ea1f24893be184b2" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "06f3d123e38631cf0151cd1da0bc3c3e7aa1f7203120b204af7fc56746aaa78e", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "55d78e8bf10287f6857049b720c1f83f8a81db87521dc44a8a3b14a165150e7f" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "8ddbf319c9a91e37aa3ccf7921c64cdef577e895dee39eb473cf2804cf3ec24c", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "5172e91510bc1f18b8f47edc1e13604ba0be6d7e2e7f2bad3a49efec6d9fbe51" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "7c21bcd2a979adee4a1d01fda724e8d06925d324585514eca9ff45e18c025455", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "de77677aa32987444792688788dec6c1bc7d3c2509397e1fa9766627625877fb" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "6385699107219f7cf1139d33cff4229ac892af89468858d729c1ffe5271746ad", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "733ce3a1c45dcd1f511cd507cdf708d53b2809be50e60cf3a1b0260d47fd3f54" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "551e107bed89f7419eb51492751ec5a432a6185ab620f6fc092f16204185269d", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "a1362da78318ba8f67e36d6cd22d3e50b2345721cc6d308a6dc08e690cc7f8db" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "aca355ba71e0e4af537f8f21116978cded04c2a069c9626f83cbdea23e78aa2c", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "ef9d2bb572962c77dd566adf13ae1ef7d32400b064adbce3f8b023f14c612225" + } + ] + }, + { + "metadata": {}, + "problem": "ZDT6 (n=5)", + "reports": [ + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "a2d379ca5413eae4f46c3f4c177c5deea378c2ee38e05a6c7d28c7dbf11c573e", + "fevals": 50, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "e6b663e84e7955e5ddf753f9b0d55d89b31305e5c5eb17ae0bdb10dec010e709" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "78329ff6bc79bc0ab6cd38d1578707bbcd8bb0030d6107802fe52b8a4cecbef8", + "fevals": 100, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "45edf82f5a101789bfa222ed329243abcc781ce1a21bbd403ead41260543a9a6" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "fb3c4dee89c97b684c7102a00485c4745cbc91e076d10357a5969732793e7fb4", + "fevals": 150, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "fab599d313a85a247de1647da245c6a43b36833cb171776ea21afcbf1bf0d585" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "445013051931f4bd4453b4d10e02ac5e4659fd2d08b9815eaa672a6593708efb", + "fevals": 200, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "8466b5596f0214a13d971f6552ef11bf90295c22e4c40dd631c659660fe95597" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "432183d689123fca2acaf249a879c67bc723e73a9370a9ebd90055fa92b986e4", + "fevals": 250, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "9a395681bfa39ffdf8de35f84efff9f7aea3e78922fc83a4d592b426894eb3f1" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "79b07472505c0e404300f800870e06986c72fbd1c0616fa5ac98fd756be51e6f", + "fevals": 300, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "c19e3f2d09a32777ce4dd264d88d9668d9c3a4d6213f8685b1a75651bf0d8eba" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "75144bd6e9490e2069be779fa5caf7ef3cdb3e26b4b737e2b58e2b85d2354e07", + "fevals": 350, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "1103dbced7246f9385555edbd1058382a322f2e52bf2a5909543ac5233193c3b" + }, + { + "constraint_directions": "", + "constraint_targets": [], + "f_sha256": "41d6481e13ed66e64cebfd5825d36bb1386802546c1475bb03ea324626da05e9", + "fevals": 400, + "g_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "m": 2, + "n": 5, + "n_constraints": 0, + "names_f": null, + "names_g": null, + "names_x": null, + "obj_directions": "--", + "pop_size": 50, + "x_sha256": "29b0adcb029240572c1254f6184dc30a4a447ee011c62a9fc065af4d420fb715" + } + ] + } + ], + "software": "", + "software_version": "" +} \ No newline at end of file diff --git a/tests/test_file_versions.py b/tests/test_file_versions.py new file mode 100644 index 0000000..8685fd0 --- /dev/null +++ b/tests/test_file_versions.py @@ -0,0 +1,74 @@ +import h5py +import json +import pytest +import re +from pathlib import Path + +from paretobench import Experiment + +from .utils import experiment_to_manifest + +FILE_VERSION_DIR = Path(__file__).parent / "test_data" / "file_versions" +GENERATOR = "tests/generate_file_version_data.py" + + +def get_file_version_files(): + """ + Returns the saved files of each version of the file format which are used for regression testing. + """ + return sorted(FILE_VERSION_DIR.glob("*.h5")) + + +def version_from_filename(path): + """ + Extract the file format version a saved file is named after. + + Parameters + ---------- + path : Path + Path to the saved file + + Returns + ------- + str + The version in the filename + """ + match = re.search(r"_v(\d+\.\d+\.\d+)\.h5$", path.name) + if match is None: + raise ValueError(f'Could not get a file format version out of the filename "{path.name}"') + return match.group(1) + + +def test_file_version_files_exist(): + """ + Confirms the regression files are where the tests expect them. Without this, a missing or moved directory would + leave the test below parametrized over nothing and silently passing. + """ + assert get_file_version_files(), f"No files found in {FILE_VERSION_DIR}" + + +@pytest.mark.parametrize("path", get_file_version_files(), ids=lambda p: p.stem) +def test_load_file_version(path): + """ + Load a file saved by an earlier version of the library and confirm it still reads back the data which was recorded + in its manifest when it was generated. + """ + exp = Experiment.load(path) + assert exp.file_version == version_from_filename(path) + + with open(path.with_suffix(".json")) as fd: + assert experiment_to_manifest(exp) == json.load(fd) + + +def test_current_file_version_has_file(tmp_path): + # Get the version we are writing by saving a file and reading the version back out of it + probe_path = tmp_path / "probe.h5" + Experiment(name="", runs=[]).save(probe_path) + with h5py.File(probe_path) as fd: + current_version = fd.attrs["file_version"] + + versions = set(map(version_from_filename, get_file_version_files())) + assert current_version in versions, ( + f"No saved file for file format version {current_version}. Files for old versions of the format cannot be " + f"created later, so save one now by running: python {GENERATOR}" + ) diff --git a/tests/utils.py b/tests/utils.py index 7334504..779a43a 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,8 +1,96 @@ +import hashlib import numpy as np from paretobench import Experiment +def array_digest(arr): + """ + Hash a numeric array in a byte order independent way so digests are comparable across platforms. + + Parameters + ---------- + arr : array-like + The array to hash + + Returns + ------- + str + Hex digest of the array contents + """ + return hashlib.sha256(np.ascontiguousarray(arr, dtype="