fix: robustify MOSEGO constraint relaxation and expand convergence tests - #24
Conversation
Coverage Report for CI Build 29764570155Coverage increased (+0.3%) to 87.913%Details
Uncovered Changes
Coverage Regressions3 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
93c1bd7 to
b873a4b
Compare
7408ac4 to
7a13d4b
Compare
131abfc to
0f83ef7
Compare
There was a problem hiding this comment.
Although I believe checking for negative variance before computing the square root would be more numerically stable, theoretically, one objective variance could be less than 1e-12 while the other is not. In that case, the EHVI value would not necessarily be equal to 0.
For example, considering the following values:
Y = np.array([
[3, 1],
[2, 1.5].
[1, 2.5],
])
mu = np.array([2, 1.5])
s = np.array([0.7, 1e-12])
The EHVI value is 0.315, even though s is below 1e-6 (sqrt(1e-12)). Furthermore, variance values below 1e-12 are common in the MF context. I do find the limit quite high.
There was a problem hiding this comment.
Since the CDF is multiplied here, it is indeed possible to skip the MPI calculation, when the variance is too low. On that note, I just realized that the return condition when the variance is null should be 0, not 1 (error was already present prior to this PR). However, I still believe that the tolerance of 1e-12 is too high, especially in the MF context.
There was a problem hiding this comment.
There are already very similar tests in tests/test_integration/test_mosego for:
-
test_zdt1_mosego_ehvi_hypervolume_growth -
test_dtlz5_mosego_multifidelity_constrained
For tests not requiring multi-fidelity, I would recommend using SmtGPX, since it is much faster (except if the purpose was to test MO-SEGO in the mono-fidelity context with the KRG model).
For test_dtlz5_mosego_multifidelity_constrained, the assert condition does not verify the same condition as mentioned in the comment, as the export_as_dict class method returns sample data from every fidelity level.
There was a problem hiding this comment.
If the relax argument is set to 0, I think we should avoid computing the variance as to limit the computation cost. (when dealing with lower or upper value constraints).
|
Thank you so much @oihanc for the work! I've updated the code! |
|
Hi Paul, Thanks for the fixes and for continuing to improve MO-SEGO! I had a couple of questions regarding the unit tests. I'm not sure I fully understand the distinction between Also, would it make sense to move I had originally envisioned the Let me know what you think! |
003e8d5 to
d8776b8
Compare
|
@oihanc I've reduced the number of tests and moved them to reduce the computational time |
This Pull Request finalizes and robustifies the MOSEGO acquisition strategy for multi-objective constrained optimization. It focuses on mathematically correcting the constraint relaxation, enforcing strict seeding compliance, expanding the test suite, and enhancing the notebooks.
• Constraint Relaxation Refactoring
• The relax_constraints parameter has been upgraded from a rigid boolean to a continuous float (default 0.0 ). It now algebraically controls the variance margins applied to constraints (μ ± r × σ).
• Streamlined build_scipy_constraints logic by removing obsolete conditionals for inequality bounds, making the code mathematically precise.
• Extensive Convergence & Unit Testing
• Added hypervolume growth convergence tests for ZDT1 using both EHVI and MPI .
• Added robust constrained convergence tests for BNH ensuring MOSEGO performs flawlessly with both dynamic relaxation ( relax_constraints=2.0 ) and hard constraints ( 0.0 ).
• Substantial unit test coverage added for all MO benchmarks and acquisition functionalities.
• Notebook Enhancements ( multi_obj.ipynb )
• Added visual scatter plots comparing the effects of relax_constraints=2.0 vs 0.0 on the BNH problem (highlighting feasible/infeasible regions).
• Added Pareto front comparisons between EHVI and MPI .
[✓] Code successfully passes ruff check on both src/ and src/tests/
[✓] All Pytest convergence and unit tests pass
[✓] Example notebooks are fully functional and clean