Design Through Evolution
An exploration of evolutionary design through a custom genetic algorithm built in SideFX Houdini 18 using VEX. Four geometric studies investigate how a population of candidate solutions can evolve toward defined goals: reducing perimeter at a fixed area, reducing surface area at a fixed volume, meeting a building-volume target, and finding a compact bounding-box orientation. The experiments examine how genetic representation, fitness evaluation, selection, crossover, and mutation affect the search, and why a convincing geometric result depends as much on the definition of the problem as on the solver itself.
Building a genetic solver in Houdini I wanted to understand evolutionary optimization by building a solver whose fitness model I could change. Instead of treating optimization as a tool that accepts parameters and returns an answer, I wanted to see how candidate designs were represented, evaluated, selected, and transformed from one generation to the next. The result was an experimental genetic algorithm developed in SideFX Houdini 18 using VEX . I tested the same underlying evolutionary process against four geometric problems, changing the design variables and evaluation criteria for each one. This was a learning exercise rather than a benchmarked optimization package. The studies document the behavior of the prototype and the questions it raised; they do not establish that it consistently finds global optima. The procedural setup: generating candidate geometry, evaluating it, and feeding a new population into the next generation. From design variables to a search problem An evolutionary algorithm works with a population of possible solutions. Each candidate has a set of variables, or genes , that determines its geometry. A fitness function measures how well the resulting geometry meets a design objective. Selection favors stronger candidates, while crossover and mutation generate new combinations for evaluation. For geometric design, the variables might be point positions, dimensions, or rotation angles. The important distinction is between the values the solver changes and the geometry it measures. In these experiments, the genes changed between studies, but the general cycle remained the same: Generate → evaluate → rank → select → recombine → mutate → repeat. The travelling salesman problem is a useful illustration of why search methods matter. With a fixed starting city, a brute-force enumeration considers (n − 1)! visit orders. If distances are symmetric, a route and its reverse are equivalent, leaving (n − 1)! / 2 distinct tours for more than two cities: 3 tours for 4 cities and 181,440 for 10 cities. The number of possibilities grows rapidly. A genetic algorithm samples and evolves a population instead of enumerating every possibility. This can produce useful solutions, but it does not guarantee the shortest route. A route-based solver also needs operators that preserve valid permutations; exchanging arbitrary genes can otherwise repeat or omit cities. My Houdini experiments did not implement a travelling salesman solver. They used geometric variables to investigate the evolutionary process directly. The Houdini implementation Houdini provided a procedural environment in which I could inspect both the population and the geometry produced by it. VEX handled attribute operations and geometric evaluation. Population sizes varied between approximately 10 and 100 candidates , with larger experiments typically using 50–100 . My original notes describe thousands of generations running within minutes for these small studies. That is an observation from the experiment, rather than a reproducible performance claim: the archive does not include the hardware specifications, timing logs, or repeated trials needed for a meaningful benchmark. 1. Generate the initial population Each candidate started with a different set of values within the chosen parameter ranges. This initial variation gave the solver alternative directions to explore. The representation needed to remain consistent within a study so that the same gene referred to the same geometric property in every candidate. 2. Evaluate and rank candidates The solver measured each candidate against the current objective. Depending on the study, evaluation involved area, perimeter, volume, surface area, or the volume of an axis-aligned bounding box. I used VEX's argsort to obtain an ordering from the evaluation values. It returns indices in ascending order. For a cost being minimized, the first indices identify the stronger candidates; a fitness score being maximized requires the opposite ordering. Keeping that convention explicit avoids selecting the least successful candidates by mistake. 3. Select parents and recombine genes The prototype selected approximately the best 50% of the population as a parent pool. New candidates were produced by combining values from selected parents, exchanging roughly half of the available genes between them. This made the genetic representation consequential. Recombining rotation angles produces a different kind of search from recombining point coordinates. In either case, a child still needs to be checked against parameter bounds and geometric validity. 4. Introduce mutation The recorded mutation setting affected approximately 5% of the new population , perturbing values within a defined range. This describes the experimental setup; it should not be confused with a universal recommendation to mutate every gene with a 5% probability. The comparisons explored whether mutation helped the population escape repetitive outcomes. Its effect depends on both how often a candidate changes and how large each change is. Small perturbations and complete random resets explore the parameter space differently. 5. Repeat and inspect the result The new population was evaluated again, and the process continued for a chosen number of generations. The prototype displayed the strongest candidate and a fitness score scaled to 1,000 . That scale was an internal display convention, not an independent certificate of optimality. Four geometric studies Study 1 — Reducing perimeter while preserving area Objective: evolve a planar shape toward an area of 1 m² while reducing its perimeter. The study began with a rectangular configuration and explored changes to its geometric representation. The key technical issue is the distinction between an objective and a constraint: reducing perimeter alone allows a shape to shrink. Area must remain controlled for the comparison to be meaningful. A useful mathematical statement of the problem is: Minimize P(x) subject to A(x) = 1 m² Here, x is the candidate's parameter vector, P is perimeter, and A is area. This states the intended problem; it is not a reconstruction of the exact original VEX fitness expression. For a freely varying, simple closed planar curve, the theoretical lower bound at this area is a circle with perimeter 2√π ≈ 3.545 m . If the design is restricted to rectangles, the optimum is a square with perimeter 4 m . A fixed-resolution polygon has its own representational limits. The attainable result therefore depends on what the genes allow the shape to become. The original notes used π as the perimeter target. That is not the correct perimeter for a circle of area 1 m². More fundamentally, a solver that rewards proximity to a predetermined target is testing a different fitness model from one that minimizes perimeter subject to an area constraint. The initial area–perimeter study. The mutation variation. The visual comparison illustrates search behavior; it does not provide a statistical measure of improvement. Study 2 — Reducing surface area while preserving volume Objective: evolve a three-dimensional form toward a volume of 1 m³ while reducing its surface area. This extends the first problem into three dimensions: Minimize S(x) subject to V(x) = 1 m³ For unrestricted closed solids, the theoretical minimum is a sphere, with surface area (36π)^(1/3) ≈ 4.836 m² at unit volume. If the representation is restricted to rectangular boxes, the optimum is a cube with surface area 6 m² . π is not the correct surface-area target in either case. The archived animations show the surface-area and volume experiments, including a mutation variation. They do not include numerical convergence histories or constraint-error measurements, so they support a qualitative account of the search rather than a claim that either theoretical bound was reached. The surface-area and volume study. The mutation variation of the three-dimensional study. Study 3 — Reaching a target building volume Objective: adjust a basic building-like form toward a target volume without optimizing surface area. In this case, the fitness model did not describe architectural quality. It rewarded agreement with a volume target. In the recorded experiment, the form progressively increased in height to reach that target rather than retaining the proportions I expected. At the time, I suspected an implementation error. The available record does not establish the cause. Increasing height may also be an acceptable response to a volume-only objective when height remains an unconstrained variable. This became one of the most useful observations in the project: a solver can improve its measured objective while producing a form that does not match the designer's intention. Height limits, footprint constraints, aspect ratios, or other requirements would need to be encoded explicitly if they are meant to influence the outcome. The volume-driven study, in which growth in height became the visible response. Study 4 — Finding a compact bounding-box orientation Objective: rotate an irregular object to minimize the volume of its axis-aligned bounding box. This required a different genetic representation. Instead of exchanging point coordinates, I stored a candidate orientation as three rotation values: x = (θx, θy, θz) Cost(x) = bounding_box_width × bounding_box_depth × bounding_box_height The object itself retained its shape. Each candidate rotated that object and measured the enclosing box in a fixed coordinate frame. The box must remain axis-aligned in that frame; rotating an already fitted box together with the object would not change its volume. The geometry, rather than the angle values themselves, determined fitness. A rotation angle has no useful standalone score here: its effect depends on the other rotations, their composition order, and the object's shape. The rotation-based search. The mutation variation, also used as this post's thumbnail. Some generations briefly achieved the maximum displayed score and then lost that candidate during subsequent reproduction. This exposed a limitation in how the prototype retained results. A maximum display score alone is not proof of the global minimum, but losing the best observed candidate is avoidable. A revised implementation should store the best candidate found across the entire run. It could also use elitism to carry selected candidates into the next generation unchanged, alongside a stopping criterion based on a validated target, negligible improvement, or a generation limit. These are proposed improvements, not features demonstrated by the original experiment. What the experiments established The four studies showed how much the behavior of an evolutionary solver depends on three connected choices: what the candidate can change, what the fitness model measures, and what the process preserves between generations . For a more rigorous version, I would separate constraint violations from the objective and normalize quantities before combining them into a weighted score. Adding raw metres, square metres, and cubic metres does not produce a meaningful cost. Penalty weights also need testing: a candidate should not gain an apparent advantage by violating the area or volume requirement. I would record the best and median evaluation values, constraint errors, random seed, parameter ranges, and mutation settings for each run. Repeated runs would help distinguish reliable behavior from a fortunate initialization. Analytical reference cases, such as the square within the rectangle family and the cube within the box family, would provide checks before applying the solver to less predictable geometry. The most valuable outcome was a clearer understanding of how to formulate an optimization problem. The algorithm can search the space it is given, but the designer still determines the variables, boundaries, and meaning of a successful result. References and learning resources Daniel Shiffman — The Nature of Code: Evolutionary Computing . A foundation for understanding genetic algorithms and their implementation. Junichiro Horikawa — video referenced in the original project . The original notes credit this resource as a Python-based implementation reference. Genetic Algorithms in Houdini — original od|force discussion . The original notes credit Niels Provos's Houdini/PDG work as a precedent for the surface-area and volume study. SideFX — VEX argsort documentation . Reference for sorting candidate indices by their evaluation values.







