fix v0.py warm-start and remove redundant calcs in optimize#210
Conversation
|
@g-braeunlich We are attempting a move to beams2d v1 with a minor warm-start fix. Please see the exact changes via The main change: I replaced and also removed a few redundant calculations of |
g-braeunlich
left a comment
There was a problem hiding this comment.
How about inheriting from v0 and only change differing attributes / methods (simulate)?
|
@g-braeunlich I agree with this in principle. I think @ffelten wanted to keep versions of problems self contained in each file for readability and pedagogical purposes, but I don't know if that was for EngiBench or just for EngiOpt, since the latter was more for instructional/learning purposes. Perhaps @ffelten can weigh in |
I believe this makes sense. EngiOpt is a different beast that has some pedagogical goals, utilizing single-file implementations when possible. In EngiBench, I believe we can rely on inheritance or static functions to avoid code duplication, as we are not really aiming to be a simulation lab. |
|
Great then I agree with @g-braeunlich on the suggestion |
|
@g-braeunlich What should we do about |
|
@ffelten what do you think? |
I believe |
I guess this is the other option, that we just hardcode the dataset version as in |
|
@g-braeunlich After further conversation we decided to still define |
|
OK. That looks good to me. On also could think of sharing the if __name__ == "__main__":
main() |
Thanks for the suggestion – this is done. |
|
Are you sure, that the |
|
Just tested it. And for me, if __name__ == "__main__":
main(Beams2D)And it also should be: def main(problem_type: type[Problem]):
"""Provides a way to instantiate the problem without having to pass configs to optimize or simulate later.
Possible sets of nely and nelx: (25, 50), (50, 100), and (100, 200)
If a new nely and nelx are not passed in, uses the default conditions.
"""
problem = problem_type(seed=0) |
|
@g-braeunlich Yes, seems like I missed this minor detail. I tested it and the v0, v1 |
Description
Fixes a warm-start issue where disconnected beam members in generated samples failed to be connected by the optimizer. This requires a shift to beams2d v1 as final optimization results are directly impacted. However, the v0 dataset remains unchanged and is thus manually referenced by v1.
Type of change
Checklist:
pre-commitchecks withpre-commit run --all-filesruff check .andruff formatmypy .