Sorry in advance for the wall of text. Not many other good ways to do guidance at this scale.

Break your graph into four sections: **gather**, **compute**, **evaluate** and **record**. Since your evaluation is purely aesthetic and based on a random shuffling this isn’t a great overview of all parts of GD. As such I’m going to shift your proposed example and use a patterned sort with a List Permutation method and a a goal of maximizing the open glazing in key rooms while minimizing the solar gain on the facade. This loosely follows a webinar outline I’m working on for the accounts I support, so while I can’t share the ‘here’s how’ graph yet, the outline and my commentary should guide you along. I recommend starting by saving your graph with a V0.0.1 suffix.

In **gather** you can interact with whatever you want. Revit, Civil3D, etc. this phase should always terminate in a remember node (or series of remember nodes). Think of this like packing the tools you need to build a treehouse - if you don’t bring the hammer you won’t have much use for the nails. In your case you likely want to remember stuff like:

- the geometry of the window family types in an orientation that would match a coordinate system on your populated surface.
- the host surface geometry and local coordinate system for each windows you want to vary
- the required context geometry to visually evaluate your design.
- the index of ‘key space’ windows.
- the percent glazing on each window type.
- the family type element IDs.

In **compute** you will use the data in the ‘gather’ phase, and your inputs to produce a design. For inputs you might have a number slider for the mix ratio of each type of glazing unit, and a permutation number to control the sort order was the top performer - rename both sliders and set them as inputs. You would then apply the mix ratio on the units across the total number of panels so you get at least as many panel geometries as you have panels in one list. Then use the permutation value to sort the panel geometries into a new order. Then apply the list of coordinate systems to the list of window geometries. The design should now be assembled and visible, but you likely want to hide all the geometry and use some Geometry.Color nodes to make it more appealing and easier to understand. Notice there was no call to Revit at all during this phase - we just let Dynamo work with Dynamo content.

In evaluate we need to ‘score’ the design which resulted in the compute phase. We’ll assume that all units have the same orientation to the sun, and that 100% transparent opening would have a solar heat gain value of 10 and a 0% opening would have a zero. The evaluation is as simple as adding the area of the glazing on each window (remember to apply the same permutation and mix functions on that list!) and and divide by the total wall area. To evaluate the key space views we can grab the % opening at the remembered indices from the gather stage, and take the average. Wire the % key area and overall % opening into two renamed watch nodes which are set as ‘outputs’.

Last in the initial authoring we have the **record** phase. This involves moving it back to Revit once you feel Generative Design has found a suitable outcome. Take the same mix value and permutation data as you used in the compute stage, and apply that to the family type ID values. Wire this into a Data.Gate node, and set it to ‘open’ for now. Next take the outcome of that and move the result into a select by ID node. This will give a matching family type for each window in the resulting Dynamo geometry which was evaluated. You can now apply this family type to the original list of window instances. Close the Data.Gate and save the graph you’re almost ready to export.

From here save the graph as a new file with a V0.1.1 suffix, run it once more, add and remove a note, save again (all this to ensure you get serialized data in your remember nodes) close the graph in Dynamo for Revit and open it in Dynamo Sandbox. The graph should run and give you geometry as well as evaluations (watch the watch nodes) for any mix values and any permutation value. If anything fails look into why. There should be no ‘unresolved’ or other warnings between the Data.Remember nodes and the data gate node unless they are edge case related, such as proofreading empty lists or passing the occasional null. Clean those up in Dynamo for Revit, or not as you see fit. Remember the more unaddressed edge cases the more likely you never get results as Dynamo will struggle to avoid those issues. If it all works, close the graph (don’t save it) and reopen it in Dynamo for Revit. You can now export the graph to Generative Design, and test in there. Do a small 10 sample randomization. View those results and see how things look. Then try a cross product study to see how the outcomes on the limits of the design space run. Then try a 8x8 optimization run. If all of those worked out, it’s time to move onto a bigger study - say 100x100 or 20x20 optimizations. Let that sit - walk away, quite literally if you must. Check periodically and see where things are - when done explore the results a bit and decide if you want to do another large or larger study, or if you want to commit a result to Revit.