# ModelBuilder Collect Values output values to a table?

I am working with Build Balanced Zones tool in ArcGIS Pro, which uses a genetic algorithm to find an optimal solution to a spatial problem (such as creating zones with equal population). It uses a parameter called generations (the more generations you use, the better the solution will be) to generate those zones. There isn't much information about what is the optimal amount of generations because it largely depends on the problem. By using the default settings, it shows that it found the optimal solution, but by running those same parameters again, the solution is different. I believe it gets stuck in local maxima. I found that by increasing the generations to a fairly high number (which makes the tools running time fairly time-consuming) it finds the same solution every time. I want to find out how many generations is it reasonable to use in order to find the solution which is the same every time I run it.

I believe there are many ways to find the solution, but right now I created a model with ArcGIS ModelBuilder, which is missing a couple of steps in the end.

It starts with a For loop, which increases the number of generations used in the iteration. It outputs the generated solution. From there, the solution is dissolved based on the generated Zone_ID in order to compare it against the perfect solution which was previously created using a very high number of generations. Ideally, it should compare it against the next generation, but it is difficult to use two iterators together. The Spatial Join used is Are Identical To, which outputs the join count of 1 if the polygons are geometrically identical and 0 if they are not. Then I use the Summary Statistics tool which finds the sum of the join count field. Generating a table with one row in the process. I use a Get Field Value tool to find that value. I am calculating that value based on an expression. Right now, I am using smaller sample data and I know that if that value equals 4 then it is the right generation. I could use a Stop tool right there, which ends the iteration, but I found that the result could also be false positive. Genetic Algorithms use randomness and it could have been just luck that the two solutions match perfectly.  Hence, I need to collect the values and apply some sort of pattern finder script to it (if the expression is true ten times in a row for example). Currently, I have collected those values with Collect Values, but it does not let me output it to some sort of a table, for which I could apply further expressions. The values are just there, and I can't seem to do anything with them. I can clearly see that the expression became true (value of 1) in a visible pattern as the generation number started to increase. Is there any way I can create a view or table with those values in the same iteration?  • @AndresKasekamp - So your model is looking good, you just need to pass in the list into your function `listcreation("%Sierra%")` and obviously change you function declaration and code to access the list passed into the function. Jun 8, 2020 at 18:17