You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #27 from FloatingArrayDesign/LineDesignUpdate
Reorganizing the plotOptimization function to
This pull request enhances the LineDesign class by adding unit tracking for design variables and constraints, introducing new angle constraints, and improving the plotting of optimization results. The changes improve clarity, traceability, and usability for both developers and users working with mooring line design optimization.
Units tracking and assignment
Added allVarsUnits to track units for each design variable, and X0Units to associate units with the active design variables. This ensures that units are consistently available throughout the optimization process. [1] [2]
Implemented a dictionary (conUnitsDict) to assign units to each constraint, and updated the constraints dictionary to include these units. An exception is raised if a constraint name is not recognized.
New constraints
Added two new constraint functions: con_min_angle and con_max_angle, enforcing minimum and maximum inclination angles for line sections. These are now available for use in optimization. [1] [2]
Plotting improvements
Refactored and enhanced the plotOptimization method to support both "tall" and "grid" layouts, display units for design variables and constraints, and allow returning the figure and axes for further customization.
'''Plot the optimization trajectory, including design variables, constraints and cost.
1318
+
1319
+
Parameters
1320
+
----------
1321
+
layout : str
1322
+
"tall" (default) or "grid" layout for subplots. The grid will place all d.v.s in the first column, all constraints in the second column, and cost in the third column.
1323
+
'''
1288
1324
iflen(self.log['x']) ==0:
1289
1325
print("No optimization trajectory saved (log is empty). Nothing to plot.")
#info['design']['Gdict' ] = self.evaluateConstraints([])[1] # dict of constraint names and values of evaluated constraint functions
2005
2108
info['design']['Ls' ] = [float(line.L ) forlineinself.ss.lineList] # length of each segment
2006
-
info['design']['Ds' ] = [float(line.type['input_d']) forlineinself.ss.lineList] # *input* diameter of each segment
2109
+
info['design']['Ds' ] = [float(line.type['d_nom']) forlineinself.ss.lineList] # *input* diameter of each segment
2007
2110
info['design']['lineTypes' ] = [str(line.type['material']) forlineinself.ss.lineList] # line type of each segment (may be redundant with what's in arrangement)
2008
2111
info['design']['anchorType'] =self.anchorType# (may be redundant with what's in arrangement)
2009
2112
info['design']['span' ] =float(self.span) # platform-platform of platfom-anchor horizontal span just in case it's changed
0 commit comments