Error with DistanceConstraintAggregation for some XYBoundaryConstraint types
I was running into an issue when using the DistanceConstraintAggregation class, for the purpose of optimizing with SGD as explained in this tutorial https://topfarm.pages.windenergy.dtu.dk/TopFarm2/notebooks/sgd_slsqp_comparison.html.
I was able to reproduce exactly the same error by modifying the tutorial. The tutorial has a rectangular boundary, which is instantiated as
constraint_comp = XYBoundaryConstraint(boundary, 'rectangle')
it also works if the type is 'convex_hull', but if constraint_comp is any type that "might be" non-convex like 'polygon' or 'multi_polygon', it fails with the following error:
RuntimeError: Collected errors for problem 'problem4': : The source and target shapes do not match or are ambiguous for the connection 'pre_constraints.xy_bound_comp.boundaryDistances' to 'constraint_aggregation_comp.boundaryDistances'. The source shape is (9,) but the target shape is (9, 4)
I wonder if it is expected that this should not work for non-convex boundaries, or if it is a bug that can be solved. If it is expected behavior, then I think that a more explicit error message should be presented to the user.
I attach a full notebook (which is just a cut and paste of the tutorial with the aforementioned line modified)
Thanks in advance
S