02

constrained optimization tool

**Radical**: a constrained optimization tool for Grasshopper with specific features to handle geometries as design variables and an independent UI to select variables, modify optimization parameters, and export data.

*With Alicia Nimrick, Violetta Jusiega, Nathan Brown, and Caitlin Mueller*

For my own research, I needed a good constrained optimization tool that would be directly integrated within the CAD platform I typically use (Rhino + Grasshopper), so I decided to build one! Because I already had built an optimization tool for Grasshopper, I was at least able to reuse the code that allows to iterate through a parametric script. As for the optimization, there is no point in reinventing the wheel and no intellectual merit in reimplementing optimized code, so I used a C# wrapper of the famous NLopt open-source library, which contains algorithms for constrained and unconstrained optimization (including gradient-based, gradient-free, deterministic, stochastic, global, and local algorithms).

**Radical** needed a few key features:

- some simple visualization of the progress of the algorithm
- the ability of stopping the optimization through cross-thread operations
- A way for the tool to directly interpret and modify geometric data (surfaces, curves, …) as numerical parameters, because that would greatly facilitate setting up scripts for optimizing geometry

The tool comes with many different optimization algorithms, which should be used depending on the type of optimization problem at hand. For example, the two optimization histories below correspond to the same optimization problem.

In short, **Radical** accepts geometric input (see section below), interprets it, and allows the user to toggle and bound the resulting variables with a straightforward interface. In my own experience, the whole process is much more intuitive and efficient. The goal is to extend this feature to meshes, for which a slightly smarter scheme must be developed as a node-by-node scheme would be unmanageable.

In a couple days, I quickly implemented a minimum viable product, which was good enough for me, but was somewhat quirky, and certainly had a few bugs. I then supervised two fantastic undergraduate students, **Violetta Jusiega** and **Alicia Nimrick**, who refined the tool over the summer of 2018. **Radical** is now available on Food4Rhino, and the source code is available on my Github account.

Since then, I have used **Radical** for many research projects, including this one and that one.

The automatic parametrization feature the most important one in my opinion. Most optimization tools for Grasshopper only accept slider variables as input, but, when doing shape optimization for example, it would be easier to simply input the geometry to optimize without having to define 100+ slider variables. Geometric entities, curves, surfaces, are often controlled by set of control points in plan or in space. If a computational system is to manipulate those automatically, it needs to turn a geometry into a set of numerical variables. Instead of a tedious manual surface or curve parametrization by the designer in the visual scripting environment, I developed an automatic parametrization system, which, given a geometry, registers each of its control point as a set of variables to which it assigns bounds set by the designer.