morphopt 4.0.9__tar.gz → 4.0.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. {morphopt-4.0.9 → morphopt-4.0.10}/PKG-INFO +1 -1
  2. {morphopt-4.0.9 → morphopt-4.0.10}/pyproject.toml +1 -1
  3. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/constants.py +12 -14
  4. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/controller.py +7 -0
  5. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/__init__.py +1 -0
  6. morphopt-4.0.10/src/morphopt/optcore/modelparams/fea/joint.py +75 -0
  7. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/feaparams.py +2 -0
  8. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/strategies.py +34 -57
  9. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/updaters.py +100 -66
  10. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/postprocess/archive.py +42 -6
  11. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/postprocess/exports.py +5 -18
  12. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/postprocess/visualization.py +1 -2
  13. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/barriers.py +22 -15
  14. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/surfacefairness.py +83 -19
  15. morphopt-4.0.10/src/morphopt/shapeopt/strategies.py +455 -0
  16. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/update_boundary_part.py +27 -103
  17. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/update_simpmaterial.py +45 -142
  18. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/editing.py +1 -1
  19. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/expressions.py +23 -3
  20. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/fields.py +12 -0
  21. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/finite_element.py +4 -0
  22. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/load_cases.py +1 -1
  23. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/results.py +3 -10
  24. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/validation.py +17 -8
  25. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/codegen/generator.py +13 -14
  26. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/locales/en-US.json +35 -20
  27. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/locales/zh-CN.json +35 -20
  28. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/base_nodes.py +5 -0
  29. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/configuration.py +4 -6
  30. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/loaders.py +13 -14
  31. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/__init__.py +4 -0
  32. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/loads.py +46 -20
  33. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/registry.py +4 -0
  34. morphopt-4.0.10/src/morphopt/ui/model/strategies.py +60 -0
  35. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/presentation/history.py +4 -3
  36. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/visualization/geometry.py +30 -6
  37. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/visualization/loads.py +27 -12
  38. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/observation_pages.py +2 -1
  39. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/updater_editor.py +11 -13
  40. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt.egg-info/PKG-INFO +1 -1
  41. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt.egg-info/SOURCES.txt +1 -0
  42. morphopt-4.0.9/src/morphopt/shapeopt/strategies.py +0 -448
  43. morphopt-4.0.9/src/morphopt/ui/model/strategies.py +0 -83
  44. {morphopt-4.0.9 → morphopt-4.0.10}/README.md +0 -0
  45. {morphopt-4.0.9 → morphopt-4.0.10}/setup.cfg +0 -0
  46. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/__init__.py +0 -0
  47. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/codesign/__init__.py +0 -0
  48. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/codesign/constraints.py +0 -0
  49. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/codesign/offset_boundary_part.py +0 -0
  50. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/codesign/update_offset_boundary_part.py +0 -0
  51. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/opt_runner.py +0 -0
  52. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/__init__.py +0 -0
  53. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/history.py +0 -0
  54. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/__init__.py +0 -0
  55. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/base_model_component.py +0 -0
  56. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/baseparam.py +0 -0
  57. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/base_component.py +0 -0
  58. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/body_force.py +0 -0
  59. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/boundary_condition.py +0 -0
  60. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/contact.py +0 -0
  61. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/couple.py +0 -0
  62. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/point_load.py +0 -0
  63. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/pressure.py +0 -0
  64. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/reference_point.py +0 -0
  65. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/fea/spring.py +0 -0
  66. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/geometry.py +0 -0
  67. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/materials/__init__.py +0 -0
  68. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/materials/base_material.py +0 -0
  69. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/materials/homogeneous_material.py +0 -0
  70. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/materials/models.py +0 -0
  71. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/materialsparams.py +0 -0
  72. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/params.py +0 -0
  73. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/parts/__init__.py +0 -0
  74. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/parts/base_part.py +0 -0
  75. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/parts/box_part.py +0 -0
  76. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/parts/cad_part.py +0 -0
  77. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/parts/fixed_part.py +0 -0
  78. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/modelparams/parts/inp_part.py +0 -0
  79. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/objfunc.py +0 -0
  80. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/protocal.py +0 -0
  81. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/optcore/solver.py +0 -0
  82. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/postprocess/__init__.py +0 -0
  83. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/postprocess/_runtime.py +0 -0
  84. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/postprocess/fields.py +0 -0
  85. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/__init__.py +0 -0
  86. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/boundary_part.py +0 -0
  87. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/__init__.py +0 -0
  88. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/basefuncs.py +0 -0
  89. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/boundarys.py +0 -0
  90. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/distancesurface.py +0 -0
  91. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/shapederivative.py +0 -0
  92. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/objectivefuncs/volumemaximization.py +0 -0
  93. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/__init__.py +0 -0
  94. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/base_constraints.py +0 -0
  95. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/base_surface.py +0 -0
  96. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/brep_surface.py +0 -0
  97. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/bsp_constraints.py +0 -0
  98. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/bsp_surface.py +0 -0
  99. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/cpgeo_constraints.py +0 -0
  100. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/cpgeo_surface.py +0 -0
  101. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/mesh_surface.py +0 -0
  102. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/shapeopt/surfaces/nurbs_face.py +0 -0
  103. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/__init__.py +0 -0
  104. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/objectivefuncs/__init__.py +0 -0
  105. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/objectivefuncs/basefuncs.py +0 -0
  106. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/objectivefuncs/boundarys.py +0 -0
  107. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/objectivefuncs/densityfield.py +0 -0
  108. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/objectivefuncs/sensitivity.py +0 -0
  109. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/objectivefuncs/volfrac.py +0 -0
  110. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/simpmaterial.py +0 -0
  111. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/simp/void_elements.py +0 -0
  112. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/__init__.py +0 -0
  113. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/__main__.py +0 -0
  114. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/app.py +0 -0
  115. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/__init__.py +0 -0
  116. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/cad.py +0 -0
  117. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/completion.py +0 -0
  118. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/definitions.py +0 -0
  119. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/devices.py +0 -0
  120. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/edit_history.py +0 -0
  121. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/editor_routing.py +0 -0
  122. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/part_mesh.py +0 -0
  123. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/part_sets.py +0 -0
  124. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/quickstart.py +0 -0
  125. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/runs.py +0 -0
  126. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/updaters.py +0 -0
  127. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application/values.py +0 -0
  128. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/application_icon.py +0 -0
  129. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/assets/morphopt.svg +0 -0
  130. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/codegen/__init__.py +0 -0
  131. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/codegen/assets.py +0 -0
  132. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/codegen/custom_classes.py +0 -0
  133. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/codegen/snippets.py +0 -0
  134. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/codegen/workspace.py +0 -0
  135. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/i18n.py +0 -0
  136. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/launcher.py +0 -0
  137. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/mainwindow.py +0 -0
  138. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/__init__.py +0 -0
  139. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/chamberlayout.py +0 -0
  140. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/fields.py +0 -0
  141. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/material_models.py +0 -0
  142. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/cad.py +0 -0
  143. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/custom_code.py +0 -0
  144. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/materials.py +0 -0
  145. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/objectives.py +0 -0
  146. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/parts.py +0 -0
  147. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/penalties.py +0 -0
  148. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/structural.py +0 -0
  149. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/surfaces.py +0 -0
  150. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/node_types/symmetry.py +0 -0
  151. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/model/problem.py +0 -0
  152. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/observe_panel.py +0 -0
  153. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/presentation/__init__.py +0 -0
  154. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/presentation/edit_history.py +0 -0
  155. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/presentation/labels.py +0 -0
  156. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/presentation/navigation.py +0 -0
  157. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/presentation/result_fields.py +0 -0
  158. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/processes.py +0 -0
  159. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/refresh.py +0 -0
  160. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/__init__.py +0 -0
  161. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/fonts.py +0 -0
  162. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/manager.py +0 -0
  163. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/palette.py +0 -0
  164. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/styles/__init__.py +0 -0
  165. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/styles/base.qss +0 -0
  166. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/styles/controls.qss +0 -0
  167. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/styles/inputs.qss +0 -0
  168. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/stylesheet.py +0 -0
  169. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/themes/__init__.py +0 -0
  170. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/themes/dark.py +0 -0
  171. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/themes/light.py +0 -0
  172. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/theme/visualization.py +0 -0
  173. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/visualization/__init__.py +0 -0
  174. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/visualization/assets.py +0 -0
  175. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/visualization/rendering.py +0 -0
  176. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/visualization/scene.py +0 -0
  177. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/__init__.py +0 -0
  178. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/asset_browser.py +0 -0
  179. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/case_deletion.py +0 -0
  180. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/codeeditor.py +0 -0
  181. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/collection_controls.py +0 -0
  182. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/controller_editor.py +0 -0
  183. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/custom_classes.py +0 -0
  184. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/definition_actions.py +0 -0
  185. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/definition_manager.py +0 -0
  186. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/edit_history.py +0 -0
  187. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/editor.py +0 -0
  188. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/editor_pages.py +0 -0
  189. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/file_dialogs.py +0 -0
  190. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/finite_element.py +0 -0
  191. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/font_settings.py +0 -0
  192. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/helper_editor.py +0 -0
  193. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/history_dialogs.py +0 -0
  194. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/history_export.py +0 -0
  195. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/labels.py +0 -0
  196. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/load_cases.py +0 -0
  197. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/model_tree.py +0 -0
  198. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/objective_editor.py +0 -0
  199. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/param_form.py +0 -0
  200. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/part_set_list.py +0 -0
  201. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/preview_renderer.py +0 -0
  202. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/problems.py +0 -0
  203. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/quickstart.py +0 -0
  204. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/run_dialogs.py +0 -0
  205. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/sequence_input.py +0 -0
  206. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/solver_editor.py +0 -0
  207. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/source_view.py +0 -0
  208. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/template_insert_dialog.py +0 -0
  209. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/viewer.py +0 -0
  210. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/viewport.py +0 -0
  211. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/visualization_settings.py +0 -0
  212. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/widgets/workspace_objective.py +0 -0
  213. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/workbench.py +0 -0
  214. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/ui/worker.py +0 -0
  215. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/utils/__init__.py +0 -0
  216. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/utils/gradient_check.py +0 -0
  217. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/utils/history_read.py +0 -0
  218. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/utils/paths.py +0 -0
  219. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt/utils/quadrature.py +0 -0
  220. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt.egg-info/dependency_links.txt +0 -0
  221. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt.egg-info/entry_points.txt +0 -0
  222. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt.egg-info/requires.txt +0 -0
  223. {morphopt-4.0.9 → morphopt-4.0.10}/src/morphopt.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: morphopt
