Tests: Limit max iterations in optimize#219
Conversation
5e97a5a to
44e52bb
Compare
d28a518 to
57e8845
Compare
| or problem_class.__module__.startswith("engibench.problems.airfoil") | ||
| or problem_class.__module__.startswith("engibench.problems.heatconduction") | ||
| ): | ||
| if problem_id(problem_class) in {"power_electronics", "airfoil", "heatconduction2d", "heatconduction3d"}: |
There was a problem hiding this comment.
Out of curiosity, why do we skip the checks for airfoil and heat conduction? I can understand power electronics, but the other ones all have optimize methods I believe
There was a problem hiding this comment.
Afaik, airfoil was skipped as it took too long. For heatconduction, I dont remember. However as I removed the blacklisting for heatconduction, I ran into the following error:
TypeError: object of type 'numpy.float64' has no len()
That happens here, on the line
assert len(optistep.obj_values) == expected_obj_countThere was a problem hiding this comment.
Okay sounds like we need to fix this then. Are you able to identify it, or should @MiladHB take a look?
There was a problem hiding this comment.
It really seems that optistep.obj_values is a scalar and not a np.array. But here I am really unsure it that is intended or a bug
There was a problem hiding this comment.
If n_iter > 1, then OptiStep should be an array with length greater than one. Whether it is represented as a 1D array (n_iter,) or a 2D array (n_iter, 1) depends on how we define OptiStep consistently across other problems.
There was a problem hiding this comment.
OK. Not a problem specific question, so question back to @markfuge
There was a problem hiding this comment.
Some more context: all other problems return a 2D array. This includes beams2 which also only has one objective.
There was a problem hiding this comment.
@g-braeunlich I think returning a 2D array makes sense here and we should make heat conduction compatible with this. Bonus is that if we ever have a multi-objective problem then the output format is already compatible, as one can add additional columns.
Anything else you need my input on to resolve here?
There was a problem hiding this comment.
OK. Then there is nothing else I need to know.
markfuge
left a comment
There was a problem hiding this comment.
Overall this is fine @g-braeunlich see comment on why we are skipping airfoil and heat conduction in the optimization tests. If there is a good reason for this then happy to merge as is.
57e8845 to
629fd5c
Compare
BREAKING CHANGE: For heatconduction2d and heatconduction3d, in the `history` return value, the `obj_values` attribute of the items is now no longer a scalar but an array.
629fd5c to
43860a8
Compare
The number can be overridden by using the environment variable ENGIBENCH_MAX_ITER
43860a8 to
5985c4b
Compare
Description
ENGIBENCH_MAX_ITERenv var)Fixes #215
Type of change
Please delete options that are not relevant.
Checklist:
pre-commitchecks withpre-commit run --all-filesruff check .andruff formatmypy .Reviewer Checklist: