From 58fce936dc99c20d49294388e605c94950820552 Mon Sep 17 00:00:00 2001 From: Olaf Mersmann Date: Wed, 22 Apr 2026 23:30:22 +0200 Subject: [PATCH] fix: Change unknown value of YesNoSome to "unknown" The diff for problems.yaml is larger than it needs to be because I regenerted the file using examples/problems.py and the order in which the sets are serialized is not stable. Relevant are only the changes made in the examples/problems.py, the yaml file is just the serialization of the problem definitions. Fixes #178 --- SCHEMA.md | 2 +- examples/problems.py | 4 +- problems.yaml | 138 +++++++++++++++++++------------------- src/opltools/yesnosome.py | 2 +- tests/test_yesnosome.py | 2 +- 5 files changed, 74 insertions(+), 74 deletions(-) diff --git a/SCHEMA.md b/SCHEMA.md index 60bf7b1..f5d6f18 100644 --- a/SCHEMA.md +++ b/SCHEMA.md @@ -318,5 +318,5 @@ For example only some constraints might hard but we don't know the exact number ```yaml constraints: [{type: box, hard: some}] -allows_partial_evaluation: "?" +allows_partial_evaluation: "unknown" ``` diff --git a/examples/problems.py b/examples/problems.py index 7011a89..af82020 100644 --- a/examples/problems.py +++ b/examples/problems.py @@ -543,7 +543,7 @@ name="MOrepo", objectives={2}, variables=[Variable(type="unknown")], - constraints=[Constraint(hard="?")], + constraints=[Constraint(hard="unknown")], dynamic_type={"unknown"}, noise_type={"unknown"}, implementations={"impl_morepo"}, @@ -1256,7 +1256,7 @@ name="CEC2015-DMOO", objectives={2, 3}, variables=[Variable(type="continuous")], - constraints=[Constraint(hard="?")], + constraints=[Constraint(hard="unknown")], dynamic_type={"dynamic"}, references={"ref_benchmark_functions_for_cec"}, ) diff --git a/problems.yaml b/problems.yaml index c348956..3c291b7 100644 --- a/problems.yaml +++ b/problems.yaml @@ -66,11 +66,11 @@ fn_building_spatial: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous fn_convex_dtlz2: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -111,6 +111,10 @@ fn_emdo: can_evaluate_objectives_independently: null code_examples: null constraints: + - equality: null + hard: some + number: null + type: unknown - equality: null hard: yes number: 12 @@ -119,10 +123,6 @@ fn_emdo: hard: yes number: null type: box - - equality: null - hard: some - number: null - type: unknown description: "# Goal\nFind a design of a synchronous electric motor for power steering systems that minimizes costs and satisfies all constraints.\n\n# Motivation\n\ Challenging to find good solutions in a limited time.\n\n# Key Challenges\n* Time-consuming @@ -151,10 +151,10 @@ fn_emdo: tags: null type: problem variables: - - dim: 13 - type: integer - dim: 13 type: continuous + - dim: 13 + type: integer fn_fleetopt: allows_partial_evaluation: yes can_evaluate_objectives_independently: null @@ -224,10 +224,10 @@ fn_gasoline: tags: null type: problem variables: - - dim: 7 - type: continuous - dim: 7 type: integer + - dim: 7 + type: continuous fn_invdeceptive_deceptive_rotell: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -255,11 +255,11 @@ fn_invdeceptive_deceptive_rotell: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous fn_inverted_dtlz1: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -358,11 +358,11 @@ fn_onemax_sphere_deceptive_rotell: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous fn_onemax_sphere_zeromax_sphere: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -390,11 +390,11 @@ fn_onemax_sphere_zeromax_sphere: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous fn_radar_waveform: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -542,15 +542,15 @@ gen_ealain: - dim: max: null min: 1 - type: continuous + type: integer - dim: max: null min: 1 - type: integer + type: binary - dim: max: null min: 1 - type: binary + type: continuous gen_gnbg: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -686,8 +686,8 @@ gen_ma_bbob: evaluation_time: null fidelity_levels: null implementations: - - impl_iohexperimenter - impl_ma_bbob + - impl_iohexperimenter long_name: null modality: - multimodal @@ -749,8 +749,8 @@ gen_mubqp: - impl_mocobench long_name: null modality: - - quadratic - multimodal + - quadratic name: mUBQP noise_type: null objectives: @@ -841,15 +841,15 @@ gen_randoptgen: - dim: max: null min: 1 - type: continuous + type: integer - dim: max: null min: 1 - type: integer + type: binary - dim: max: null min: 1 - type: binary + type: continuous gen_rho_mnk_landscapes: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -902,8 +902,8 @@ gen_rho_mtsp: - impl_mocobench long_name: null modality: - - quadratic - multimodal + - quadratic name: ρmTSP noise_type: null objectives: @@ -1205,8 +1205,8 @@ impl_ma_bbob: impl_mechbench: description: Structural mechanics design optimization benchmark evaluation_time: - - 7 minutes - 1 minute + - 7 minutes language: Python links: - type: repository @@ -1882,15 +1882,15 @@ suite_amvop: - dim: max: null min: 1 - type: continuous + type: integer - dim: max: null min: 1 - type: integer + type: categorical - dim: max: null min: 1 - type: categorical + type: continuous suite_bbob: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -1977,11 +1977,11 @@ suite_bbob_biobj_mixint: - dim: max: 160 min: 5 - type: continuous + type: integer - dim: max: 160 min: 5 - type: integer + type: continuous suite_bbob_constrained: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -2072,11 +2072,11 @@ suite_bbob_mixint: - dim: max: 160 min: 5 - type: continuous + type: integer - dim: max: 160 min: 5 - type: integer + type: continuous suite_bbob_noisy: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -2266,8 +2266,8 @@ suite_cec2013: evaluation_time: null fidelity_levels: null implementations: - - impl_iohexperimenter - impl_cec2013 + - impl_iohexperimenter long_name: null modality: null name: CEC2013 @@ -2292,7 +2292,7 @@ suite_cec2015_dmoo: code_examples: null constraints: - equality: null - hard: '?' + hard: unknown number: null type: unknown description: null @@ -2485,30 +2485,30 @@ suite_cuter: - dim: max: null min: 1 - type: continuous + type: integer - dim: max: null min: 1 - type: integer + type: binary - dim: max: null min: 1 - type: binary + type: continuous suite_cutest: allows_partial_evaluation: no can_evaluate_objectives_independently: null code_examples: null constraints: - - equality: null - hard: yes - number: null - type: box - equality: null hard: some number: max: null min: 1 type: unknown + - equality: null + hard: yes + number: null + type: box description: CUTEst for optimization software dynamic_type: null evaluation_time: null @@ -2533,15 +2533,15 @@ suite_cutest: - dim: max: null min: 1 - type: continuous + type: integer - dim: max: null min: 1 - type: integer + type: binary - dim: max: null min: 1 - type: binary + type: continuous suite_dtlz: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -2719,14 +2719,14 @@ suite_expobench: can_evaluate_objectives_independently: null code_examples: null constraints: - - equality: null - hard: yes - number: null - type: box - equality: null hard: some number: null type: unknown + - equality: null + hard: yes + number: null + type: box description: Wind farm layout optimization, gas filter design, pipe shape optimization, hyperparameter tuning, and hospital simulation dynamic_type: null @@ -2738,8 +2738,8 @@ suite_expobench: modality: null name: EXPObench noise_type: - - real-life - observational + - real-life objectives: - 1 problems: null @@ -2753,15 +2753,15 @@ suite_expobench: - dim: max: 135 min: 10 - type: continuous + type: integer - dim: max: 135 min: 10 - type: integer + type: categorical - dim: max: 135 min: 10 - type: categorical + type: continuous suite_gbea: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -2940,11 +2940,11 @@ suite_l1_zdt: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous suite_l2_dtlz: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -3006,11 +3006,11 @@ suite_l2_zdt: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous suite_l3_dtlz: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -3072,11 +3072,11 @@ suite_l3_zdt: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous suite_maop: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -3333,7 +3333,7 @@ suite_morepo: code_examples: null constraints: - equality: null - hard: '?' + hard: unknown number: null type: unknown description: null @@ -3450,11 +3450,11 @@ suite_re: - dim: max: 7 min: 2 - type: continuous + type: integer - dim: max: 7 min: 2 - type: integer + type: continuous suite_rwmvop: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -3486,15 +3486,15 @@ suite_rwmvop: - dim: max: null min: 1 - type: continuous + type: integer - dim: max: null min: 1 - type: integer + type: categorical - dim: max: null min: 1 - type: categorical + type: continuous suite_sbox_cost: allows_partial_evaluation: null can_evaluate_objectives_independently: null @@ -3598,11 +3598,11 @@ suite_tulipa_energy: code_examples: null constraints: - equality: null - hard: yes + hard: some number: null type: unknown - equality: null - hard: some + hard: yes number: null type: unknown description: Determine the optimal investment and operation decisions for @@ -3727,8 +3727,8 @@ suite_zdt: - dim: max: null min: 1 - type: continuous + type: binary - dim: max: null min: 1 - type: binary + type: continuous diff --git a/src/opltools/yesnosome.py b/src/opltools/yesnosome.py index e10b24a..722a8ea 100644 --- a/src/opltools/yesnosome.py +++ b/src/opltools/yesnosome.py @@ -5,7 +5,7 @@ class YesNoSome(Enum): yes = "yes" no = "no" some = "some" - unknown = "?" + unknown = "unknown" def union( diff --git a/tests/test_yesnosome.py b/tests/test_yesnosome.py index 7667cd4..dfb23bb 100644 --- a/tests/test_yesnosome.py +++ b/tests/test_yesnosome.py @@ -9,7 +9,7 @@ def test_from_string(self): assert YesNoSome("yes") == YesNoSome.yes assert YesNoSome("no") == YesNoSome.no assert YesNoSome("some") == YesNoSome.some - assert YesNoSome("?") == YesNoSome.unknown + assert YesNoSome("unknown") == YesNoSome.unknown def test_bad_string(self): with pytest.raises(ValueError):