3
- Version: 4.0.9
3
+ Version: 4.0.10
4
4
  Summary: A morphing optimization framework using PyTorch and torchfea.
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "morphopt"
3
- version = "4.0.9"
3
+ version = "4.0.10"
4
4
  description = "A morphing optimization framework using PyTorch and torchfea."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -422,9 +422,6 @@ class _Constants:
422
422
  class INIT_LOCATION:
423
423
  DEFAULT = (0.0, 0.0, 0.0)
424
424
 
425
-
426
-
427
-
428
425
  class PERTURBATION_L:
429
426
  DEFAULT = -1.0
430
427
 
@@ -452,7 +449,6 @@ class _Constants:
452
449
  class INIT_LOCATION:
453
450
  DEFAULT = (0.0, 0.0, 0.0)
454
451
 
455
-
456
452
  class PERTURBATION_L:
457
453
  DEFAULT = -1.0
458
454
 
@@ -468,7 +464,6 @@ class _Constants:
468
464
  class INIT_LOCATION:
469
465
  DEFAULT = (0.0, 0.0, 0.0)
470
466
 
471
-
472
467
  class MESH_SURFACE:
473
468
  class PATH_STL:
474
469
  DEFAULT = ""
@@ -1035,7 +1030,9 @@ class _Constants:
1035
1030
 
