Anemone, Karamba 3d and customized C# for MILP assignment optimization

I’ve built a custom C# component in Grasshopper that uses Gurobi to solve a MILP assignment problem for a 2D frame with distinct stock beam and column elements. After each MILP run, I use Karamba3D to perform structural verification (utilization checks) on the assigned elements.

What I want to do is iterate this process: if any member utilization exceeds a limit (e.g. U > 1.0 (however in the image I have used a low utilization to check the flow of data)), the corresponding stock element should be forbidden at that member position in the next MILP run, and a new assignment should be computed.

I’m trying to implement this feedback loop with Anemone by passing two DataTree<int> structures (forbidden beam IDs and forbidden column IDs) through the loop. I initialise them as empty trees in C#, then update them in another C# component that reads the Karamba utilizations and appends (memberIndex, stockIndex) pairs where the utilization is too high.

My problem is that the data structure does not seem to flow correctly through Anemone: the forbidden trees either stay empty or turn into <null> structures, and the MILP component never actually “sees” the updated forbidden indices, so it keeps producing the same infeasible assignment and never iterates.

Can someone help me and show how to wire Anemone correctly for this kind of stateful DataTree<int> feedback (forbidden indices across iterations), and how to safely initialise and pass these trees between the MILP C# component, the utilization-check C# component, and Anemone’s Loop Start / Loop End?

Thank a lot!

2Dframe Version18.gh (130.0 KB)