1036
1031
  class MESH:
1037
1032
  QUADRATIC_ELEMENT_TYPES = {
1038
- "C3D4": "C3D10", "C3D6": "C3D15", "C3D8": "C3D20",
1033
+ "C3D4": "C3D10",
1034
+ "C3D6": "C3D15",
1035
+ "C3D8": "C3D20",
1039
1036
  }
1040
1037
  SURFACE_ELEMENT_LINE_CHUNK_SIZE = 16
1041
1038
  SURFACE_NODE_LINE_CHUNK_SIZE = 16
@@ -1047,6 +1044,8 @@ class _Constants:
1047
1044
  DEFAULT_ELEMENT_ORDER = 1
1048
1045
 
1049
1046
  class FEA:
1047
+ SPHERICAL_JOINT_VALUES = (1.0, 0.0, 0.0, 0.0)
1048
+ SINGLE_DOF_JOINT_VALUES = (*SPHERICAL_JOINT_VALUES, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0)
1050
1049
  DEFAULT_TRANSLATION_DOFS = (0, 1, 2)
1051
1050
  CONTACT_PENALTY_THRESHOLD = 3.0
1052
1051
 
@@ -1062,13 +1061,12 @@ class _Constants:
1062
1061
 
1063
1062
  class SHAPE_CONSTRAINTS:
1064
1063
  class FAIRNESS:
1065
- CURVATURE_LIMIT = 3.0
1066
- METRIC_VARIATION_LIMIT = 0.1
1067
- NONORTHOGONALITY_LIMIT = 0.1
1064
+ CURVATURE_LIMIT = 1.5
1065
+ METRIC_VARIATION_LIMIT = 1.0
1066
+ NONORTHOGONALITY_LIMIT = 0.2
1068
1067
  ACTIVATION_RATIO = 0.8
1069
1068
  BSP_EXPONENT = 3
1070
1069
  CPGEO_EXPONENT = 3
1071
- REFERENCE_METRIC_RATIO = 0.2
1072
1070
 
1073
1071
  BARRIER_THRESHOLD = 0.05
1074
1072
  BARRIER_RATIO = 0.0
@@ -1102,19 +1100,19 @@ class _Constants:
1102
1100
  class UPDATER_STRATEGIES:
1103
1101
  DEFAULT_CONSTRAINT_WEIGHT = 1.0
1104
1102
 
1105
- class ADAPTIVE_SHAPE_WEIGHTS:
1103
+ class ADAPTIVE_SHAPE_UPDATE:
1104
+ MAX_SOLVES = 3
1106
1105
  PROBE_FRACTION = 0.5
1107
1106
  SAFETY_FACTOR = 2.0
1108
1107
  BALANCE_RATIO = 0.25
1109
1108
  TIGHTENING_INCREMENT = 0.0002
1110
1109
  VIOLATION_TOLERANCE = 0.1
1111
1110
  VIOLATION_BAND_RATIO = 2.0
1112
- VIOLATION_WEIGHT_POWER = 2.0
1113
1111
  WEIGHT_CHANGE_LIMIT = 10.0
1114
- WEIGHT_UPDATE_FRACTION = 0.1
1115
1112
  INITIAL_TOLERANCE = 0.05
1116
1113
  FINAL_TOLERANCE = 0.0
1117
1114
  DISTANCE_TRANSITION_RATIO = 0.05
1115
+ RETRY_WEIGHT_INCREASE = 4.0
1118
1116
 
1119
1117
  class OPTIMIZER:
1120
1118
  LINE_SEARCH_C1 = 0.0001
@@ -1128,7 +1126,7 @@ class _Constants:
1128
1126
  LBFGS_MATERIAL_MEMORY_PAIRS = 20
1129
1127
 
1130
1128
  class SHAPE_UPDATE:
1131
- MAX_STEP_ITERATIONS = 100
1129
+ MAX_STEP_ITERATIONS = 50
1132
1130
  MAX_STEP_LENGTH = 0.5
1133
1131
  LOW_STEP_LENGTH_TOLERANCE = 1e-10
1134
1132
  LOW_STEP_LENGTH_ITERATION_LIMIT = 10
@@ -379,6 +379,13 @@ class Controller:
379
379
  self.updater.reinitialize(iteration=self.history.iteration)
380
380
  self.objfun.reinitialize(iteration=self.history.iteration)
381
381
 
382
+ # The checkpoint saved after the update belongs to the next design.
383
+ # Capture the geometry after refinement, as used by this iteration's FEA.
384
+ self.params.geometry.save(
385
+ foldpath=os.path.join(self.path_result, "log", "evaluated", str(self.history.iteration + 1)),
386
+ iteration=self.history.iteration + 1,
387
+ )
388
+
382
389
  # Perform the optimization step
383
390
  logger.info(f"Creating FEA model for iteration {self.history.iteration}...")
384
391
  self.objfun.fe = self.params.create_feamodel(
@@ -2,6 +2,7 @@ from .base_component import BaseFEAComponent
2
2
  from .pressure import Pressure
3
3
  from .contact import Contact, SelfContact
4
4
  from .point_load import ConcentratedForce, ConcentratedMoment
5
+ from .joint import SingleDoFJoint, SphericalJoint
5
6
  from .spring import SpringToGround, SpringBetweenRPs, PenaltyDoF
6
7
  from .couple import Couple
7
8
  from .boundary_condition import BoundaryCondition, ReferencePointBoundaryCondition
@@ -0,0 +1,75 @@
1
+ """TorchFEA penalty joints connecting two six-DoF reference points."""
2
+
3
+ from torchfea import FEAController
4
+ from torchfea.model import loads
5
+
6
+ from ....constants import CONSTANT
7
+ from .base_component import BaseFEAComponent
8
+
9
+
10
+ class _ReferencePointJoint(BaseFEAComponent):
11
+ """Register the two endpoints and apply the common per-case joint parameters."""
12
+
13
+ default_values = CONSTANT.KERNEL.FEA.SPHERICAL_JOINT_VALUES
14
+
15
+ def __init__(self, rp_name1: str, rp_name2: str) -> None:
16
+ """Connect two distinct reference points.
17
+
18
+ Args:
19
+ rp_name1: Reference point carrying the joint's local frame.
20
+ rp_name2: Reference point whose relative motion is constrained.
21
+ """
22
+ super().__init__()
23
+ self.rp_name1 = rp_name1
24
+ self.rp_name2 = rp_name2
25
+ self._values = list(self.default_values)
26
+
27
+ @property
28
+ def num_values(self) -> int:
29
+ """Number of scalar joint parameters in a load case."""
30
+ return len(self.default_values)
31
+
32
+ def apply_fea_value(self, fe: FEAController, name: str) -> None:
33
+ """Apply the penalty stiffness and initial global connection point."""
34
+ joint = fe.assembly.get_load(name)
35
+ joint.k = self._values[0]
36
+ joint.connection_point = self._values[1:4]
37
+
38
+
39
+ class SphericalJoint(_ReferencePointJoint):
40
+ """Constrain relative translation at a point and allow all relative rotations.
41
+
42
+ Load-case values are [k, x, y, z], with positive penalty stiffness k.
43
+ """
44
+
45
+ def modify_fea(self, fe: FEAController, name: str) -> None:
46
+ """Register the spherical joint with the assembly before case selection."""
47
+ joint = loads.SphericalJoint(
48
+ self.rp_name1, self.rp_name2,
49
+ connection_point=self._values[1:4], k=self._values[0],
50
+ )
51
+ fe.assembly.add_load(joint, name)
52
+
53
+
54
+ class SingleDoFJoint(_ReferencePointJoint):
55
+ """Allow one relative motion in RP 1's frame and penalize the other five.
56
+
57
+ Load-case values are [k, x, y, z, tx, ty, tz, rx, ry, rz]. The final
58
+ six entries specify a nonzero free direction, initially in global axes.
59
+ """
60
+
61
+ default_values = CONSTANT.KERNEL.FEA.SINGLE_DOF_JOINT_VALUES
62
+
63
+ def modify_fea(self, fe: FEAController, name: str) -> None:
64
+ """Register the single-DoF joint with the assembly before case selection."""
65
+ joint = loads.SingleDoFJoint(
66
+ self.rp_name1, self.rp_name2,
67
+ connection_point=self._values[1:4], free_direction=self._values[4:],
68
+ k=self._values[0],
69
+ )
70
+ fe.assembly.add_load(joint, name)
71
+
72
+ def apply_fea_value(self, fe: FEAController, name: str) -> None:
73
+ """Apply the common joint parameters and the case's free direction."""
74
+ super().apply_fea_value(fe, name)
75
+ fe.assembly.get_load(name).free_direction = self._values[4:]
@@ -22,6 +22,8 @@ class FEAParams(BaseParams):
22
22
  PenaltyDoF,
23
23
  Pressure,
24
24
  ReferencePoint,
25
+ SingleDoFJoint,
26
+ SphericalJoint,
25
27
  SpringBetweenRPs,
26
28
  SpringToGround,
27
29
  )
@@ -1,8 +1,9 @@
1
- """Selectable policies for outer-iteration step limits and penalty weights."""
1
+ """Update strategies shared by geometry and material subproblems."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from abc import ABC, abstractmethod
5
+ import math
6
+ from abc import abstractmethod
6
7
  from collections.abc import Sequence
7
8
  from typing import TYPE_CHECKING
8
9
 
@@ -14,19 +15,17 @@ from .protocal import ProtocalHistory, ProtocalSavable
14
15
  if TYPE_CHECKING:
15
16
  from .updaters import BaseUpdater
16
17
 
17
- __all__ = [
18
- "ConstantConstraintWeights",
19
- "ConstraintWeightStrategy",
20
- "FixedStepLength",
21
- "StepLengthStrategy",
22
- ]
18
+ __all__ = ["UpdateStrategy", "FixedUpdate"]
23
19
 
24
20
 
25
- class StepLengthStrategy(ABC):
26
- """Choose limits before building a subproblem; never change FEA gradients."""
21
+ class UpdateStrategy(ProtocalSavable, ProtocalHistory):
22
+ """Choose step limits, initial penalty weights, and the candidate to commit.
27
23
 
28
- @abstractmethod
29
- def __call__(
24
+ Each updater owns one policy instance across outer iterations. Its save/load and
25
+ history hooks cover state shared by all three decisions.
26
+ """
27
+
28
+ def step_lengths(
30
29
  self,
31
30
  updater: BaseUpdater,
32
31
  parameters: Sequence[torch.Tensor],
@@ -49,51 +48,12 @@ class StepLengthStrategy(ABC):
49
48
  design-variable order.
50
49
 
51
50
  Returns:
52
- list[torch.Tensor]: One limit per row of each parameter block.
53
- """
54
-
55
-
56
- class FixedStepLength(StepLengthStrategy):
57
- """Use the configured maximum for every point and every outer iteration."""
58
-
59
- def __call__(
60
- self,
61
- updater: BaseUpdater,
62
- parameters: Sequence[torch.Tensor],
63
- maximum: float,
64
- gradient: torch.Tensor | None,
65
- ) -> list[torch.Tensor]:
66
- """Evaluate FixedStepLength for the supplied inputs.
67
-
68
- Args:
69
- updater (BaseUpdater): Updater bound to the target whose policy or state is being
70
- evaluated.
71
- parameters (Sequence[torch.Tensor]): Parameter values in the order required by the
72
- selected interface.
73
- maximum (float): Configured upper limit on each design-variable movement.
74
- gradient (torch.Tensor | None): Unscaled physical objective gradient in the target's
75
- design-variable order.
76
-
77
- Returns:
78
- list[torch.Tensor]: One vector per parameter block, with each row assigned maximum on
79
- that block's dtype and device.
51
+ list[torch.Tensor]: A finite, nonnegative limit per row of each parameter block.
80
52
  """
81
53
  return [value.new_full((len(value),), maximum) for value in parameters]
82
54
 
83
-
84
- class ConstraintWeightStrategy(ProtocalSavable, ProtocalHistory):
85
- """Choose named penalty coefficients before the inner optimization begins.
86
-
87
- The policy may retain state through the save/load protocol and expose dynamic history
88
- information. It must not rescale the physical FEA gradient or change coefficients while the
89
- inner objective is being differentiated.
90
- """
91
-
92
- # Stateful strategies implement save/load; stateless ones inherit no-op hooks.
93
- # The core invokes the interface without interpreting the design object.
94
-
95
55
  @abstractmethod
96
- def __call__(
56
+ def constraint_weights(
97
57
  self, updater: BaseUpdater, gradient: torch.Tensor,
98
58
  ) -> dict[str, float]:
99
59
  """Return coefficients keyed by ``updater.constraints_funcs``.
@@ -109,11 +69,26 @@ class ConstraintWeightStrategy(ProtocalSavable, ProtocalHistory):
109
69
  design-variable order.
110
70
 
111
71
  Returns:
112
- dict[str, float]: Coefficients keyed by ``updater.constraints_funcs``.
72
+ dict[str, float]: One finite, nonnegative coefficient per registered constraint.
73
+ """
74
+
75
+ def solve_update(
76
+ self, updater: BaseUpdater, origin: torch.Tensor,
77
+ ) -> torch.Tensor:
78
+ """Select an update from solves of the current outer subproblem.
79
+
80
+ Args:
81
+ updater (BaseUpdater): Owner of the objective and current constraint weights.
82
+ origin (torch.Tensor): Starting design coordinates of the outer update.
83
+
84
+ Returns:
85
+ torch.Tensor: Candidate to commit. The default accepts the first solution.
86
+ A policy can adjust weights between calls and select a different candidate.
113
87
  """
88
+ return updater.solve_subproblem(origin)
114
89
 
115
90
 
116
- class ConstantConstraintWeights(ConstraintWeightStrategy):
91
+ class FixedUpdate(UpdateStrategy):
117
92
  """Assign the same explicit coefficient to every registered penalty."""
118
93
 
119
94
  def __init__(
@@ -124,12 +99,14 @@ class ConstantConstraintWeights(ConstraintWeightStrategy):
124
99
  Args:
125
100
  value (float): Nonnegative penalty multiplier applied unchanged at each outer update.
126
101
  """
102
+ if not math.isfinite(value) or value < 0:
103
+ raise ValueError("Fixed penalty weight must be finite and nonnegative.")
127
104
  self.value = value
128
105
 
129
- def __call__(
106
+ def constraint_weights(
130
107
  self, updater: BaseUpdater, gradient: torch.Tensor,
131
108
  ) -> dict[str, float]:
132
- """Evaluate ConstantConstraintWeights for the supplied inputs.
109
+ """Evaluate FixedUpdate for the supplied inputs.
133
110
 
134
111
  Args:
135
112
  updater (BaseUpdater): Updater bound to the target whose policy or state is being
@@ -1,11 +1,12 @@
1
+ import logging
1
2
  import os
2
- import math
3
- from collections.abc import Callable, Sequence
3
+ from collections.abc import Callable
4
4
  from pathlib import Path
5
5
  from typing import Literal, TypeAlias
6
6
 
7
7
  import numpy as np
8
8
  import torch
9
+ from tabulate import tabulate
9
10
 
10
11
  import morphopt
11
12
 
@@ -15,12 +16,12 @@ from .modelparams.materials.base_material import BaseMaterial
15
16
  from .modelparams.parts.base_part import BasePart
16
17
  from .protocal import ProtocalHistory, ProtocalInitializable, ProtocalSavable
17
18
  from .strategies import (
18
- ConstantConstraintWeights,
19
- ConstraintWeightStrategy,
20
- FixedStepLength,
21
- StepLengthStrategy,
19
+ FixedUpdate,
20
+ UpdateStrategy,
22
21
  )
23
22
 
23
+ logger = logging.getLogger(__name__)
24
+
24
25
  UpdaterCollection: TypeAlias = GeometryParams | MaterialsParams
25
26
  """Collections from which :class:`Updaters` resolves a target."""
26
27
 
@@ -385,6 +386,8 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
385
386
  update_kind: str = ""
386
387
  """Kind of collection this updater updates (``geometry`` / ``materials``)."""
387
388
 
389
+ _lbfgs_memory_pairs = CONSTANT.KERNEL.OPTIMIZER.LBFGS_MEMORY_PAIRS
390
+
388
391
  target_type: UpdaterTargetType | None = None
389
392
  """Interface type accepted by this updater, or ``None`` for any target."""
390
393
 
@@ -625,8 +628,7 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
625
628
  self,
626
629
  interface_name: str | None = None,
627
630
  *,
628
- step_length_strategy: StepLengthStrategy | None = None,
629
- constraint_weight_strategy: ConstraintWeightStrategy | None = None,
631
+ update_strategy: UpdateStrategy | None = None,
630
632
  ) -> None:
631
633
  """Initialize the BaseUpdater.
632
634
 
@@ -636,10 +638,8 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
636
638
  Args:
637
639
  interface_name (str | None): Registered target name; None allows the updater collection
638
640
  to supply the name.
639
- step_length_strategy (StepLengthStrategy | None): Policy that freezes movement limits
640
- before solving the inner subproblem.
641
- constraint_weight_strategy (ConstraintWeightStrategy | None): Policy that freezes named
642
- penalty coefficients before the inner solve.
641
+ update_strategy (UpdateStrategy | None): Policy for step limits, penalty weights and
642
+ subproblem candidate selection.
643
643
  """
644
644
 
645
645
  self._interface_name: str = (
@@ -656,22 +656,18 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
656
656
  self.constraints_funcs: dict[str, object] = {}
657
657
  """Constraints registered by this updater."""
658
658
 
659
- self.step_length_strategy = (
660
- FixedStepLength() if step_length_strategy is None else step_length_strategy
661
- )
662
- self.constraint_weight_strategy = (
663
- ConstantConstraintWeights()
664
- if constraint_weight_strategy is None else constraint_weight_strategy
659
+ self.update_strategy = (
660
+ FixedUpdate()
661
+ if update_strategy is None else update_strategy
665
662
  )
666
663
  self.constraint_weights: dict[str, float] = {}
667
664
  self.iteration_total: int = 0
665
+ self.solve_count: int = 0
668
666
  self.objective_value: float | None = None
669
667
  """Current high-fidelity objective, supplied before building a subproblem."""
670
668
 
671
- self.optimizer: BaseUpdater.Optimizer.BaseOpt = None
672
- """The optimization algorithm used to update the design variables.
673
- This should be set to an instance of a subclass of Optimizer.BaseOpt.
674
- """
669
+ self.optimizer: BaseUpdater.Optimizer.BaseOpt | None = None
670
+ """Inner optimizer of the current or most recent trial in this outer update."""
675
671
 
676
672
  def history_data(self) -> dict[str, object]:
677
673
  """Describe this iteration's coefficients without reevaluating the loss.
@@ -682,51 +678,25 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
682
678
  """
683
679
  return {
684
680
  "iterations": self.iteration_total,
681
+ "solves": self.solve_count,
685
682
  "constraint_weights": self.constraint_weights,
686
- "constraint_weight_state": self.constraint_weight_strategy.history_data(),
683
+ "update_strategy_state": self.update_strategy.history_data(),
687
684
  }
688
685
 
689
- def _prepare_step_lengths(
690
- self,
691
- parameters: Sequence[torch.Tensor],
692
- maximum: float,
693
- gradient: torch.Tensor | None = None,
694
- ) -> list[torch.Tensor]:
695
- """Evaluate the selected policy and freeze its per-block limits.
696
-
697
- Args:
698
- parameters (Sequence[torch.Tensor]): Parameter values in the order required by the
699
- selected interface.
700
- maximum (float): Configured upper limit on each design-variable movement.
701
- gradient (torch.Tensor | None): Unscaled physical objective gradient in the target's
702
- design-variable order.
686
+ def reinitialize(self, gradient: torch.Tensor) -> None:
687
+ """Set penalty weights and clear the previous outer update's trial state.
703
688
 
704
- Returns:
705
- list[torch.Tensor]: Frozen per-row movement limits, in target parameter-block order.
706
- """
707
- steps = self.step_length_strategy(self, parameters, maximum, gradient)
708
- if len(steps) != len(parameters):
709
- raise ValueError("Step lengths must match the parameter blocks.")
710
- for step, parameter in zip(steps, parameters):
711
- if step.shape != (len(parameter),):
712
- raise ValueError("Step lengths must contain one value per parameter row.")
713
- if not torch.isfinite(step).all() or (step < 0).any():
714
- raise ValueError("Step lengths must be finite and nonnegative.")
715
- return [step.detach().clone() for step in steps]
716
-
717
- def _prepare_constraint_weights(self, gradient: torch.Tensor) -> None:
718
- """Evaluate the selected policy once, after initializing all terms.
689
+ Subclasses call this after preparing their step limits, objectives and constraints
690
+ so the strategy can evaluate the current subproblem.
719
691
 
720
692
  Args:
721
693
  gradient (torch.Tensor): Unscaled physical objective gradient in the target's
722
694
  design-variable order.
723
695
  """
724
- weights = self.constraint_weight_strategy(self, gradient)
725
- if weights.keys() != self.constraints_funcs.keys():
726
- raise ValueError("Constraint weights must match the registered constraint names.")
727
- if any(not math.isfinite(weight) or weight < 0 for weight in weights.values()):
728
- raise ValueError("Constraint weights must be finite and nonnegative.")
729
- self.constraint_weights = {name: float(weight) for name, weight in weights.items()}
696
+ self.constraint_weights = self.update_strategy.constraint_weights(self, gradient)
697
+ self.iteration_total = 0
698
+ self.solve_count = 0
699
+ self.optimizer = None
730
700
 
731
701
  def _weighted_constraints(self, values: list[torch.Tensor]) -> list[torch.Tensor]:
732
702
  """Weighted penalty contributions shared by loss evaluation and logging.
@@ -744,6 +714,56 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
744
714
  for name, value in zip(self.constraints_funcs, values, strict=True)
745
715
  ]
746
716
 
717
+ def solve_subproblem(self, origin: torch.Tensor, *, iterations: int | None = None) -> torch.Tensor:
718
+ """Solve one trial with fresh L-BFGS history and a copy of the starting coordinates.
719
+
720
+ Args:
721
+ origin (torch.Tensor): Coordinates at the start of this solve.
722
+ iterations (int | None): Inner iterations available to this stage. Defaults to the full budget.
723
+
724
+ Returns:
725
+ torch.Tensor: Candidate computed with the current penalty weights.
726
+ """
727
+ self.optimizer = self.Optimizer.LBFGS(
728
+ closure=self.closure,
729
+ num_limit=self._lbfgs_memory_pairs,
730
+ tol_error=CONSTANT.KERNEL.OPTIMIZER.LBFGS_CONVERGENCE_TOLERANCE,
731
+ )
732
+ variables = origin.detach().clone()
733
+ self.solve_count += 1
734
+ small_steps = 0
735
+ gradient = None
736
+ budget = self.max_step_iter if iterations is None else iterations
737
+ logger.info("Updating %s: subproblem solve %d, at most %d steps.",
738
+ self.interface_name or self.update_kind, self.solve_count, budget)
739
+ for iteration in range(1, budget + 1):
740
+ self.iteration_total += 1
741
+ alpha, direction, gradient = self.optimizer.step(x_now=variables, gk_now=gradient)
742
+ displacement = direction * alpha
743
+ with torch.no_grad():
744
+ variables.add_(displacement)
745
+ if displacement.abs().max() < self._low_step_length_tolerance:
746
+ small_steps += 1
747
+ else:
748
+ small_steps = 0
749
+ if small_steps > self._low_step_length_iteration_limit:
750
+ logger.info("Stopping after %d consecutive small steps.", small_steps)
751
+ break
752
+
753
+ if iteration % self._status_log_interval == 0:
754
+ with torch.no_grad():
755
+ objectives, raw_penalties = self.closure(variables, return_list=True)
756
+ terms = [*objectives, *self._weighted_constraints(raw_penalties)]
757
+ headers = ["Iteration", "Total", *self.obj_funcs, *self.constraints_funcs]
758
+ values = [f"{value.item():.6e}" for value in (sum(terms), *terms)]
759
+ row = [f"{iteration}/{budget}", *values]
760
+ table = tabulate([row], headers=headers, tablefmt="grid")
761
+ if iteration > 1:
762
+ print("\033[F\033[K" * 4, end="\r")
763
+ print(table, end="\r")
764
+ logger.debug("\n%s", table)
765
+ return variables.detach()
766
+
747
767
  def define_objective(self) -> None:
748
768
  """Register this updater's objective functions and constraints.
749
769
 
@@ -790,9 +810,10 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
790
810
  """
791
811
  self._add_named_function(self.constraints_funcs, obj_func, name)
792
812
 
793
- def closure(self, x: torch.Tensor, return_list: bool = False) -> torch.Tensor:
794
- """This method is called to update the design variables based on the optimization algorithm
795
- used.
813
+ def closure(
814
+ self, x: torch.Tensor, return_list: bool = False,
815
+ ) -> torch.Tensor | tuple[list[torch.Tensor], list[torch.Tensor]]:
816
+ """Evaluate the current subproblem at the supplied design coordinates.
796
817
 
797
818
  Args:
798
819
  x (torch.Tensor): The current design variables.
@@ -800,7 +821,8 @@ class BaseUpdater(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
800
821
  returns their sum.
801
822
 
802
823
  Returns:
803
- torch.Tensor: The objective function value(s).
824
+ torch.Tensor | tuple[list[torch.Tensor], list[torch.Tensor]]: Weighted loss, or the
825
+ separate lists of raw objective and constraint terms.
804
826
  """
805
827
  raise NotImplementedError("This method should be overridden by subclasses.")
806
828
 
@@ -1270,14 +1292,20 @@ class Updaters(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
1270
1292
  directory = updater.save_directory(
1271
1293
  foldpath, updater.interface_name or "all"
1272
1294
  )
1273
- updater.constraint_weight_strategy.save(
1274
- foldpath=os.path.join(directory, "constraint_weights"), iteration=iteration,
1295
+ updater.update_strategy.save(
1296
+ foldpath=os.path.join(directory, "update_strategy"), iteration=iteration,
1275
1297
  )
1276
1298
  for name, objective in updater.obj_funcs.items():
1277
1299
  objective.save(
1278
1300
  foldpath=os.path.join(directory, "objectives", name),
1279
1301
  iteration=iteration,
1280
1302
  )
1303
+ for name, constraint in updater.constraints_funcs.items():
1304
+ if isinstance(constraint, ProtocalSavable):
1305
+ constraint.save(
1306
+ foldpath=os.path.join(directory, "constraints", name),
1307
+ iteration=iteration,
1308
+ )
1281
1309
 
1282
1310
  def load(self, foldpath: str, iteration: int) -> None:
1283
1311
  """Restore the state of every sub-updater.
@@ -1291,14 +1319,20 @@ class Updaters(ProtocalInitializable, ProtocalSavable, ProtocalHistory):
1291
1319
  directory = updater.save_directory(
1292
1320
  foldpath, updater.interface_name or "all"
1293
1321
  )
1294
- updater.constraint_weight_strategy.load(
1295
- foldpath=os.path.join(directory, "constraint_weights"), iteration=iteration,
1322
+ updater.update_strategy.load(
1323
+ foldpath=os.path.join(directory, "update_strategy"), iteration=iteration,
1296
1324
  )
1297
1325
  for name, objective in updater.obj_funcs.items():
1298
1326
  objective.load(
1299
1327
  foldpath=os.path.join(directory, "objectives", name),
1300
1328
  iteration=iteration,
1301
1329
  )
1330
+ for name, constraint in updater.constraints_funcs.items():
1331
+ if isinstance(constraint, ProtocalSavable):
1332
+ constraint.load(
1333
+ foldpath=os.path.join(directory, "constraints", name),
1334
+ iteration=iteration,
1335
+ )
1302
1336
 
1303
1337
  def pathlog_required(self) -> list[str]:
1304
1338
  """The log sub-paths every sub-updater needs (deduplicated).